mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-29 20:40:35 +00:00 
			
		
		
		
	Add a custom "back" button to refreshable state
- Long press to return to the "home" screen
This commit is contained in:
		
							
								
								
									
										27
									
								
								lib/widget/back.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								lib/widget/back.dart
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| /* | ||||
|  * A custom implementation of a "Back" button for display in the app drawer | ||||
|  * | ||||
|  * Long-pressing on this will return the user to the home screen | ||||
|  */ | ||||
|  | ||||
| import "package:flutter/cupertino.dart"; | ||||
| import "package:flutter/material.dart"; | ||||
|  | ||||
| Widget backButton(BuildContext context) { | ||||
|  | ||||
|   return GestureDetector( | ||||
|     onLongPress: () { | ||||
|       while (Navigator.of(context).canPop()) { | ||||
|         Navigator.of(context).pop(); | ||||
|       } | ||||
|     }, | ||||
|     child: IconButton( | ||||
|       icon: BackButtonIcon(), | ||||
|       onPressed: () { | ||||
|         if (Navigator.of(context).canPop()) { | ||||
|           Navigator.of(context).pop(); | ||||
|         } | ||||
|       }, | ||||
|     ), | ||||
|   ); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user