mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Prevent notification dismissal from ocurring multiple times (#435)
This commit is contained in:
parent
76b6191a67
commit
8f1cd1cae1
@ -23,6 +23,8 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
|
|||||||
|
|
||||||
List<InvenTreeNotification> notifications = [];
|
List<InvenTreeNotification> notifications = [];
|
||||||
|
|
||||||
|
bool isDismissing = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle() => L10().notifications;
|
String getAppBarTitle() => L10().notifications;
|
||||||
|
|
||||||
@ -45,10 +47,23 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
|
|||||||
*/
|
*/
|
||||||
Future<void> dismissNotification(BuildContext context, InvenTreeNotification notification) async {
|
Future<void> dismissNotification(BuildContext context, InvenTreeNotification notification) async {
|
||||||
|
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
isDismissing = true;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await notification.dismiss();
|
await notification.dismiss();
|
||||||
|
|
||||||
|
if (mounted) {
|
||||||
refresh(context);
|
refresh(context);
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
isDismissing = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -77,7 +92,7 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
|
|||||||
subtitle: Text(notification.message),
|
subtitle: Text(notification.message),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
icon: FaIcon(FontAwesomeIcons.bookmark),
|
icon: FaIcon(FontAwesomeIcons.bookmark),
|
||||||
onPressed: () async {
|
onPressed: isDismissing ? null : () async {
|
||||||
dismissNotification(context, notification);
|
dismissNotification(context, notification);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user