Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions lib/mainwrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,32 @@ class MainWrapperState extends State<MainWrapper> {
];

Future<bool> _systemBackButtonPressed() async {
if (_navigatorKeys[_selectedIndex].currentState?.canPop() == true) {
_navigatorKeys[_selectedIndex]
.currentState
?.pop(_navigatorKeys[_selectedIndex].currentContext);
return false;
} else {
SystemChannels.platform.invokeMethod<void>('SystemNavigator.pop');
return true; // Indicate that the back action is handled
}
if (_navigatorKeys[_selectedIndex].currentState?.canPop() == true) {
_navigatorKeys[_selectedIndex]
.currentState
?.pop(_navigatorKeys[_selectedIndex].currentContext);
return false;
} else {
return await showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text('Exit App'),
content: Text('Do you really want to exit the app?'),
actions: <Widget>[
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: Text('No'),
),
TextButton(
onPressed: () => SystemChannels.platform.invokeMethod<void>('SystemNavigator.pop'),
child: Text('Yes'),
),
],
),
) ?? false;
}
}


@override
Widget build(BuildContext context) {
Expand Down