我正在为我的 webview 应用程序使用flutter_inappwebview插件。有时,由于网络问题,网页无法加载,Android 会在屏幕上抛出错误页面,提示页面未找到或超时错误。
我需要替换android返回的默认错误页面的内容。我能够使用 onLoadError 方法捕获页面未找到错误。
请指导我使用 onLoadError 方法更改默认错误页面。
WillPopScope(
onWillPop: onWillPop,
child: InAppWebView(
initialUrl: 'https://myurl.com',
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadError: (InAppWebViewController controller, String url, int i,
String s) async {
print('CUSTOM_HANDLER: $i, $s');
/** instead of printing the console message i want to render a static page or display static message **/
},
onLoadHttpError: (InAppWebViewController controller, String url,
int i, String s) async {
print('CUSTOM_HANDLER: $i, $s');
/** instead of printing the …Run Code Online (Sandbox Code Playgroud)