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:
@ -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);
|
||||
},
|
||||
),
|
||||
)
|
||||
|
Reference in New Issue
Block a user