2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 13:36:50 +00:00
Oliver 38e4735f77 Add a custom "back" button to refreshable state
- Long press to return to the "home" screen
2021-10-03 11:06:27 +11:00

27 lines
616 B
Dart

/*
* 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();
}
},
),
);
}