mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-11-04 07:15:46 +00:00 
			
		
		
		
	* Remove unused lib/generated/i18n.dart * Use `fvm dart format .` * Add contributing guidelines * Enforce dart format * Add `dart format off` directive to generated files
		
			
				
	
	
		
			24 lines
		
	
	
		
			556 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			556 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
import "package:flutter/material.dart";
 | 
						|
 | 
						|
/*
 | 
						|
 * Construct a custom back button with special feature!
 | 
						|
 *
 | 
						|
 * Long-pressing on this will return the user to the home screen
 | 
						|
 */
 | 
						|
Widget backButton(BuildContext context, GlobalKey<ScaffoldState> key) {
 | 
						|
  return GestureDetector(
 | 
						|
    onLongPress: () {
 | 
						|
      // Display the menu
 | 
						|
      key.currentState!.openDrawer();
 | 
						|
    },
 | 
						|
    child: IconButton(
 | 
						|
      icon: BackButtonIcon(),
 | 
						|
      onPressed: () {
 | 
						|
        if (Navigator.of(context).canPop()) {
 | 
						|
          Navigator.of(context).pop();
 | 
						|
        }
 | 
						|
      },
 | 
						|
    ),
 | 
						|
  );
 | 
						|
}
 |