File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ android {
2525 testInstrumentationRunner " android.support.test.runner.AndroidJUnitRunner"
2626 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
2727 applicationId " com.yourcompany.flutter_webview_plugin_example"
28+ minSdkVersion 16
2829 }
2930
3031 buildTypes {
Original file line number Diff line number Diff line change @@ -63,11 +63,19 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
6363 Timer _resizeTimer;
6464 StreamSubscription <WebViewStateChanged > _onStateChanged;
6565
66+ var _onDestroy;
67+
6668 @override
6769 void initState () {
6870 super .initState ();
6971 webviewReference.close ();
7072
73+ _onDestroy = webviewReference.onDestroy.listen ((_) {
74+ if (mounted) {
75+ Navigator .of (context).pop ();
76+ }
77+ });
78+
7179 if (widget.hidden) {
7280 _onStateChanged = webviewReference.onStateChanged.listen ((WebViewStateChanged state) {
7381 if (state.type == WebViewState .finishLoad) {
@@ -80,6 +88,7 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
8088 @override
8189 void dispose () {
8290 super .dispose ();
91+ _onDestroy? .cancel ();
8392 _resizeTimer? .cancel ();
8493 webviewReference.close ();
8594 if (widget.hidden) {
You can’t perform that action at this time.
0 commit comments