Created
October 29, 2019 10:43
-
-
Save nkenna/7c346df8acdd23c23497efc92e920a7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Padding( | |
padding: EdgeInsets.all(4.0), | |
child: Container( | |
width: 300, | |
height: 350, | |
child: WebView( | |
initialUrl: 'http://192.168.43.25:8000', | |
javascriptMode: JavascriptMode.unrestricted, | |
onWebViewCreated: (WebViewController webViewController) { | |
_controller.complete(webViewController); | |
}, | |
// TODO(iskakaushik): Remove this when collection literals makes it to stable. | |
// ignore: prefer_collection_literals | |
javascriptChannels: <JavascriptChannel>[ | |
_toasterJavascriptChannel(context), | |
].toSet(), | |
navigationDelegate: (NavigationRequest request) { | |
if (request.url.startsWith('https://www.youtube.com/')) { | |
print('blocking navigation to $request}'); | |
return NavigationDecision.prevent; | |
} | |
print('allowing navigation to $request'); | |
return NavigationDecision.navigate; | |
}, | |
onPageFinished: (String url) { | |
print('Page finished loading: $url'); | |
}, | |
), | |
) | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment