💄 Optimized notification list

This commit is contained in:
2024-10-16 22:32:44 +08:00
parent 6e00a99803
commit 9012566dbf
6 changed files with 62 additions and 8 deletions

View File

@ -55,7 +55,11 @@ class NotificationProvider extends GetxController {
await client.put('/notifications/read', {'messages': markList});
}
nty.notifications.clear();
nty.notifications.value = nty.notifications.map((x) {
x.readAt = DateTime.now();
return x;
}).toList();
nty.notifications.refresh();
isBusy.value = false;
}
@ -79,7 +83,8 @@ class NotificationProvider extends GetxController {
await client.put('/notifications/read/${element.id}', {});
nty.notifications.removeAt(index);
nty.notifications[0].readAt = DateTime.now();
nty.notifications.refresh();
isBusy.value = false;
}