2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 02:05:29 +00:00

Adds ability to "dismiss" a notification

This commit is contained in:
Oliver Walters
2022-05-04 11:21:52 +10:00
parent 6bbae67482
commit 020f006410
3 changed files with 33 additions and 3 deletions

View File

@ -36,6 +36,8 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
final results = await InvenTreeNotification().list();
notifications.clear();
for (InvenTreeModel n in results) {
if (n is InvenTreeNotification) {
notifications.add(n);
@ -43,6 +45,14 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
}
}
Future<void> dismissNotification(BuildContext context, InvenTreeNotification notification) async {
await notification.dismiss();
refresh(context);
}
List<Widget> renderNotifications(BuildContext context) {
List<Widget> tiles = [];
@ -66,7 +76,7 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
trailing: IconButton(
icon: FaIcon(FontAwesomeIcons.bookmark),
onPressed: () async {
dismissNotification(context, notification);
},
),
)