Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what about this.. #19

Closed
bakboem opened this issue Dec 26, 2021 · 1 comment
Closed

what about this.. #19

bakboem opened this issue Dec 26, 2021 · 1 comment

Comments

@bakboem
Copy link

bakboem commented Dec 26, 2021

WillPopScope(
onWillPop: () async {
if (exitAppTimer == null) {
exitAppTimer = Timer(Duration(seconds: 3), () {});
AppToast().show(context, '${tr('ext_app_when_tap_again')}');
} else {
if (exitAppTimer!.isActive) {
exit(0);
} else {
exitAppTimer = Timer(Duration(seconds: 3), () {});
AppToast().show(context, '${tr('ext_app_when_tap_again')}');
}
}

      return false;
    },
@hcbpassos
Copy link
Owner

thanks for the suggestion ❤️ also, sorry for the late response. i accidentally disabled my email notifications.

this solution has a few downsides, though. for instance, it won't check ModalRoute.willHandlePopInternally, so if a drawer is open, it won't close before showing the toast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants