initStyles static method
Implementation
static void initStyles(Styles? s) {
if (s != null) {
styles = Styles(
shadowColor: s.shadowColor,
shadowOpacity: s.shadowOpacity,
textSkip: s.textSkip,
imageFilter: s.imageFilter,
);
}
// else {
// styles = Styles(
// shadowColor: Colors.red,
// shadowOpacity: 0.5,
// textSkip: "SKIP",
// imageFilter: ImageFilter.blur(sigmaX: 8, sigmaY: 8),
// );
// }
controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {
// Update loading bar.
},
onPageStarted: (String url) {},
onPageFinished: (String url) async {
var x = await controller!.runJavaScriptReturningResult(
"document.documentElement.scrollHeight");
double? y = double.tryParse(x.toString());
debugPrint('parse : $y');
},
onHttpError: (HttpResponseError error) {},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith('https://www.youtube.com/')) {
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
),
);
}