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