web定义的两种随机一种
1.document.location = "js://webview?pushpage=https://www.jd.com";
2.window.location.href = 'js://webview?pushpage=my_order_details.html';
return WebView(
initialUrl: urlStr,
javascriptMode: JavascriptMode.unrestricted,
navigationDelegate: (navigation) {
if (navigation.url.contains('js://webview?pushpage')) {
//跳转新webView页面
print('拦截点击方法');
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
Home()),//Home:需要跳转Flutter原生的页面
);
}
return NavigationDecision.navigate;
},
);