https://github.com/iamyours/webview_flutter
base on webview_flutter,intercept request and load resource from local
https://github.com/iamyours/webview_flutter
offline webview-flutter
Last synced: 9 months ago
JSON representation
base on webview_flutter,intercept request and load resource from local
- Host: GitHub
- URL: https://github.com/iamyours/webview_flutter
- Owner: iamyours
- License: bsd-2-clause
- Created: 2019-11-19T12:40:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-25T07:18:15.000Z (over 6 years ago)
- Last Synced: 2025-10-23T00:46:32.971Z (9 months ago)
- Topics: offline, webview-flutter
- Language: Objective-C
- Homepage: https://juejin.im/post/5dd610255188255d8c4adc29
- Size: 47.7 MB
- Stars: 10
- Watchers: 1
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# WebView for flutter
Base on [webview_flutter](https://pub.dev/packages/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
```
``` dart
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;
},
),
```