|
|
@@ -1,5 +1,11 @@ |
|
|
|
import 'dart:io'; |
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/launch_page/launch_page.dart'; |
|
|
|
import 'package:zhiying_comm/util/log/let_log.dart'; |
|
|
|
import 'package:zhiying_comm/util/empty_util.dart'; |
|
|
|
import 'package:url_launcher/url_launcher.dart'; |
|
|
|
import 'package:webview_flutter/webview_flutter.dart'; |
|
|
|
|
|
|
|
class BaseWebview extends StatefulWidget { |
|
|
@@ -33,7 +39,18 @@ class _BaseWebviewState extends State<BaseWebview> { |
|
|
|
onWebViewCreated: (WebViewController webViewController) { |
|
|
|
_webViewController = webViewController; |
|
|
|
}, |
|
|
|
navigationDelegate: (NavigationRequest request) { |
|
|
|
navigationDelegate: (NavigationRequest request) async{ |
|
|
|
// 解决Android的拼多多webview 转发的问题 |
|
|
|
if(Platform.isAndroid){ |
|
|
|
String url = request?.url?.toString(); |
|
|
|
if(!EmptyUtil.isEmpty(url) && !url.startsWith('https://') && !url.startsWith('http://')){ |
|
|
|
Logger.log('navigation url = $url'); |
|
|
|
// if(await canLaunch(url)){ |
|
|
|
// await launch(url); |
|
|
|
// } |
|
|
|
return NavigationDecision.prevent; |
|
|
|
} |
|
|
|
} |
|
|
|
return NavigationDecision.navigate; |
|
|
|
}, |
|
|
|
onPageStarted: (String url) { |
|
|
|