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; 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() { List<GetThreadResponse> listOfSelectedThreads() {
return selectedEmails; return selectedEmails;
} }
@ -164,6 +178,7 @@ class _EmailListScreenState extends State<EmailListScreen>
icon: Icon(Icons.delete_outline), icon: Icon(Icons.delete_outline),
onPressed: () { onPressed: () {
// delete email // delete email
ApiService().deleteEmail(widget.folder, email.id);
}, },
), ),
], ],
@ -297,8 +312,13 @@ class EmailPageState extends State<EmailPage> {
return selectionType; return selectionType;
} }
bool moveSelectedOfFolder(String folder) {
emailListKey.currentState?.moveOfSelected(folder);
return false;
}
List<GetThreadResponse> getListOfSelected() { 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)]; // return [GetThreadResponse(id: 1, messages: [], subject: "subject", date: DateTime(2025), from_name: "from_name", from_address: "from_address", to: [], seen: false)];