mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-31 21:35:42 +00:00 
			
		
		
		
	Notification fixes (#240)
* Show snack bar for shorter duration if no associated action * Dismiss snack bars with tap * Upate release notes
This commit is contained in:
		| @@ -6,9 +6,9 @@ | |||||||
|  |  | ||||||
| - Support custom icons for part category | - Support custom icons for part category | ||||||
| - Support custom icons for stock location | - Support custom icons for stock location | ||||||
|  | - Adjustments to notification messages | ||||||
| - Updated translations | - Updated translations | ||||||
|  |  | ||||||
|  |  | ||||||
| ### 0.9.1 - December 2022 | ### 0.9.1 - December 2022 | ||||||
| --- | --- | ||||||
|  |  | ||||||
|   | |||||||
| @@ -45,15 +45,6 @@ void showSnackIcon(String text, {IconData? icon, Function()? onAction, bool? suc | |||||||
|  |  | ||||||
|   String _action = actionText ?? L10().details; |   String _action = actionText ?? L10().details; | ||||||
|  |  | ||||||
|   SnackBarAction? action; |  | ||||||
|  |  | ||||||
|   if (onAction != null) { |  | ||||||
|     action = SnackBarAction( |  | ||||||
|       label: _action, |  | ||||||
|       onPressed: onAction, |  | ||||||
|     ); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   List<Widget> childs = [ |   List<Widget> childs = [ | ||||||
|     Text(text), |     Text(text), | ||||||
|     Spacer(), |     Spacer(), | ||||||
| @@ -64,11 +55,24 @@ void showSnackIcon(String text, {IconData? icon, Function()? onAction, bool? suc | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   OneContext().showSnackBar(builder: (context) => SnackBar( |   OneContext().showSnackBar(builder: (context) => SnackBar( | ||||||
|     content: Row( |     content: GestureDetector( | ||||||
|  |       child: Row( | ||||||
|         children: childs |         children: childs | ||||||
|  |       ), | ||||||
|  |       onTap: () { | ||||||
|  |         ScaffoldMessenger.of(context!).hideCurrentSnackBar(); | ||||||
|  |       }, | ||||||
|     ), |     ), | ||||||
|     backgroundColor: backgroundColor, |     backgroundColor: backgroundColor, | ||||||
|     action: action |     action: onAction == null ? null : SnackBarAction( | ||||||
|  |       label: _action, | ||||||
|  |       onPressed: () { | ||||||
|  |         // Immediately dismiss the notification | ||||||
|  |         ScaffoldMessenger.of(context!).hideCurrentSnackBar(); | ||||||
|  |         onAction(); | ||||||
|  |       } | ||||||
|  |     ), | ||||||
|  |     duration: Duration(seconds: onAction == null ? 1 : 2), | ||||||
|     ) |     ) | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user