Skip to content

Instantly share code, notes, and snippets.

@shiburagi
Last active September 18, 2021 16:02
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 shiburagi/bc4de0d26ed7b381ed0ad46e87eb74a3 to your computer and use it in GitHub Desktop.
Save shiburagi/bc4de0d26ed7b381ed0ad46e87eb74a3 to your computer and use it in GitHub Desktop.
Widget build(BuildContext context) {
String loadUrl =
"https://www.thevocket.com/rakaman-mak-cik-ini-terpaksa-langgar-axia-untuk-keluar-parkir-curi-tumpuan-ramai/";
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: WebView(
initialUrl: loadUrl,
javascriptMode: JavascriptMode.unrestricted,
onProgress: (progress) {
print(progress);
},
onWebViewCreated: (controller) {
print("created");
},
navigationDelegate: (navigation) {
if (navigation.url.contains(loadUrl))
return NavigationDecision.navigate;
else {
String url = navigation.url;
print(url);
return NavigationDecision.prevent;
}
},
onPageFinished: (url) {},
onWebResourceError: (error) {
print(error);
},
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment