需要識別到是schema以后庞呕,使用url_launcher調(diào)起宜咒。
不多說了霞丧,看代碼(簡單寫的扔嵌,可以自己延伸)
return WebView(
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
Map<String, String> headers = Map();
headers["Referer"] = "微信支付需要的授權(quán)域名";
webViewController.loadUrl(
<服務端返回的h5支付地址>,
headers: headers);
},
navigationDelegate: (NavigationRequest request){
if (!request.url.startsWith("http")) {
launch(request.url);
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
);