build method

  1. @override
Widget build(
  1. BuildContext context,
  2. WidgetBuilderViewModel viewModel
)

Implementation

@override
Widget build(BuildContext context, WidgetBuilderViewModel viewModel) {
  return WebView(
    initialUrl: url,
    zoomEnabled: false,
    javascriptMode: JavascriptMode.unrestricted,
    onWebViewCreated: (WebViewController webViewController) {
      webViewController.clearCache();
    },
    onWebResourceError: (error) {
      Utils.log.d("error",error.failingUrl);
      viewModel.loadingStart();
      Utils.log.d(error.failingUrl);
    },
    onPageStarted: (url) => viewModel.onPageStarted(url),
    onPageFinished: (url) => viewModel.onPageFinished(url),
    navigationDelegate: (NavigationRequest request) {
      Utils.log.d("error",request.url);
      return viewModel.onUrlChange( request, (object, context) async {
        callback(object, context);
      }, context);
    },
  );
}