Skip to content

Commit

Permalink
Merge pull request #317 from blackmenthor/master
Browse files Browse the repository at this point in the history
hotfix widget back to initialChild after webview is tapped on Android
  • Loading branch information
charafau authored Mar 13, 2019
2 parents 284b42f + a119a61 commit 46b3fa5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/src/webview_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,19 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
Timer _resizeTimer;
StreamSubscription<WebViewStateChanged> _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) {
Expand All @@ -82,6 +90,7 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
@override
void dispose() {
super.dispose();
_onDestroy?.cancel();
_resizeTimer?.cancel();
webviewReference.close();
if (widget.hidden) {
Expand Down

0 comments on commit 46b3fa5

Please sign in to comment.