Commit 9bd55fdef291c43e21459f1a3bd882b6ce03c814

Authored by wdn127929
1 parent f36787cc

去掉腾讯x5浏览器插件

@@ -19,8 +19,8 @@ maven{ @@ -19,8 +19,8 @@ maven{
19 } 19 }
20 20
21 21
22 - maven { url 'https://maven.aliyun.com/repository/google' }  
23 - maven { url 'https://maven.aliyun.com/repository/jcenter' } 22 + // maven { url 'https://maven.aliyun.com/repository/google' }
  23 + // maven { url 'https://maven.aliyun.com/repository/jcenter' }
24 // maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } 24 // maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
25 25
26 maven {url 'https://developer.huawei.com/repo/'} 26 maven {url 'https://developer.huawei.com/repo/'}
@@ -48,8 +48,8 @@ maven{ @@ -48,8 +48,8 @@ maven{
48 } 48 }
49 49
50 50
51 - maven { url 'https://maven.aliyun.com/repository/google' }  
52 - maven { url 'https://maven.aliyun.com/repository/jcenter' } 51 + // maven { url 'https://maven.aliyun.com/repository/google' }
  52 + // maven { url 'https://maven.aliyun.com/repository/jcenter' }
53 // maven { url 'http://maven.aliyun.com/nexus/content/groups/public' } 53 // maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
54 54
55 maven {url 'https://developer.huawei.com/repo/'} 55 maven {url 'https://developer.huawei.com/repo/'}
@@ -57,8 +57,6 @@ PODS: @@ -57,8 +57,6 @@ PODS:
57 - Flutter 57 - Flutter
58 - flutter_downloader (0.0.1): 58 - flutter_downloader (0.0.1):
59 - Flutter 59 - Flutter
60 - - flutter_filereader (0.0.1):  
61 - - Flutter  
62 - flutter_image_compress (1.0.0): 60 - flutter_image_compress (1.0.0):
63 - Flutter 61 - Flutter
64 - Mantle 62 - Mantle
@@ -160,8 +158,6 @@ PODS: @@ -160,8 +158,6 @@ PODS:
160 - video_thumbnail (0.0.1): 158 - video_thumbnail (0.0.1):
161 - Flutter 159 - Flutter
162 - libwebp 160 - libwebp
163 - - wakelock (0.0.1):  
164 - - Flutter  
165 - webview_flutter (0.0.1): 161 - webview_flutter (0.0.1):
166 - Flutter 162 - Flutter
167 - WechatOpenSDK-XCFramework (2.0.2) 163 - WechatOpenSDK-XCFramework (2.0.2)
@@ -185,7 +181,6 @@ DEPENDENCIES: @@ -185,7 +181,6 @@ DEPENDENCIES:
185 - flutter_app_update (from `.symlinks/plugins/flutter_app_update/ios`) 181 - flutter_app_update (from `.symlinks/plugins/flutter_app_update/ios`)
186 - flutter_bugly (from `.symlinks/plugins/flutter_bugly/ios`) 182 - flutter_bugly (from `.symlinks/plugins/flutter_bugly/ios`)
187 - flutter_downloader (from `.symlinks/plugins/flutter_downloader/ios`) 183 - flutter_downloader (from `.symlinks/plugins/flutter_downloader/ios`)
188 - - flutter_filereader (from `.symlinks/plugins/flutter_filereader/ios`)  
189 - flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`) 184 - flutter_image_compress (from `.symlinks/plugins/flutter_image_compress/ios`)
190 - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) 185 - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`)
191 - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) 186 - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
@@ -213,7 +208,6 @@ DEPENDENCIES: @@ -213,7 +208,6 @@ DEPENDENCIES:
213 - video_compress (from `.symlinks/plugins/video_compress/ios`) 208 - video_compress (from `.symlinks/plugins/video_compress/ios`)
214 - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`) 209 - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
215 - video_thumbnail (from `.symlinks/plugins/video_thumbnail/ios`) 210 - video_thumbnail (from `.symlinks/plugins/video_thumbnail/ios`)
216 - - wakelock (from `.symlinks/plugins/wakelock/ios`)  
217 - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) 211 - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`)
218 212
219 SPEC REPOS: 213 SPEC REPOS:
@@ -275,8 +269,6 @@ EXTERNAL SOURCES: @@ -275,8 +269,6 @@ EXTERNAL SOURCES:
275 :path: ".symlinks/plugins/flutter_bugly/ios" 269 :path: ".symlinks/plugins/flutter_bugly/ios"
276 flutter_downloader: 270 flutter_downloader:
277 :path: ".symlinks/plugins/flutter_downloader/ios" 271 :path: ".symlinks/plugins/flutter_downloader/ios"
278 - flutter_filereader:  
279 - :path: ".symlinks/plugins/flutter_filereader/ios"  
280 flutter_image_compress: 272 flutter_image_compress:
281 :path: ".symlinks/plugins/flutter_image_compress/ios" 273 :path: ".symlinks/plugins/flutter_image_compress/ios"
282 flutter_inappwebview: 274 flutter_inappwebview:
@@ -331,8 +323,6 @@ EXTERNAL SOURCES: @@ -331,8 +323,6 @@ EXTERNAL SOURCES:
331 :path: ".symlinks/plugins/video_player_avfoundation/ios" 323 :path: ".symlinks/plugins/video_player_avfoundation/ios"
332 video_thumbnail: 324 video_thumbnail:
333 :path: ".symlinks/plugins/video_thumbnail/ios" 325 :path: ".symlinks/plugins/video_thumbnail/ios"
334 - wakelock:  
335 - :path: ".symlinks/plugins/wakelock/ios"  
336 webview_flutter: 326 webview_flutter:
337 :path: ".symlinks/plugins/webview_flutter/ios" 327 :path: ".symlinks/plugins/webview_flutter/ios"
338 328
@@ -361,9 +351,8 @@ SPEC CHECKSUMS: @@ -361,9 +351,8 @@ SPEC CHECKSUMS:
361 flutter_app_update: 65f61da626cb111d1b24674abc4b01728d7723bc 351 flutter_app_update: 65f61da626cb111d1b24674abc4b01728d7723bc
362 flutter_bugly: c9800f4d5bc5bdc27ffdde3417a26ba44266e0c3 352 flutter_bugly: c9800f4d5bc5bdc27ffdde3417a26ba44266e0c3
363 flutter_downloader: b7301ae057deadd4b1650dc7c05375f10ff12c39 353 flutter_downloader: b7301ae057deadd4b1650dc7c05375f10ff12c39
364 - flutter_filereader: 0caefb23b8c96deca7c3679d3e61bfd8111a7d11  
365 flutter_image_compress: 5a5e9aee05b6553048b8df1c3bc456d0afaac433 354 flutter_image_compress: 5a5e9aee05b6553048b8df1c3bc456d0afaac433
366 - flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721 355 + flutter_inappwebview: 3d32228f1304635e7c028b0d4252937730bbc6cf
367 flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 356 flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
368 flutter_native_image: 9c0b7451838484458e5b0fae007b86a4c2d4bdfe 357 flutter_native_image: 9c0b7451838484458e5b0fae007b86a4c2d4bdfe
369 flutter_sms: 91ce41530f55c85d6524d82307a5d555844c086a 358 flutter_sms: 91ce41530f55c85d6524d82307a5d555844c086a
@@ -401,7 +390,6 @@ SPEC CHECKSUMS: @@ -401,7 +390,6 @@ SPEC CHECKSUMS:
401 video_compress: fce97e4fb1dfd88175aa07d2ffc8a2f297f87fbe 390 video_compress: fce97e4fb1dfd88175aa07d2ffc8a2f297f87fbe
402 video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff 391 video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff
403 video_thumbnail: c4e2a3c539e247d4de13cd545344fd2d26ffafd1 392 video_thumbnail: c4e2a3c539e247d4de13cd545344fd2d26ffafd1
404 - wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f  
405 webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b 393 webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b
406 WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69 394 WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69
407 395
@@ -347,7 +347,6 @@ @@ -347,7 +347,6 @@
347 "${BUILT_PRODUCTS_DIR}/flutter_app_badger/flutter_app_badger.framework", 347 "${BUILT_PRODUCTS_DIR}/flutter_app_badger/flutter_app_badger.framework",
348 "${BUILT_PRODUCTS_DIR}/flutter_app_update/flutter_app_update.framework", 348 "${BUILT_PRODUCTS_DIR}/flutter_app_update/flutter_app_update.framework",
349 "${BUILT_PRODUCTS_DIR}/flutter_downloader/flutter_downloader.framework", 349 "${BUILT_PRODUCTS_DIR}/flutter_downloader/flutter_downloader.framework",
350 - "${BUILT_PRODUCTS_DIR}/flutter_filereader/flutter_filereader.framework",  
351 "${BUILT_PRODUCTS_DIR}/flutter_image_compress/flutter_image_compress.framework", 350 "${BUILT_PRODUCTS_DIR}/flutter_image_compress/flutter_image_compress.framework",
352 "${BUILT_PRODUCTS_DIR}/flutter_inappwebview/flutter_inappwebview.framework", 351 "${BUILT_PRODUCTS_DIR}/flutter_inappwebview/flutter_inappwebview.framework",
353 "${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework", 352 "${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework",
@@ -372,7 +371,6 @@ @@ -372,7 +371,6 @@
372 "${BUILT_PRODUCTS_DIR}/video_compress/video_compress.framework", 371 "${BUILT_PRODUCTS_DIR}/video_compress/video_compress.framework",
373 "${BUILT_PRODUCTS_DIR}/video_player_avfoundation/video_player_avfoundation.framework", 372 "${BUILT_PRODUCTS_DIR}/video_player_avfoundation/video_player_avfoundation.framework",
374 "${BUILT_PRODUCTS_DIR}/video_thumbnail/video_thumbnail.framework", 373 "${BUILT_PRODUCTS_DIR}/video_thumbnail/video_thumbnail.framework",
375 - "${BUILT_PRODUCTS_DIR}/wakelock/wakelock.framework",  
376 "${BUILT_PRODUCTS_DIR}/webview_flutter/webview_flutter.framework", 374 "${BUILT_PRODUCTS_DIR}/webview_flutter/webview_flutter.framework",
377 ); 375 );
378 name = "[CP] Embed Pods Frameworks"; 376 name = "[CP] Embed Pods Frameworks";
@@ -397,7 +395,6 @@ @@ -397,7 +395,6 @@
397 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_app_badger.framework", 395 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_app_badger.framework",
398 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_app_update.framework", 396 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_app_update.framework",
399 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_downloader.framework", 397 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_downloader.framework",
400 - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_filereader.framework",  
401 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_image_compress.framework", 398 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_image_compress.framework",
402 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview.framework", 399 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview.framework",
403 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework", 400 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework",
@@ -422,7 +419,6 @@ @@ -422,7 +419,6 @@
422 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_compress.framework", 419 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_compress.framework",
423 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player_avfoundation.framework", 420 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_player_avfoundation.framework",
424 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_thumbnail.framework", 421 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/video_thumbnail.framework",
425 - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/wakelock.framework",  
426 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/webview_flutter.framework", 422 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/webview_flutter.framework",
427 ); 423 );
428 runOnlyForDeploymentPostprocessing = 0; 424 runOnlyForDeploymentPostprocessing = 0;
@@ -560,7 +556,10 @@ @@ -560,7 +556,10 @@
560 ); 556 );
561 INFOPLIST_FILE = Runner/Info.plist; 557 INFOPLIST_FILE = Runner/Info.plist;
562 IPHONEOS_DEPLOYMENT_TARGET = 12.0; 558 IPHONEOS_DEPLOYMENT_TARGET = 12.0;
563 - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 559 + LD_RUNPATH_SEARCH_PATHS = (
  560 + "$(inherited)",
  561 + "@executable_path/Frameworks",
  562 + );
564 LIBRARY_SEARCH_PATHS = ( 563 LIBRARY_SEARCH_PATHS = (
565 "$(inherited)", 564 "$(inherited)",
566 "$(PROJECT_DIR)/Flutter", 565 "$(PROJECT_DIR)/Flutter",
@@ -708,7 +707,10 @@ @@ -708,7 +707,10 @@
708 ); 707 );
709 INFOPLIST_FILE = Runner/Info.plist; 708 INFOPLIST_FILE = Runner/Info.plist;
710 IPHONEOS_DEPLOYMENT_TARGET = 12.0; 709 IPHONEOS_DEPLOYMENT_TARGET = 12.0;
711 - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 710 + LD_RUNPATH_SEARCH_PATHS = (
  711 + "$(inherited)",
  712 + "@executable_path/Frameworks",
  713 + );
712 LIBRARY_SEARCH_PATHS = ( 714 LIBRARY_SEARCH_PATHS = (
713 "$(inherited)", 715 "$(inherited)",
714 "$(PROJECT_DIR)/Flutter", 716 "$(PROJECT_DIR)/Flutter",
@@ -744,7 +746,10 @@ @@ -744,7 +746,10 @@
744 ); 746 );
745 INFOPLIST_FILE = Runner/Info.plist; 747 INFOPLIST_FILE = Runner/Info.plist;
746 IPHONEOS_DEPLOYMENT_TARGET = 12.0; 748 IPHONEOS_DEPLOYMENT_TARGET = 12.0;
747 - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 749 + LD_RUNPATH_SEARCH_PATHS = (
  750 + "$(inherited)",
  751 + "@executable_path/Frameworks",
  752 + );
748 LIBRARY_SEARCH_PATHS = ( 753 LIBRARY_SEARCH_PATHS = (
749 "$(inherited)", 754 "$(inherited)",
750 "$(PROJECT_DIR)/Flutter", 755 "$(PROJECT_DIR)/Flutter",
@@ -59,6 +59,8 @@ @@ -59,6 +59,8 @@
59 <dict> 59 <dict>
60 <key>NSAllowsArbitraryLoads</key> 60 <key>NSAllowsArbitraryLoads</key>
61 <true/> 61 <true/>
  62 + <key>NSAllowsArbitraryLoadsInWebContent</key>
  63 + <true/>
62 </dict> 64 </dict>
63 <key>NSAppleMusicUsageDescription</key> 65 <key>NSAppleMusicUsageDescription</key>
64 <string>需要您的同意,APP才能访问媒体资料库</string> 66 <string>需要您的同意,APP才能访问媒体资料库</string>
@@ -3,7 +3,7 @@ import 'dart:async'; @@ -3,7 +3,7 @@ import 'dart:async';
3 import 'package:device_info/device_info.dart'; 3 import 'package:device_info/device_info.dart';
4 import 'package:dio/dio.dart'; 4 import 'package:dio/dio.dart';
5 import 'package:flutter/material.dart'; 5 import 'package:flutter/material.dart';
6 -// import 'package:flutter_inappwebview/flutter_inappwebview.dart'; 6 +import 'package:flutter_inappwebview/flutter_inappwebview.dart';
7 import 'package:one_key/net/dio_util.dart'; 7 import 'package:one_key/net/dio_util.dart';
8 import 'package:one_key/res/colors.dart'; 8 import 'package:one_key/res/colors.dart';
9 import 'package:one_key/utils/event_bus.dart'; 9 import 'package:one_key/utils/event_bus.dart';
@@ -26,16 +26,9 @@ import 'package:webview_flutter/webview_flutter.dart'; @@ -26,16 +26,9 @@ import 'package:webview_flutter/webview_flutter.dart';
26 // import 'package:flutter_inappwebview/flutter_inappwebview.dart'; 26 // import 'package:flutter_inappwebview/flutter_inappwebview.dart';
27 import 'package:url_launcher/url_launcher.dart'; 27 import 'package:url_launcher/url_launcher.dart';
28 import 'dart:collection'; 28 import 'dart:collection';
29 -  
30 -// Import for Android features.  
31 -import 'package:webview_flutter_android/webview_flutter_android.dart';  
32 -// Import for iOS features.  
33 -import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart';  
34 // import 'package:open_file/open_file.dart'; 29 // import 'package:open_file/open_file.dart';
35 // import 'package:flutter_downloader/flutter_downloader.dart'; 30 // import 'package:flutter_downloader/flutter_downloader.dart';
36 31
37 -  
38 -  
39 class WebPage extends StatefulWidget { 32 class WebPage extends StatefulWidget {
40 final String title; 33 final String title;
41 final String url; 34 final String url;
@@ -48,34 +41,42 @@ class WebPage extends StatefulWidget { @@ -48,34 +41,42 @@ class WebPage extends StatefulWidget {
48 } 41 }
49 42
50 class _WebPageState extends State<WebPage> { 43 class _WebPageState extends State<WebPage> {
51 - WebViewController controller; 44 + final GlobalKey webViewKey = GlobalKey();
  45 +
  46 + InAppWebViewController webViewController;
  47 + InAppWebViewGroupOptions options = InAppWebViewGroupOptions(
  48 + crossPlatform: InAppWebViewOptions(
  49 + useShouldOverrideUrlLoading: true,
  50 + useOnDownloadStart: true,
  51 + mediaPlaybackRequiresUserGesture: false,
  52 + ),
  53 + android: AndroidInAppWebViewOptions(
  54 + useHybridComposition: true,
  55 + ),
  56 + ios: IOSInAppWebViewOptions(
  57 + allowsInlineMediaPlayback: true,
  58 + ));
  59 +
  60 + PullToRefreshController pullToRefreshController;
  61 + ContextMenu contextMenu;
  62 + String url = "";
  63 + double progress = 0;
  64 + final urlController = TextEditingController();
  65 + // Future<void> openFile(filePath) async {
  66 + // final _result = await OpenFile.open(filePath);
  67 + // print(_result.message);
  68 +
  69 + // // setState(() {
  70 + // // _openResult = "type=${_result.type} message=${_result.message}";
  71 + // // });
  72 + // }
52 73
53 @override 74 @override
54 void initState() { 75 void initState() {
55 super.initState(); 76 super.initState();
56 77
57 - // #docregion webview_controller  
58 - controller = WebViewController()  
59 - ..setJavaScriptMode(JavaScriptMode.unrestricted)  
60 - ..setBackgroundColor(const Color(0x00000000))  
61 - ..setNavigationDelegate(  
62 - NavigationDelegate(  
63 - onProgress: (int progress) {  
64 - // Update loading bar.  
65 - },  
66 - onPageStarted: (String url) {},  
67 - onPageFinished: (String url) {},  
68 - onWebResourceError: (WebResourceError error) {},  
69 - onNavigationRequest: (NavigationRequest request) {  
70 - if (request.url.startsWith('https://www.youtube.com/')) {  
71 - return NavigationDecision.prevent;  
72 - }  
73 - return NavigationDecision.navigate;  
74 - },  
75 - ),  
76 - )  
77 - ..loadRequest(Uri.parse('http://colorcun.com/privacy2.html'));  
78 - // #enddocregion webview_controller 78 + // Enable hybrid composition.
  79 + _init();
79 } 80 }
80 81
81 @override 82 @override
@@ -87,18 +88,269 @@ class _WebPageState extends State<WebPage> { @@ -87,18 +88,269 @@ class _WebPageState extends State<WebPage> {
87 super.dispose(); 88 super.dispose();
88 } 89 }
89 90
  91 + Future<bool> _checkPermission() async {
  92 + DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
  93 + AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
  94 + if (Platform.isAndroid && androidInfo.version.sdkInt <= 28) {
  95 + final status = await Permission.storage.status;
  96 + if (status != PermissionStatus.granted) {
  97 + final result = await Permission.storage.request();
  98 + if (result == PermissionStatus.granted) {
  99 + return true;
  100 + }
  101 + } else {
  102 + return true;
  103 + }
  104 + } else {
  105 + return true;
  106 + }
  107 + return false;
  108 + }
  109 +
  110 + Future<bool> checkPermissionStorage() async {
  111 + var status = await Permission.storage.status;
  112 + if (!status.isGranted) {
  113 + status = await Permission.storage.request();
  114 + if (status.isGranted) {
  115 + return true;
  116 + }
  117 + } else {
  118 + return true;
  119 + }
  120 + return false;
  121 + }
  122 +
  123 + _init() async {
  124 + // WidgetsFlutterBinding.ensureInitialized();
  125 + // await FlutterDownloader.initialize(debug: true);
  126 + if (Platform.isAndroid) {
  127 + await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true);
  128 +
  129 + var swAvailable = await AndroidWebViewFeature.isFeatureSupported(
  130 + AndroidWebViewFeature.SERVICE_WORKER_BASIC_USAGE);
  131 + var swInterceptAvailable = await AndroidWebViewFeature.isFeatureSupported(
  132 + AndroidWebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
  133 +
  134 + if (swAvailable && swInterceptAvailable) {
  135 + AndroidServiceWorkerController serviceWorkerController =
  136 + AndroidServiceWorkerController.instance();
  137 +
  138 + serviceWorkerController.serviceWorkerClient =
  139 + AndroidServiceWorkerClient(
  140 + shouldInterceptRequest: (request) async {
  141 + print(request);
  142 + return null;
  143 + },
  144 + );
  145 + }
  146 + }
  147 + // await FlutterDownloader.initialize(
  148 + // debug: true // optional: set false to disable printing logs to console
  149 + // );
  150 + // await Permission.storage.request();
  151 + }
  152 +
90 @override 153 @override
91 Widget build(BuildContext context) { 154 Widget build(BuildContext context) {
92 return Scaffold( 155 return Scaffold(
93 - appBar: SystemAppBar(widget.title, onTap: () {  
94 - if (widget.need) {  
95 - Utils.changeStatusColor(color: MyColours.color_199095);  
96 - }  
97 - Navigator.of(context).pop();  
98 - }),  
99 - body: WebViewWidget(controller: controller),  
100 - ); 156 + // We're using a Builder here so we have a context that is below the Scaffold
  157 + // to allow calling Scaffold.of(context) so we can show a snackbar.
  158 + appBar: SystemAppBar(
  159 + widget.title,
  160 + ),
  161 + body: Column(
  162 + children: [
  163 + Expanded(
  164 + child: InAppWebView(
  165 + key: webViewKey,
  166 + // contextMenu: contextMenu,
  167 + initialUrlRequest: URLRequest(
  168 + // url: Uri.parse("http://colorcun.com/privacy1.html")),
  169 + url: Uri.parse("http://colorcun.com/privacy2.html")),
  170 + //华为下载功能闪退,去掉下载功能*********http://colorcun.com/privacy2.html
  171 + // initialFile: "assets/index.html",
  172 + initialUserScripts: UnmodifiableListView<UserScript>([]),
  173 + initialOptions: options,
  174 + pullToRefreshController: pullToRefreshController,
  175 + onWebViewCreated: (controller) {
  176 + webViewController = controller;
  177 + },
  178 + onLoadStart: (controller, url) {
  179 + setState(() {
  180 + this.url = url.toString();
  181 + urlController.text = this.url;
  182 + });
  183 + },
  184 + androidOnPermissionRequest:
  185 + (controller, origin, resources) async {
  186 + return PermissionRequestResponse(
  187 + resources: resources,
  188 + action: PermissionRequestResponseAction.GRANT);
  189 + },
  190 + shouldOverrideUrlLoading: (controller, navigationAction) async {
  191 + var uri = navigationAction.request.url;
  192 +
  193 + if (![
  194 + "http",
  195 + "https",
  196 + "file",
  197 + "chrome",
  198 + "data",
  199 + "javascript",
  200 + "about"
  201 + ].contains(uri.scheme)) {
  202 + if (await canLaunch(url)) {
  203 + // Launch the App
  204 + await launch(
  205 + url,
  206 + );
  207 + // and cancel the request
  208 + return NavigationActionPolicy.CANCEL;
  209 + }
  210 + }
  211 +
  212 + return NavigationActionPolicy.ALLOW;
  213 + },
  214 + onLoadStop: (controller, url) async {
  215 + pullToRefreshController.endRefreshing();
  216 + setState(() {
  217 + this.url = url.toString();
  218 + urlController.text = this.url;
  219 + });
  220 + },
  221 + onLoadError: (controller, url, code, message) {
  222 + pullToRefreshController.endRefreshing();
  223 + },
  224 + onProgressChanged: (controller, progress) {
  225 + if (progress == 100) {
  226 + pullToRefreshController.endRefreshing();
  227 + }
  228 + setState(() {
  229 + this.progress = progress / 100;
  230 + urlController.text = this.url;
  231 + });
  232 + },
  233 + onUpdateVisitedHistory: (controller, url, androidIsReload) {
  234 + setState(() {
  235 + this.url = url.toString();
  236 + urlController.text = this.url;
  237 + });
  238 + },
  239 + onConsoleMessage: (controller, consoleMessage) {
  240 + print(consoleMessage);
  241 + },
  242 + onDownloadStart: (controller, url) async {
  243 + print("onDownloadStart $url");
  244 + Utils.showToast('开始下载...');
  245 + // final taskId = await FlutterDownloader.enqueue(
  246 + // url: url.toString(),
  247 + // savedDir: (await getExternalStorageDirectory()).path,
  248 + // showNotification:
  249 + // true, // show download progress in status bar (for Android)
  250 + // openFileFromNotification:
  251 + // true, // click on notification to open downloaded file (for Android)
  252 + // );
  253 + final dir = await getExternalStorageDirectory();
  254 + String savePath = dir.path + "/one_key";
  255 +
  256 + Directory directory = new Directory(savePath);
  257 + if (directory.existsSync()) {
  258 + //删除历史apk
  259 + final List<FileSystemEntity> files = directory.listSync();
  260 + for (FileSystemEntity file in files) {
  261 + file.deleteSync();
  262 + }
  263 + }
  264 + DioUtil().download(url.toString(), savePath,
  265 + onProgress: (received, total) {
  266 + // if (_progress != 100) {
  267 + // int progress = ((received / total) * 100).round();
  268 + // _progress = progress;
  269 + // _setState(() {});
  270 + // }
  271 + if (received == total) {
  272 + print('object');
  273 + Utils.showToast('文件已保存在${savePath}');
  274 + // openFile(savePath);
  275 + //下载完成
  276 + // InstallPlugin.installApk(savePath, "com.naji.one_key");
  277 + }
  278 + });
  279 + // },
  280 + // DioUtil().download(url.toString(),
  281 + // (await getExternalStorageDirectory()).path,
  282 + // onProgress: (received, total) {
  283 + // // if (_progress != 100) {
  284 + // // int progress = ((received / total) * 100).round();
  285 + // // _progress = progress;
  286 + // // _setState(() {});
  287 + // // }
  288 + // if (received == total) {
  289 + // //下载完成
  290 + // // InstallPlugin.installApk(savePath, "com.naji.one_key");
  291 + // }
  292 + // });
  293 + },
  294 + ))
  295 + ],
  296 + )
  297 + // Builder(builder: (BuildContext context) {
  298 + // return WebView(
  299 + // initialUrl: "http://colorcun.com/privacy1.html",
  300 + // javascriptMode: JavascriptMode.unrestricted,
  301 + // onWebViewCreated: (WebViewController webViewController) {
  302 + // _controller.complete(webViewController);
  303 + // },
  304 + // // TODO(iskakaushik): Remove this when collection literals makes it to stable.
  305 + // // ignore: prefer_collection_literals
  306 + // javascriptChannels: <JavascriptChannel>[
  307 + // _toasterJavascriptChannel(context),
  308 + // ].toSet(),
  309 + // navigationDelegate: (NavigationRequest request) {
  310 + // if (request.url.startsWith('https://www.youtube.com/')) {
  311 + // print('blocking navigation to $request}');
  312 + // return NavigationDecision.prevent;
  313 + // }
  314 + // print('allowing navigation to $request');
  315 + // return NavigationDecision.navigate;
  316 + // },
  317 + // onPageStarted: (String url) {
  318 + // print('Page started loading: $url');
  319 + // },
  320 + // onPageFinished: (String url) async {
  321 + // print('Page finished loading: $url');
  322 + // // showDownloadProgress(context);
  323 + // final dir = await getExternalStorageDirectory();
  324 + // String savePath = dir.path + "/one_key";
  325 + // DioUtil().download(url, savePath,
  326 + // onProgress: (received, total) {
  327 + // // if (_progress != 100) {
  328 + // // int progress = ((received / total) * 100).round();
  329 + // // _progress = progress;
  330 + // // _setState(() {});
  331 + // // }
  332 + // if (received == total) {
  333 + // print('object');
  334 + // //下载完成
  335 + // // InstallPlugin.installApk(savePath, "com.naji.one_key");
  336 + // }
  337 + // });
  338 + // },
  339 + // gestureNavigationEnabled: true,
  340 + // );
  341 + // }),
  342 + );
101 } 343 }
  344 +
  345 + // JavascriptChannel _toasterJavascriptChannel(BuildContext context) {
  346 + // return JavascriptChannel(
  347 + // name: 'Toaster',
  348 + // onMessageReceived: (JavascriptMessage message) {
  349 + // Scaffold.of(context).showSnackBar(
  350 + // SnackBar(content: Text(message.message)),
  351 + // );
  352 + // });
  353 + // }
102 } 354 }
103 355
104 // class WebPage extends StatelessWidget { 356 // class WebPage extends StatelessWidget {
1 -// import 'dart:async';  
2 -  
3 -// import 'package:device_info/device_info.dart';  
4 -// import 'package:dio/dio.dart';  
5 -// import 'package:flutter/material.dart';  
6 -// import 'package:flutter_inappwebview/flutter_inappwebview.dart';  
7 -// import 'package:one_key/net/dio_util.dart';  
8 -// import 'package:one_key/res/colors.dart';  
9 -// import 'package:one_key/utils/event_bus.dart';  
10 -// import 'package:one_key/utils/utils.dart';  
11 -// import 'package:one_key/widgets/system_app_bar.dart';  
12 -// import 'package:path_provider/path_provider.dart';  
13 -// import 'package:permission_handler/permission_handler.dart';  
14 -// import 'package:webview_flutter/webview_flutter.dart';  
15 -  
16 -// import 'dart:async';  
17 -// import 'dart:convert';  
18 -// import 'dart:io';  
19 -  
20 -// import 'package:flutter/material.dart';  
21 -// import 'package:one_key/utils/event_bus.dart';  
22 -// import 'package:one_key/widgets/app_bar.dart';  
23 -// import 'package:one_key/widgets/system_app_bar.dart';  
24 -// import 'package:webview_flutter/webview_flutter.dart';  
25 -  
26 -// // import 'package:flutter_inappwebview/flutter_inappwebview.dart';  
27 -// import 'package:url_launcher/url_launcher.dart';  
28 -// import 'dart:collection';  
29 -// // import 'package:open_file/open_file.dart';  
30 -// // import 'package:flutter_downloader/flutter_downloader.dart';  
31 -  
32 -// class WebPage extends StatefulWidget {  
33 -// final String title;  
34 -// final String url;  
35 -// final bool need;  
36 -  
37 -// const WebPage({Key key, this.title, this.url, this.need = false})  
38 -// : super(key: key);  
39 -// @override  
40 -// _WebPageState createState() => _WebPageState();  
41 -// }  
42 -  
43 -// class _WebPageState extends State<WebPage> {  
44 -// final GlobalKey webViewKey = GlobalKey();  
45 -  
46 -// InAppWebViewController webViewController;  
47 -// InAppWebViewGroupOptions options = InAppWebViewGroupOptions(  
48 -// crossPlatform: InAppWebViewOptions(  
49 -// useShouldOverrideUrlLoading: true,  
50 -// useOnDownloadStart: true,  
51 -// mediaPlaybackRequiresUserGesture: false,  
52 -// ),  
53 -// android: AndroidInAppWebViewOptions(  
54 -// useHybridComposition: true,  
55 -// ),  
56 -// ios: IOSInAppWebViewOptions(  
57 -// allowsInlineMediaPlayback: true,  
58 -// ));  
59 -  
60 -// PullToRefreshController pullToRefreshController;  
61 -// ContextMenu contextMenu;  
62 -// String url = "";  
63 -// double progress = 0;  
64 -// final urlController = TextEditingController();  
65 -// // Future<void> openFile(filePath) async {  
66 -// // final _result = await OpenFile.open(filePath);  
67 -// // print(_result.message);  
68 -  
69 -// // // setState(() {  
70 -// // // _openResult = "type=${_result.type} message=${_result.message}";  
71 -// // // });  
72 -// // }  
73 -  
74 -// @override  
75 -// void initState() {  
76 -// super.initState();  
77 -  
78 -// // Enable hybrid composition.  
79 -// _init();  
80 -// }  
81 -  
82 -// @override  
83 -// void dispose() {  
84 -// if (widget.need) {  
85 -// Utils.changeStatusColor(color: MyColours.color_199095);  
86 -// }  
87 -  
88 -// super.dispose();  
89 -// }  
90 -  
91 -// Future<bool> _checkPermission() async {  
92 -// DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();  
93 -// AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;  
94 -// if (Platform.isAndroid && androidInfo.version.sdkInt <= 28) {  
95 -// final status = await Permission.storage.status;  
96 -// if (status != PermissionStatus.granted) {  
97 -// final result = await Permission.storage.request();  
98 -// if (result == PermissionStatus.granted) {  
99 -// return true;  
100 -// }  
101 -// } else {  
102 -// return true;  
103 -// }  
104 -// } else {  
105 -// return true;  
106 -// }  
107 -// return false;  
108 -// }  
109 -  
110 -// Future<bool> checkPermissionStorage() async {  
111 -// var status = await Permission.storage.status;  
112 -// if (!status.isGranted) {  
113 -// status = await Permission.storage.request();  
114 -// if (status.isGranted) {  
115 -// return true;  
116 -// }  
117 -// } else {  
118 -// return true;  
119 -// }  
120 -// return false;  
121 -// }  
122 -  
123 -// _init() async {  
124 -// // WidgetsFlutterBinding.ensureInitialized();  
125 -// // await FlutterDownloader.initialize(debug: true);  
126 -// if (Platform.isAndroid) {  
127 -// await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true);  
128 -  
129 -// var swAvailable = await AndroidWebViewFeature.isFeatureSupported(  
130 -// AndroidWebViewFeature.SERVICE_WORKER_BASIC_USAGE);  
131 -// var swInterceptAvailable = await AndroidWebViewFeature.isFeatureSupported(  
132 -// AndroidWebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);  
133 -  
134 -// if (swAvailable && swInterceptAvailable) {  
135 -// AndroidServiceWorkerController serviceWorkerController =  
136 -// AndroidServiceWorkerController.instance();  
137 -  
138 -// serviceWorkerController.serviceWorkerClient =  
139 -// AndroidServiceWorkerClient(  
140 -// shouldInterceptRequest: (request) async {  
141 -// print(request);  
142 -// return null;  
143 -// },  
144 -// );  
145 -// }  
146 -// }  
147 -// // await FlutterDownloader.initialize(  
148 -// // debug: true // optional: set false to disable printing logs to console  
149 -// // );  
150 -// // await Permission.storage.request();  
151 -// }  
152 -  
153 -// @override  
154 -// Widget build(BuildContext context) {  
155 -// return Scaffold(  
156 -// // We're using a Builder here so we have a context that is below the Scaffold  
157 -// // to allow calling Scaffold.of(context) so we can show a snackbar.  
158 -// appBar: SystemAppBar(  
159 -// widget.title,  
160 -// ),  
161 -// body: Column(  
162 -// children: [  
163 -// Expanded(  
164 -// child: InAppWebView(  
165 -// key: webViewKey,  
166 -// // contextMenu: contextMenu,  
167 -// initialUrlRequest: URLRequest(  
168 -// // url: Uri.parse("http://colorcun.com/privacy1.html")),  
169 -// url: Uri.parse("http://colorcun.com/privacy2.html")),  
170 -// //华为下载功能闪退,去掉下载功能*********http://colorcun.com/privacy2.html  
171 -// // initialFile: "assets/index.html",  
172 -// initialUserScripts: UnmodifiableListView<UserScript>([]),  
173 -// initialOptions: options,  
174 -// pullToRefreshController: pullToRefreshController,  
175 -// onWebViewCreated: (controller) {  
176 -// webViewController = controller;  
177 -// },  
178 -// onLoadStart: (controller, url) {  
179 -// setState(() {  
180 -// this.url = url.toString();  
181 -// urlController.text = this.url;  
182 -// });  
183 -// },  
184 -// androidOnPermissionRequest:  
185 -// (controller, origin, resources) async {  
186 -// return PermissionRequestResponse(  
187 -// resources: resources,  
188 -// action: PermissionRequestResponseAction.GRANT);  
189 -// },  
190 -// shouldOverrideUrlLoading: (controller, navigationAction) async {  
191 -// var uri = navigationAction.request.url;  
192 -  
193 -// if (![  
194 -// "http",  
195 -// "https",  
196 -// "file",  
197 -// "chrome",  
198 -// "data",  
199 -// "javascript",  
200 -// "about"  
201 -// ].contains(uri.scheme)) {  
202 -// if (await canLaunch(url)) {  
203 -// // Launch the App  
204 -// await launch(  
205 -// url,  
206 -// );  
207 -// // and cancel the request  
208 -// return NavigationActionPolicy.CANCEL;  
209 -// }  
210 -// }  
211 -  
212 -// return NavigationActionPolicy.ALLOW;  
213 -// },  
214 -// onLoadStop: (controller, url) async {  
215 -// pullToRefreshController.endRefreshing();  
216 -// setState(() {  
217 -// this.url = url.toString();  
218 -// urlController.text = this.url;  
219 -// });  
220 -// },  
221 -// onLoadError: (controller, url, code, message) {  
222 -// pullToRefreshController.endRefreshing();  
223 -// },  
224 -// onProgressChanged: (controller, progress) {  
225 -// if (progress == 100) {  
226 -// pullToRefreshController.endRefreshing();  
227 -// }  
228 -// setState(() {  
229 -// this.progress = progress / 100;  
230 -// urlController.text = this.url;  
231 -// });  
232 -// },  
233 -// onUpdateVisitedHistory: (controller, url, androidIsReload) {  
234 -// setState(() {  
235 -// this.url = url.toString();  
236 -// urlController.text = this.url;  
237 -// });  
238 -// },  
239 -// onConsoleMessage: (controller, consoleMessage) {  
240 -// print(consoleMessage);  
241 -// },  
242 -// onDownloadStart: (controller, url) async {  
243 -// print("onDownloadStart $url");  
244 -// Utils.showToast('开始下载...');  
245 -// // final taskId = await FlutterDownloader.enqueue(  
246 -// // url: url.toString(),  
247 -// // savedDir: (await getExternalStorageDirectory()).path,  
248 -// // showNotification:  
249 -// // true, // show download progress in status bar (for Android)  
250 -// // openFileFromNotification:  
251 -// // true, // click on notification to open downloaded file (for Android)  
252 -// // );  
253 -// final dir = await getExternalStorageDirectory();  
254 -// String savePath = dir.path + "/one_key";  
255 -  
256 -// Directory directory = new Directory(savePath);  
257 -// if (directory.existsSync()) {  
258 -// //删除历史apk  
259 -// final List<FileSystemEntity> files = directory.listSync();  
260 -// for (FileSystemEntity file in files) {  
261 -// file.deleteSync();  
262 -// }  
263 -// }  
264 -// DioUtil().download(url.toString(), savePath,  
265 -// onProgress: (received, total) {  
266 -// // if (_progress != 100) {  
267 -// // int progress = ((received / total) * 100).round();  
268 -// // _progress = progress;  
269 -// // _setState(() {});  
270 -// // }  
271 -// if (received == total) {  
272 -// print('object');  
273 -// Utils.showToast('文件已保存在${savePath}');  
274 -// // openFile(savePath);  
275 -// //下载完成  
276 -// // InstallPlugin.installApk(savePath, "com.naji.one_key");  
277 -// }  
278 -// });  
279 -// // },  
280 -// // DioUtil().download(url.toString(),  
281 -// // (await getExternalStorageDirectory()).path,  
282 -// // onProgress: (received, total) {  
283 -// // // if (_progress != 100) {  
284 -// // // int progress = ((received / total) * 100).round();  
285 -// // // _progress = progress;  
286 -// // // _setState(() {});  
287 -// // // }  
288 -// // if (received == total) {  
289 -// // //下载完成  
290 -// // // InstallPlugin.installApk(savePath, "com.naji.one_key");  
291 -// // }  
292 -// // });  
293 -// },  
294 -// ))  
295 -// ],  
296 -// )  
297 -// // Builder(builder: (BuildContext context) {  
298 -// // return WebView(  
299 -// // initialUrl: "http://colorcun.com/privacy1.html",  
300 -// // javascriptMode: JavascriptMode.unrestricted,  
301 -// // onWebViewCreated: (WebViewController webViewController) {  
302 -// // _controller.complete(webViewController);  
303 -// // },  
304 -// // // TODO(iskakaushik): Remove this when collection literals makes it to stable.  
305 -// // // ignore: prefer_collection_literals  
306 -// // javascriptChannels: <JavascriptChannel>[  
307 -// // _toasterJavascriptChannel(context),  
308 -// // ].toSet(),  
309 -// // navigationDelegate: (NavigationRequest request) {  
310 -// // if (request.url.startsWith('https://www.youtube.com/')) {  
311 -// // print('blocking navigation to $request}');  
312 -// // return NavigationDecision.prevent;  
313 -// // }  
314 -// // print('allowing navigation to $request');  
315 -// // return NavigationDecision.navigate;  
316 -// // },  
317 -// // onPageStarted: (String url) {  
318 -// // print('Page started loading: $url');  
319 -// // },  
320 -// // onPageFinished: (String url) async {  
321 -// // print('Page finished loading: $url');  
322 -// // // showDownloadProgress(context);  
323 -// // final dir = await getExternalStorageDirectory();  
324 -// // String savePath = dir.path + "/one_key";  
325 -// // DioUtil().download(url, savePath,  
326 -// // onProgress: (received, total) {  
327 -// // // if (_progress != 100) {  
328 -// // // int progress = ((received / total) * 100).round();  
329 -// // // _progress = progress;  
330 -// // // _setState(() {});  
331 -// // // }  
332 -// // if (received == total) {  
333 -// // print('object');  
334 -// // //下载完成  
335 -// // // InstallPlugin.installApk(savePath, "com.naji.one_key");  
336 -// // }  
337 -// // });  
338 -// // },  
339 -// // gestureNavigationEnabled: true,  
340 -// // );  
341 -// // }),  
342 -// );  
343 -// }  
344 -  
345 -// // JavascriptChannel _toasterJavascriptChannel(BuildContext context) {  
346 -// // return JavascriptChannel(  
347 -// // name: 'Toaster',  
348 -// // onMessageReceived: (JavascriptMessage message) {  
349 -// // Scaffold.of(context).showSnackBar(  
350 -// // SnackBar(content: Text(message.message)),  
351 -// // );  
352 -// // });  
353 -// // }  
354 -// }  
355 -  
356 -// // class WebPage extends StatelessWidget {  
357 -// // final String title;  
358 -// // final String url;  
359 -// // final bool need;  
360 -  
361 -// // const WebPage({Key key, this.title, this.url, this.need = false})  
362 -// // : super(key: key);  
363 -// // @override  
364 -// // Widget build(BuildContext context) {  
365 -// // final Completer<WebViewController> _controller =  
366 -// // Completer<WebViewController>();  
367 -// // return Scaffold(  
368 -// // appBar: SystemAppBar(title, onTap: () {  
369 -// // if (need) {  
370 -// // Utils.changeStatusColor(color: MyColours.color_199095);  
371 -// // }  
372 -// // Navigator.of(context).pop();  
373 -// // }),  
374 -// // body: WillPopScope(  
375 -// // onWillPop: () async {  
376 -// // if (need) {  
377 -// // Utils.changeStatusColor(color: MyColours.color_199095);  
378 -// // }  
379 -// // return true;  
380 -// // },  
381 -// // child: WebView(  
382 -// // initialUrl: "http://colorcun.com/privacy1.html",  
383 -// // javascriptMode: JavascriptMode.unrestricted,  
384 -// // onWebViewCreated: (WebViewController webViewController) {  
385 -// // // Loading.showLoading(context);  
386 -// // _controller.complete(webViewController);  
387 -// // },  
388 -// // javascriptChannels: <JavascriptChannel>[  
389 -// // _toasterJavascriptChannel(context),  
390 -// // ].toSet(),  
391 -// // navigationDelegate: (NavigationRequest request) {  
392 -// // if (request.url.startsWith('https://www.youtube.com/')) {  
393 -// // return NavigationDecision.prevent;  
394 -// // }  
395 -// // return NavigationDecision.navigate;  
396 -// // },  
397 -// // onPageStarted: (String url) {},  
398 -// // onPageFinished: (String url) {  
399 -// // // Loading.hideLoading(context);  
400 -// // },  
401 -// // gestureNavigationEnabled: true,  
402 -// // )),  
403 -// // );  
404 -// // }  
405 -  
406 -// // JavascriptChannel _toasterJavascriptChannel(BuildContext context) {  
407 -// // return JavascriptChannel(  
408 -// // name: 'Toaster',  
409 -// // onMessageReceived: (JavascriptMessage message) {  
410 -// // Scaffold.of(context).showSnackBar(  
411 -// // SnackBar(content: Text(message.message)),  
412 -// // );  
413 -// // });  
414 -// // }  
415 -// // }  
@@ -1226,7 +1226,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { @@ -1226,7 +1226,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
1226 backgroundColor: MyColours.color_F8F9FD, 1226 backgroundColor: MyColours.color_F8F9FD,
1227 appBar: SystemAppBar( 1227 appBar: SystemAppBar(
1228 '店铺信息', 1228 '店铺信息',
1229 - bgColor: MyColours.color_F8F9FD, 1229 + bgColor: MyColours.color_ffffff,
1230 onTap: () { 1230 onTap: () {
1231 Navigator.of(context).pop(); 1231 Navigator.of(context).pop();
1232 }, 1232 },
@@ -21,7 +21,7 @@ class _WebViewPageState extends State<WebViewPage> { @@ -21,7 +21,7 @@ class _WebViewPageState extends State<WebViewPage> {
21 void initState() { 21 void initState() {
22 super.initState(); 22 super.initState();
23 // Enable hybrid composition. 23 // Enable hybrid composition.
24 - // if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); 24 + if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
25 } 25 }
26 26
27 @override 27 @override
@@ -33,52 +33,51 @@ class _WebViewPageState extends State<WebViewPage> { @@ -33,52 +33,51 @@ class _WebViewPageState extends State<WebViewPage> {
33 33
34 @override 34 @override
35 Widget build(BuildContext context) { 35 Widget build(BuildContext context) {
36 - return Container();  
37 - // return Scaffold(  
38 - // // We're using a Builder here so we have a context that is below the Scaffold  
39 - // // to allow calling Scaffold.of(context) so we can show a snackbar.  
40 - // appBar: SystemAppBar(  
41 - // '周到安排商家',  
42 - // ),  
43 - // body: Builder(builder: (BuildContext context) {  
44 - // return WebView(  
45 - // initialUrl: "https://support.qq.com/product/152856",  
46 - // javascriptMode: JavascriptMode.unrestricted,  
47 - // onWebViewCreated: (WebViewController webViewController) {  
48 - // _controller.complete(webViewController);  
49 - // },  
50 - // // TODO(iskakaushik): Remove this when collection literals makes it to stable.  
51 - // // ignore: prefer_collection_literals  
52 - // javascriptChannels: <JavascriptChannel>[  
53 - // _toasterJavascriptChannel(context),  
54 - // ].toSet(),  
55 - // navigationDelegate: (NavigationRequest request) {  
56 - // if (request.url.startsWith('https://www.youtube.com/')) {  
57 - // print('blocking navigation to $request}');  
58 - // return NavigationDecision.prevent;  
59 - // }  
60 - // print('allowing navigation to $request');  
61 - // return NavigationDecision.navigate;  
62 - // },  
63 - // onPageStarted: (String url) {  
64 - // print('Page started loading: $url');  
65 - // },  
66 - // onPageFinished: (String url) {  
67 - // print('Page finished loading: $url');  
68 - // },  
69 - // gestureNavigationEnabled: true,  
70 - // );  
71 - // }),  
72 - // ); 36 + return Scaffold(
  37 + // We're using a Builder here so we have a context that is below the Scaffold
  38 + // to allow calling Scaffold.of(context) so we can show a snackbar.
  39 + appBar: SystemAppBar(
  40 + '周到安排商家',
  41 + ),
  42 + body: Builder(builder: (BuildContext context) {
  43 + return WebView(
  44 + initialUrl: "https://support.qq.com/product/152856",
  45 + javascriptMode: JavascriptMode.unrestricted,
  46 + onWebViewCreated: (WebViewController webViewController) {
  47 + _controller.complete(webViewController);
  48 + },
  49 + // TODO(iskakaushik): Remove this when collection literals makes it to stable.
  50 + // ignore: prefer_collection_literals
  51 + javascriptChannels: <JavascriptChannel>[
  52 + _toasterJavascriptChannel(context),
  53 + ].toSet(),
  54 + navigationDelegate: (NavigationRequest request) {
  55 + if (request.url.startsWith('https://www.youtube.com/')) {
  56 + print('blocking navigation to $request}');
  57 + return NavigationDecision.prevent;
  58 + }
  59 + print('allowing navigation to $request');
  60 + return NavigationDecision.navigate;
  61 + },
  62 + onPageStarted: (String url) {
  63 + print('Page started loading: $url');
  64 + },
  65 + onPageFinished: (String url) {
  66 + print('Page finished loading: $url');
  67 + },
  68 + gestureNavigationEnabled: true,
  69 + );
  70 + }),
  71 + );
73 } 72 }
74 73
75 - // JavascriptChannel _toasterJavascriptChannel(BuildContext context) {  
76 - // return JavascriptChannel(  
77 - // name: 'Toaster',  
78 - // onMessageReceived: (JavascriptMessage message) {  
79 - // ScaffoldMessenger.of(context).showSnackBar(  
80 - // SnackBar(content: Text(message.message)),  
81 - // );  
82 - // });  
83 - // } 74 + JavascriptChannel _toasterJavascriptChannel(BuildContext context) {
  75 + return JavascriptChannel(
  76 + name: 'Toaster',
  77 + onMessageReceived: (JavascriptMessage message) {
  78 + ScaffoldMessenger.of(context).showSnackBar(
  79 + SnackBar(content: Text(message.message)),
  80 + );
  81 + });
  82 + }
84 } 83 }
@@ -55,7 +55,7 @@ import 'package:one_key/pages/login/login_page.dart'; @@ -55,7 +55,7 @@ import 'package:one_key/pages/login/login_page.dart';
55 import 'package:one_key/pages/detail/handle_online_page.dart'; 55 import 'package:one_key/pages/detail/handle_online_page.dart';
56 import 'package:one_key/pages/detail/notebook_detail_page.dart'; 56 import 'package:one_key/pages/detail/notebook_detail_page.dart';
57 import 'package:one_key/pages/login/login_page_f.dart'; 57 import 'package:one_key/pages/login/login_page_f.dart';
58 -import 'package:one_key/pages/login/web_page_old.dart'; 58 +
59 import 'package:one_key/pages/message/message_order_menu.dart'; 59 import 'package:one_key/pages/message/message_order_menu.dart';
60 60
61 import 'package:one_key/pages/my/customer_type/my_customer/my_customer_detail_edit_page.dart'; 61 import 'package:one_key/pages/my/customer_type/my_customer/my_customer_detail_edit_page.dart';
@@ -17,7 +17,6 @@ import 'package:flutter_statusbarcolor_ns/flutter_statusbarcolor_ns.dart'; @@ -17,7 +17,6 @@ import 'package:flutter_statusbarcolor_ns/flutter_statusbarcolor_ns.dart';
17 import 'package:fluttertoast/fluttertoast.dart'; 17 import 'package:fluttertoast/fluttertoast.dart';
18 import 'package:flutter/services.dart'; 18 import 'package:flutter/services.dart';
19 import 'package:fluwx/fluwx.dart'; 19 import 'package:fluwx/fluwx.dart';
20 -import 'package:one_key/pages/login/web_page_old.dart';  
21 import 'package:one_key/provider/my_model.dart'; 20 import 'package:one_key/provider/my_model.dart';
22 import 'package:one_key/provider/user_model.dart'; 21 import 'package:one_key/provider/user_model.dart';
23 import 'package:one_key/res/colors.dart'; 22 import 'package:one_key/res/colors.dart';
@@ -239,13 +239,6 @@ packages: @@ -239,13 +239,6 @@ packages:
239 url: "https://pub.flutter-io.cn" 239 url: "https://pub.flutter-io.cn"
240 source: hosted 240 source: hosted
241 version: "2.0.1" 241 version: "2.0.1"
242 - chewie:  
243 - dependency: "direct main"  
244 - description:  
245 - name: chewie  
246 - url: "https://pub.flutter-io.cn"  
247 - source: hosted  
248 - version: "1.3.5"  
249 city_pickers: 242 city_pickers:
250 dependency: "direct main" 243 dependency: "direct main"
251 description: 244 description:
@@ -587,13 +580,6 @@ packages: @@ -587,13 +580,6 @@ packages:
587 url: "https://pub.flutter-io.cn" 580 url: "https://pub.flutter-io.cn"
588 source: hosted 581 source: hosted
589 version: "0.0.7" 582 version: "0.0.7"
590 - flutter_filereader:  
591 - dependency: "direct main"  
592 - description:  
593 - name: flutter_filereader  
594 - url: "https://pub.flutter-io.cn"  
595 - source: hosted  
596 - version: "3.0.0"  
597 flutter_image_compress: 583 flutter_image_compress:
598 dependency: "direct main" 584 dependency: "direct main"
599 description: 585 description:
@@ -790,21 +776,21 @@ packages: @@ -790,21 +776,21 @@ packages:
790 name: image_cropper 776 name: image_cropper
791 url: "https://pub.flutter-io.cn" 777 url: "https://pub.flutter-io.cn"
792 source: hosted 778 source: hosted
793 - version: "4.0.1" 779 + version: "3.0.3"
794 image_cropper_for_web: 780 image_cropper_for_web:
795 dependency: transitive 781 dependency: transitive
796 description: 782 description:
797 name: image_cropper_for_web 783 name: image_cropper_for_web
798 url: "https://pub.flutter-io.cn" 784 url: "https://pub.flutter-io.cn"
799 source: hosted 785 source: hosted
800 - version: "2.0.0" 786 + version: "1.0.3"
801 image_cropper_platform_interface: 787 image_cropper_platform_interface:
802 dependency: transitive 788 dependency: transitive
803 description: 789 description:
804 name: image_cropper_platform_interface 790 name: image_cropper_platform_interface
805 url: "https://pub.flutter-io.cn" 791 url: "https://pub.flutter-io.cn"
806 source: hosted 792 source: hosted
807 - version: "4.0.0" 793 + version: "3.0.3"
808 image_gallery_saver: 794 image_gallery_saver:
809 dependency: "direct main" 795 dependency: "direct main"
810 description: 796 description:
@@ -1568,41 +1554,6 @@ packages: @@ -1568,41 +1554,6 @@ packages:
1568 url: "https://pub.flutter-io.cn" 1554 url: "https://pub.flutter-io.cn"
1569 source: hosted 1555 source: hosted
1570 version: "0.5.3" 1556 version: "0.5.3"
1571 - wakelock:  
1572 - dependency: transitive  
1573 - description:  
1574 - name: wakelock  
1575 - url: "https://pub.flutter-io.cn"  
1576 - source: hosted  
1577 - version: "0.6.2"  
1578 - wakelock_macos:  
1579 - dependency: transitive  
1580 - description:  
1581 - name: wakelock_macos  
1582 - url: "https://pub.flutter-io.cn"  
1583 - source: hosted  
1584 - version: "0.4.0"  
1585 - wakelock_platform_interface:  
1586 - dependency: transitive  
1587 - description:  
1588 - name: wakelock_platform_interface  
1589 - url: "https://pub.flutter-io.cn"  
1590 - source: hosted  
1591 - version: "0.3.0"  
1592 - wakelock_web:  
1593 - dependency: transitive  
1594 - description:  
1595 - name: wakelock_web  
1596 - url: "https://pub.flutter-io.cn"  
1597 - source: hosted  
1598 - version: "0.4.0"  
1599 - wakelock_windows:  
1600 - dependency: transitive  
1601 - description:  
1602 - name: wakelock_windows  
1603 - url: "https://pub.flutter-io.cn"  
1604 - source: hosted  
1605 - version: "0.2.0"  
1606 watcher: 1557 watcher:
1607 dependency: transitive 1558 dependency: transitive
1608 description: 1559 description:
@@ -1620,31 +1571,10 @@ packages: @@ -1620,31 +1571,10 @@ packages:
1620 webview_flutter: 1571 webview_flutter:
1621 dependency: "direct main" 1572 dependency: "direct main"
1622 description: 1573 description:
1623 - name: webview_flutter  
1624 - url: "https://pub.flutter-io.cn"  
1625 - source: hosted  
1626 - version: "4.2.2"  
1627 - webview_flutter_android:  
1628 - dependency: transitive  
1629 - description:  
1630 - name: webview_flutter_android  
1631 - url: "https://pub.flutter-io.cn"  
1632 - source: hosted  
1633 - version: "3.9.3"  
1634 - webview_flutter_platform_interface:  
1635 - dependency: transitive  
1636 - description:  
1637 - name: webview_flutter_platform_interface  
1638 - url: "https://pub.flutter-io.cn"  
1639 - source: hosted  
1640 - version: "2.5.0"  
1641 - webview_flutter_wkwebview:  
1642 - dependency: transitive  
1643 - description:  
1644 - name: webview_flutter_wkwebview  
1645 - url: "https://pub.flutter-io.cn"  
1646 - source: hosted  
1647 - version: "3.7.3" 1574 + path: "library/webview_flutter-2.0.13-copy_inappwebview_select_file_20210930"
  1575 + relative: true
  1576 + source: path
  1577 + version: "2.0.13"
1648 wechat_assets_picker: 1578 wechat_assets_picker:
1649 dependency: "direct main" 1579 dependency: "direct main"
1650 description: 1580 description:
@@ -158,7 +158,7 @@ dependencies: @@ -158,7 +158,7 @@ dependencies:
158 # video_player: ^2.2.12 158 # video_player: ^2.2.12
159 # ^2.4.7 159 # ^2.4.7
160 # chewie: ^1.3.3 160 # chewie: ^1.3.3
161 - chewie: ^1.3.5 161 + # chewie: ^1.3.5
162 # cached_video_player: ^2.0.4 162 # cached_video_player: ^2.0.4
163 # 视频播放 163 # 视频播放
164 # flutter_ijkplayer: 0.3.5+1 164 # flutter_ijkplayer: 0.3.5+1
@@ -168,7 +168,8 @@ dependencies: @@ -168,7 +168,8 @@ dependencies:
168 video_compress: ^3.1.1 168 video_compress: ^3.1.1
169 #高德地图 169 #高德地图
170 # amap_map_fluttify: 0.25.0 170 # amap_map_fluttify: 0.25.0
171 - amap_map_fluttify: ^2.0.2 171 + amap_map_fluttify: ^2.0.0-rc.1
  172 +
172 173
173 #虚线边框 174 #虚线边框
174 dotted_border: ^1.0.7 175 dotted_border: ^1.0.7
@@ -186,8 +187,8 @@ dependencies: @@ -186,8 +187,8 @@ dependencies:
186 flutter_staggered_grid_view: ^0.4.1 187 flutter_staggered_grid_view: ^0.4.1
187 # webview 188 # webview
188 189
189 - webview_flutter: ^4.2.2  
190 - flutter_inappwebview: ^5.3.2 190 + # webview_flutter: ^4.2.2
  191 + flutter_inappwebview: ^5.7.2+3
191 # flutter_inappwebview: ^6.0.0 192 # flutter_inappwebview: ^6.0.0
192 flutter_downloader: ^1.10.5 193 flutter_downloader: ^1.10.5
193 android_path_provider: ^0.3.0 194 android_path_provider: ^0.3.0
@@ -195,12 +196,14 @@ dependencies: @@ -195,12 +196,14 @@ dependencies:
195 # open_file: ^3.3.2 196 # open_file: ^3.3.2
196 open_filex: ^4.3.4 197 open_filex: ^4.3.4
197 # open_file_plus: ^3.3.0 198 # open_file_plus: ^3.3.0
198 - flutter_filereader: ^3.0.0 199 + # flutter_filereader: ^3.0.0
199 flutter_draggable_gridview: ^0.0.8 200 flutter_draggable_gridview: ^0.0.8
  201 + # flutter_webview_plugin_ios_android: ^0.3.13+12
  202 + # flutter_multiple_webview_plugin: ^1.0.11
200 203
201 204
202 - # webview_flutter:  
203 - # path: library/webview_flutter-2.0.13-copy_inappwebview_select_file_20210930 205 + webview_flutter:
  206 + path: library/webview_flutter-2.0.13-copy_inappwebview_select_file_20210930
204 sendsms: 207 sendsms:
205 path: library/sendsms-1.0.3 208 path: library/sendsms-1.0.3
206 device_utils_my: 209 device_utils_my:
@@ -220,8 +223,8 @@ dependencies: @@ -220,8 +223,8 @@ dependencies:
220 image_gallery_saver: ^2.0.3 223 image_gallery_saver: ^2.0.3
221 flutter_image_compress: ^1.1.3 224 flutter_image_compress: ^1.1.3
222 image: ^4.0.15 225 image: ^4.0.15
223 - # image_cropper: ^3.0.1  
224 - image_cropper: ^4.0.1 226 + image_cropper: ^3.0.1
  227 + # image_cropper: ^4.0.1
225 pin_code_fields: ^7.4.0 228 pin_code_fields: ^7.4.0
226 # 二维码扫描 229 # 二维码扫描
227 barcode_scan2: ^4.2.4 230 barcode_scan2: ^4.2.4