iwebview_flutter 0.1.4  iwebview_flutter: ^0.1.4 copied to clipboard
iwebview_flutter: ^0.1.4 copied to clipboard
A webview plugin develop from webview_flutter,add shouldInterceptRequest,onProgressChanged,onScroll...
WebView for flutter #
Base on webview_flutter, add some new features.
- backgroundColor
- onProgressChanged
- shouldInterceptRequest: intercept request and load resource from local.
- onScroll: listen webview scroll.
how to use #
dependencies:
  iwebview_flutter: ^latest version
WebView(
      initialUrl: "https://www.google.com",
      javascriptMode: JavascriptMode.unrestricted,
      debuggingEnabled: true,
      onProgressChanged: (int p){//0-100
        setState(() {
          progress = p/100.0;
        });
      },
      onScroll(int x,int y){
      },
      backgroundColor: Colors.red,
      shouldInterceptRequest: (String url) async {//replace google logo
        var googleLogo = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_160x56dp.png";
        print("============url:$url");
        if (url == googleLogo) {
          ByteData data = await rootBundle.load("assets/baidu.png");
          Uint8List bytes = Uint8List.view(data.buffer);
          return Response("image/png", null, bytes);
        }
        return null;
      },
),