moves the selected threads of folder

This commit is contained in:
Juan Marulanda De Los Rios 2025-08-20 13:51:08 -04:00
parent ab0adf62e4
commit 5dc749eaec

View File

@ -91,6 +91,20 @@ class _EmailListScreenState extends State<EmailListScreen>
return false;
}
bool moveOfSelected(String destinyFolder) {
//this should be called from a widget
print("move of folder");
setState(() {
for (int email = 0; email < selectedEmails.length; email++) {
ApiService().moveEmail(
widget.folder, selectedEmails[email].id.toString(), destinyFolder);
}
});
return false;
}
// Widget moveOfFolderWidget()
List<GetThreadResponse> listOfSelectedThreads() {
return selectedEmails;
}
@ -153,7 +167,7 @@ class _EmailListScreenState extends State<EmailListScreen>
IconButton(
icon: Icon(Icons.mark_email_read_outlined),
onPressed: () {
//mark email as read
// mark email as read
setState(() {
widget.emails[index].seen = true;
ApiService().markAsSeen(email.id);
@ -163,7 +177,8 @@ class _EmailListScreenState extends State<EmailListScreen>
IconButton(
icon: Icon(Icons.delete_outline),
onPressed: () {
//delete email
// delete email
ApiService().deleteEmail(widget.folder, email.id);
},
),
],
@ -297,8 +312,13 @@ class EmailPageState extends State<EmailPage> {
return selectionType;
}
bool moveSelectedOfFolder(String folder) {
emailListKey.currentState?.moveOfSelected(folder);
return false;
}
List<GetThreadResponse> getListOfSelected() {
return emailListKey.currentState!.listOfSelectedThreads() ?? [];
return emailListKey.currentState!.listOfSelectedThreads();
}
// return [GetThreadResponse(id: 1, messages: [], subject: "subject", date: DateTime(2025), from_name: "from_name", from_address: "from_address", to: [], seen: false)];