From cf99d11ee1cb3f7da6b31047c63716177546f285 Mon Sep 17 00:00:00 2001 From: Angga Dwi Arifandi Date: Wed, 6 Feb 2019 13:50:34 +0700 Subject: [PATCH 1/2] hotfix widget back to initialChild after tap action and add minSdkVersion on example gradle --- example/android/app/build.gradle | 1 + lib/src/webview_scaffold.dart | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 8d163b0d..3a963017 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -25,6 +25,7 @@ android { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.yourcompany.flutter_webview_plugin_example" + minSdkVersion 16 } buildTypes { diff --git a/lib/src/webview_scaffold.dart b/lib/src/webview_scaffold.dart index 8df7b05f..61778c14 100644 --- a/lib/src/webview_scaffold.dart +++ b/lib/src/webview_scaffold.dart @@ -63,11 +63,19 @@ class _WebviewScaffoldState extends State { Timer _resizeTimer; StreamSubscription _onStateChanged; + var _onDestroy; + @override void initState() { super.initState(); webviewReference.close(); + _onDestroy = webviewReference.onDestroy.listen((_) { + if (mounted) { + Navigator.of(context).pop(); + } + }); + if (widget.hidden) { _onStateChanged = webviewReference.onStateChanged.listen((WebViewStateChanged state) { if (state.type == WebViewState.finishLoad) { @@ -80,6 +88,7 @@ class _WebviewScaffoldState extends State { @override void dispose() { super.dispose(); + _onDestroy?.cancel(); _resizeTimer?.cancel(); webviewReference.close(); if (widget.hidden) { From a119a611aae8f077e07df364bc11b31c67f8e163 Mon Sep 17 00:00:00 2001 From: Rafal Wachol Date: Wed, 13 Mar 2019 21:52:25 +0000 Subject: [PATCH 2/2] Update build.gradle --- example/android/app/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 3a963017..8d163b0d 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -25,7 +25,6 @@ android { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.yourcompany.flutter_webview_plugin_example" - minSdkVersion 16 } buildTypes {