mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Adds ability to "dismiss" a notification
This commit is contained in:
parent
6bbae67482
commit
020f006410
3 changed files with 33 additions and 3 deletions
|
|
@ -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);
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue