Skip to content

Instantly share code, notes, and snippets.

@nkenna
Created October 29, 2019 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkenna/7c346df8acdd23c23497efc92e920a7b to your computer and use it in GitHub Desktop.
Save nkenna/7c346df8acdd23c23497efc92e920a7b to your computer and use it in GitHub Desktop.
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