iwebview_flutter 0.1.2 copy "iwebview_flutter: ^0.1.2" to clipboard
iwebview_flutter: ^0.1.2 copied to clipboard

outdated

A Flutter plugin that provides a WebView widget on Android and iOS.

WebView for flutter #

基于flutter官方WebView开发,新增backgroundColor属性,onProgressChanged,shouldInterceptRequest方法。 使用方法: 引入库

dependencies:
  iwebview_flutter: ^0.1.1

添加拦截监听

WebView(
      initialUrl: "https://www.google.com",
      javascriptMode: JavascriptMode.unrestricted,
      debuggingEnabled: true,
      onProgressChanged: (int p){//0-100
        setState(() {
          progress = p/100.0;
        });
      },
      backgroundColor: Colors.red,
      shouldInterceptRequest: (String url) async {//替换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;
      },
),
7
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A Flutter plugin that provides a WebView widget on Android and iOS.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on iwebview_flutter