createWebViewController method

WebViewController createWebViewController()

Implementation

WebViewController createWebViewController() {
  return WebViewController()
    ..setJavaScriptMode(JavaScriptMode.unrestricted)
    ..setBackgroundColor(const Color(0x00000000))
    ..setNavigationDelegate(
      NavigationDelegate(
        onProgress: (int progress) {
          if (!isNotifyLoad) {
            isNotifyLoad = true;
            onLoad(src);
          }
          // Update loading bar.
        },
        onPageStarted: onLoadStart,
        onPageFinished: (String url) {
          onLoadEnd(url, true, '');
        },
        onWebResourceError: (WebResourceError error) {
          var isForMainFrame = error.isForMainFrame ?? false;
          if (isForMainFrame) {
            onLoadEnd(src, true, '');
            onLoadError(error);
          }
        },
      ),
    );
}