File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -76,20 +76,11 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
7676 super .initState ();
7777 webviewReference.close ();
7878
79- _onBack = webviewReference.onBack.listen ((_) {
79+ _onBack = webviewReference.onBack.listen ((_) async {
8080 if (! mounted) return ;
8181
82- final route = ModalRoute .of (context);
83-
84- // Close the native widget only if the back operation was not veto'd
85- // by the [WillPopScope] widget or similar.
86- final handler = () => webviewReference.close ();
87- route? .addScopedWillPopCallback (handler);
88- try {
89- // Perform the 'back' operation.
90- Navigator .of (context).pop ();
91- } finally {
92- route? .removeScopedWillPopCallback (handler);
82+ if (await Navigator .maybePop (context)) {
83+ webviewReference.close ();
9384 }
9485 });
9586
You can’t perform that action at this time.
0 commit comments