|
1
|
import 'dart:async';
|
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:one_key/net/dio_util.dart';
|
|
|
|
7
|
-import 'package:one_key/res/colors.dart';
|
|
|
|
8
|
-import 'package:one_key/utils/event_bus.dart';
|
|
|
|
9
|
-import 'package:one_key/utils/utils.dart';
|
|
|
|
10
|
-import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
11
|
-import 'package:path_provider/path_provider.dart';
|
|
|
|
12
|
-import 'package:permission_handler/permission_handler.dart';
|
|
|
|
13
|
-import 'package:webview_flutter/webview_flutter.dart';
|
|
|
|
14
|
-
|
|
|
|
15
|
-import 'dart:async';
|
|
|
|
16
|
import 'dart:convert';
|
2
|
import 'dart:convert';
|
|
17
|
import 'dart:io';
|
3
|
import 'dart:io';
|
|
18
|
|
4
|
|
|
19
|
import 'package:flutter/material.dart';
|
5
|
import 'package:flutter/material.dart';
|
|
|
|
6
|
+import 'package:one_key/res/colors.dart';
|
|
20
|
import 'package:one_key/utils/event_bus.dart';
|
7
|
import 'package:one_key/utils/event_bus.dart';
|
|
|
|
8
|
+import 'package:one_key/utils/utils.dart';
|
|
21
|
import 'package:one_key/widgets/app_bar.dart';
|
9
|
import 'package:one_key/widgets/app_bar.dart';
|
|
22
|
import 'package:one_key/widgets/system_app_bar.dart';
|
10
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
23
|
import 'package:webview_flutter/webview_flutter.dart';
|
11
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
24
|
|
12
|
|
|
25
|
-import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
|
|
|
26
|
-import 'package:url_launcher/url_launcher.dart';
|
|
|
|
27
|
-import 'dart:collection';
|
|
|
|
28
|
-// import 'package:open_file/open_file.dart';
|
|
|
|
29
|
-// import 'package:flutter_downloader/flutter_downloader.dart';
|
|
|
|
30
|
-
|
|
|
|
31
|
class WebPage extends StatefulWidget {
|
13
|
class WebPage extends StatefulWidget {
|
|
32
|
final String title;
|
14
|
final String title;
|
|
33
|
final String url;
|
15
|
final String url;
|
|
@@ -40,104 +22,14 @@ class WebPage extends StatefulWidget { |
|
@@ -40,104 +22,14 @@ class WebPage extends StatefulWidget { |
|
40
|
}
|
22
|
}
|
|
41
|
|
23
|
|
|
42
|
class _WebPageState extends State<WebPage> {
|
24
|
class _WebPageState extends State<WebPage> {
|
|
43
|
- final GlobalKey webViewKey = GlobalKey();
|
|
|
|
44
|
-
|
|
|
|
45
|
- InAppWebViewController webViewController;
|
|
|
|
46
|
- InAppWebViewGroupOptions options = InAppWebViewGroupOptions(
|
|
|
|
47
|
- crossPlatform: InAppWebViewOptions(
|
|
|
|
48
|
- useShouldOverrideUrlLoading: true,
|
|
|
|
49
|
- useOnDownloadStart: true,
|
|
|
|
50
|
- mediaPlaybackRequiresUserGesture: false,
|
|
|
|
51
|
- ),
|
|
|
|
52
|
- android: AndroidInAppWebViewOptions(
|
|
|
|
53
|
- useHybridComposition: true,
|
|
|
|
54
|
- ),
|
|
|
|
55
|
- ios: IOSInAppWebViewOptions(
|
|
|
|
56
|
- allowsInlineMediaPlayback: true,
|
|
|
|
57
|
- ));
|
|
|
|
58
|
-
|
|
|
|
59
|
- PullToRefreshController pullToRefreshController;
|
|
|
|
60
|
- ContextMenu contextMenu;
|
|
|
|
61
|
- String url = "";
|
|
|
|
62
|
- double progress = 0;
|
|
|
|
63
|
- final urlController = TextEditingController();
|
|
|
|
64
|
- // Future<void> openFile(filePath) async {
|
|
|
|
65
|
- // final _result = await OpenFile.open(filePath);
|
|
|
|
66
|
- // print(_result.message);
|
|
|
|
67
|
-
|
|
|
|
68
|
- // // setState(() {
|
|
|
|
69
|
- // // _openResult = "type=${_result.type} message=${_result.message}";
|
|
|
|
70
|
- // // });
|
|
|
|
71
|
- // }
|
25
|
+ final Completer<WebViewController> _controller =
|
|
|
|
26
|
+ Completer<WebViewController>();
|
|
72
|
|
27
|
|
|
73
|
@override
|
28
|
@override
|
|
74
|
void initState() {
|
29
|
void initState() {
|
|
75
|
super.initState();
|
30
|
super.initState();
|
|
76
|
-
|
|
|
|
77
|
// Enable hybrid composition.
|
31
|
// Enable hybrid composition.
|
|
78
|
- _init();
|
|
|
|
79
|
- }
|
|
|
|
80
|
-
|
|
|
|
81
|
- // Future<bool> _checkPermission() async {
|
|
|
|
82
|
- // DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
|
|
|
83
|
- // AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
|
|
|
84
|
- // if (Platform.isAndroid && androidInfo.version.sdkInt <= 28) {
|
|
|
|
85
|
- // final status = await Permission.storage.status;
|
|
|
|
86
|
- // if (status != PermissionStatus.granted) {
|
|
|
|
87
|
- // final result = await Permission.storage.request();
|
|
|
|
88
|
- // if (result == PermissionStatus.granted) {
|
|
|
|
89
|
- // return true;
|
|
|
|
90
|
- // }
|
|
|
|
91
|
- // } else {
|
|
|
|
92
|
- // return true;
|
|
|
|
93
|
- // }
|
|
|
|
94
|
- // } else {
|
|
|
|
95
|
- // return true;
|
|
|
|
96
|
- // }
|
|
|
|
97
|
- // return false;
|
|
|
|
98
|
- // }
|
|
|
|
99
|
-
|
|
|
|
100
|
- // Future<bool> checkPermissionStorage() async {
|
|
|
|
101
|
- // var status = await Permission.storage.status;
|
|
|
|
102
|
- // if (!status.isGranted) {
|
|
|
|
103
|
- // status = await Permission.storage.request();
|
|
|
|
104
|
- // if (status.isGranted) {
|
|
|
|
105
|
- // return true;
|
|
|
|
106
|
- // }
|
|
|
|
107
|
- // } else {
|
|
|
|
108
|
- // return true;
|
|
|
|
109
|
- // }
|
|
|
|
110
|
- // return false;
|
|
|
|
111
|
- // }
|
|
|
|
112
|
-
|
|
|
|
113
|
- _init() async {
|
|
|
|
114
|
- // WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
115
|
- // await FlutterDownloader.initialize(debug: true);
|
|
|
|
116
|
- if (Platform.isAndroid) {
|
|
|
|
117
|
- await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true);
|
|
|
|
118
|
-
|
|
|
|
119
|
- var swAvailable = await AndroidWebViewFeature.isFeatureSupported(
|
|
|
|
120
|
- AndroidWebViewFeature.SERVICE_WORKER_BASIC_USAGE);
|
|
|
|
121
|
- var swInterceptAvailable = await AndroidWebViewFeature.isFeatureSupported(
|
|
|
|
122
|
- AndroidWebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
|
|
|
|
123
|
-
|
|
|
|
124
|
- if (swAvailable && swInterceptAvailable) {
|
|
|
|
125
|
- AndroidServiceWorkerController serviceWorkerController =
|
|
|
|
126
|
- AndroidServiceWorkerController.instance();
|
|
|
|
127
|
-
|
|
|
|
128
|
- serviceWorkerController.serviceWorkerClient =
|
|
|
|
129
|
- AndroidServiceWorkerClient(
|
|
|
|
130
|
- shouldInterceptRequest: (request) async {
|
|
|
|
131
|
- print(request);
|
|
|
|
132
|
- return null;
|
|
|
|
133
|
- },
|
|
|
|
134
|
- );
|
|
|
|
135
|
- }
|
|
|
|
136
|
- }
|
|
|
|
137
|
- // await FlutterDownloader.initialize(
|
|
|
|
138
|
- // debug: true // optional: set false to disable printing logs to console
|
|
|
|
139
|
- // );
|
|
|
|
140
|
- // await Permission.storage.request();
|
32
|
+ if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
|
|
141
|
}
|
33
|
}
|
|
142
|
|
34
|
|
|
143
|
@override
|
35
|
@override
|
|
@@ -161,201 +53,52 @@ class _WebPageState extends State<WebPage> { |
|
@@ -161,201 +53,52 @@ class _WebPageState extends State<WebPage> { |
|
161
|
}
|
53
|
}
|
|
162
|
return true;
|
54
|
return true;
|
|
163
|
},
|
55
|
},
|
|
164
|
- child: Column(
|
|
|
|
165
|
- children: [
|
|
|
|
166
|
- Expanded(
|
|
|
|
167
|
- child: InAppWebView(
|
|
|
|
168
|
- key: webViewKey,
|
|
|
|
169
|
- // contextMenu: contextMenu,
|
|
|
|
170
|
- initialUrlRequest: URLRequest(
|
|
|
|
171
|
- url: Uri.parse("http://colorcun.com/privacy1.html")),
|
|
|
|
172
|
- // initialFile: "assets/index.html",
|
|
|
|
173
|
- initialUserScripts: UnmodifiableListView<UserScript>([]),
|
|
|
|
174
|
- initialOptions: options,
|
|
|
|
175
|
- pullToRefreshController: pullToRefreshController,
|
|
|
|
176
|
- onWebViewCreated: (controller) {
|
|
|
|
177
|
- webViewController = controller;
|
56
|
+ child: Column(children: [
|
|
|
|
57
|
+ Builder(builder: (BuildContext context) {
|
|
|
|
58
|
+ return Expanded(
|
|
|
|
59
|
+ child: WebView(
|
|
|
|
60
|
+ initialUrl: "http://colorcun.com/privacy1.html",
|
|
|
|
61
|
+ javascriptMode: JavascriptMode.unrestricted,
|
|
|
|
62
|
+ onWebViewCreated: (WebViewController webViewController) {
|
|
|
|
63
|
+ _controller.complete(webViewController);
|
|
178
|
},
|
64
|
},
|
|
179
|
- onLoadStart: (controller, url) {
|
|
|
|
180
|
- // setState(() {
|
|
|
|
181
|
- // this.url = url.toString();
|
|
|
|
182
|
- // urlController.text = this.url;
|
|
|
|
183
|
- // });
|
|
|
|
184
|
- },
|
|
|
|
185
|
- androidOnPermissionRequest:
|
|
|
|
186
|
- (controller, origin, resources) async {
|
|
|
|
187
|
- // return PermissionRequestResponse(
|
|
|
|
188
|
- // resources: resources,
|
|
|
|
189
|
- // action: PermissionRequestResponseAction.GRANT);
|
|
|
|
190
|
- },
|
|
|
|
191
|
- shouldOverrideUrlLoading:
|
|
|
|
192
|
- (controller, navigationAction) async {
|
|
|
|
193
|
- var uri = navigationAction.request.url;
|
|
|
|
194
|
-
|
|
|
|
195
|
- if (![
|
|
|
|
196
|
- "http",
|
|
|
|
197
|
- "https",
|
|
|
|
198
|
- "file",
|
|
|
|
199
|
- "chrome",
|
|
|
|
200
|
- "data",
|
|
|
|
201
|
- "javascript",
|
|
|
|
202
|
- "about"
|
|
|
|
203
|
- ].contains(uri.scheme)) {
|
|
|
|
204
|
- if (await canLaunch(url)) {
|
|
|
|
205
|
- // Launch the App
|
|
|
|
206
|
- await launch(
|
|
|
|
207
|
- url,
|
|
|
|
208
|
- );
|
|
|
|
209
|
- // and cancel the request
|
|
|
|
210
|
- return NavigationActionPolicy.CANCEL;
|
|
|
|
211
|
- }
|
65
|
+ // TODO(iskakaushik): Remove this when collection literals makes it to stable.
|
|
|
|
66
|
+ // ignore: prefer_collection_literals
|
|
|
|
67
|
+ javascriptChannels: <JavascriptChannel>[
|
|
|
|
68
|
+ _toasterJavascriptChannel(context),
|
|
|
|
69
|
+ ].toSet(),
|
|
|
|
70
|
+ navigationDelegate: (NavigationRequest request) {
|
|
|
|
71
|
+ if (request.url.startsWith('https://www.youtube.com/')) {
|
|
|
|
72
|
+ print('blocking navigation to $request}');
|
|
|
|
73
|
+ return NavigationDecision.prevent;
|
|
212
|
}
|
74
|
}
|
|
213
|
-
|
|
|
|
214
|
- return NavigationActionPolicy.ALLOW;
|
|
|
|
215
|
- },
|
|
|
|
216
|
- onLoadStop: (controller, url) async {
|
|
|
|
217
|
- // pullToRefreshController.endRefreshing();
|
|
|
|
218
|
- // setState(() {
|
|
|
|
219
|
- // this.url = url.toString();
|
|
|
|
220
|
- // urlController.text = this.url;
|
|
|
|
221
|
- // });
|
|
|
|
222
|
- },
|
|
|
|
223
|
- onLoadError: (controller, url, code, message) {
|
|
|
|
224
|
- pullToRefreshController.endRefreshing();
|
|
|
|
225
|
- },
|
|
|
|
226
|
- onProgressChanged: (controller, progress) {
|
|
|
|
227
|
- // if (progress == 100) {
|
|
|
|
228
|
- pullToRefreshController.endRefreshing();
|
|
|
|
229
|
- // }
|
|
|
|
230
|
- // setState(() {
|
|
|
|
231
|
- // this.progress = progress / 100;
|
|
|
|
232
|
- // urlController.text = this.url;
|
|
|
|
233
|
- // });
|
75
|
+ print('allowing navigation to $request');
|
|
|
|
76
|
+ return NavigationDecision.navigate;
|
|
234
|
},
|
77
|
},
|
|
235
|
- onUpdateVisitedHistory: (controller, url, androidIsReload) {
|
|
|
|
236
|
- // setState(() {
|
|
|
|
237
|
- // this.url = url.toString();
|
|
|
|
238
|
- // urlController.text = this.url;
|
|
|
|
239
|
- // });
|
78
|
+ onPageStarted: (String url) {
|
|
|
|
79
|
+ print('Page started loading: $url');
|
|
240
|
},
|
80
|
},
|
|
241
|
- onConsoleMessage: (controller, consoleMessage) {
|
|
|
|
242
|
- print(consoleMessage);
|
81
|
+ onPageFinished: (String url) {
|
|
|
|
82
|
+ print('Page finished loading: $url');
|
|
243
|
},
|
83
|
},
|
|
244
|
- onDownloadStart: (controller, url) async {
|
|
|
|
245
|
- // print("onDownloadStart $url");
|
|
|
|
246
|
- // Utils.showToast('开始下载...');
|
|
|
|
247
|
- // // final taskId = await FlutterDownloader.enqueue(
|
|
|
|
248
|
- // // url: url.toString(),
|
|
|
|
249
|
- // // savedDir: (await getExternalStorageDirectory()).path,
|
|
|
|
250
|
- // // showNotification:
|
|
|
|
251
|
- // // true, // show download progress in status bar (for Android)
|
|
|
|
252
|
- // // openFileFromNotification:
|
|
|
|
253
|
- // // true, // click on notification to open downloaded file (for Android)
|
|
|
|
254
|
- // // );
|
|
|
|
255
|
- // final dir = await getExternalStorageDirectory();
|
|
|
|
256
|
- // String savePath = dir.path + "/one_key";
|
|
|
|
257
|
-
|
|
|
|
258
|
- // Directory directory = new Directory(savePath);
|
|
|
|
259
|
- // if (directory.existsSync()) {
|
|
|
|
260
|
- // //删除历史apk
|
|
|
|
261
|
- // final List<FileSystemEntity> files = directory.listSync();
|
|
|
|
262
|
- // for (FileSystemEntity file in files) {
|
|
|
|
263
|
- // file.deleteSync();
|
|
|
|
264
|
- // }
|
|
|
|
265
|
- // }
|
|
|
|
266
|
- // DioUtil().download(url.toString(), savePath,
|
|
|
|
267
|
- // onProgress: (received, total) {
|
|
|
|
268
|
- // // if (_progress != 100) {
|
|
|
|
269
|
- // // int progress = ((received / total) * 100).round();
|
|
|
|
270
|
- // // _progress = progress;
|
|
|
|
271
|
- // // _setState(() {});
|
|
|
|
272
|
- // // }
|
|
|
|
273
|
- // if (received == total) {
|
|
|
|
274
|
- // print('object');
|
|
|
|
275
|
- // Utils.showToast('文件已保存在${savePath}');
|
|
|
|
276
|
- // // openFile(savePath);
|
|
|
|
277
|
- // //下载完成
|
|
|
|
278
|
- // // InstallPlugin.installApk(savePath, "com.naji.one_key");
|
|
|
|
279
|
- // }
|
|
|
|
280
|
- // });
|
|
|
|
281
|
- // // },
|
|
|
|
282
|
- // // DioUtil().download(url.toString(),
|
|
|
|
283
|
- // // (await getExternalStorageDirectory()).path,
|
|
|
|
284
|
- // // onProgress: (received, total) {
|
|
|
|
285
|
- // // // if (_progress != 100) {
|
|
|
|
286
|
- // // // int progress = ((received / total) * 100).round();
|
|
|
|
287
|
- // // // _progress = progress;
|
|
|
|
288
|
- // // // _setState(() {});
|
|
|
|
289
|
- // // // }
|
|
|
|
290
|
- // // if (received == total) {
|
|
|
|
291
|
- // // //下载完成
|
|
|
|
292
|
- // // // InstallPlugin.installApk(savePath, "com.naji.one_key");
|
|
|
|
293
|
- // // }
|
|
|
|
294
|
- // // });
|
|
|
|
295
|
- },
|
|
|
|
296
|
- ))
|
|
|
|
297
|
- ],
|
|
|
|
298
|
- )
|
|
|
|
299
|
- // Builder(builder: (BuildContext context) {
|
|
|
|
300
|
- // return WebView(
|
|
|
|
301
|
- // initialUrl: "http://colorcun.com/privacy1.html",
|
|
|
|
302
|
- // javascriptMode: JavascriptMode.unrestricted,
|
|
|
|
303
|
- // onWebViewCreated: (WebViewController webViewController) {
|
|
|
|
304
|
- // _controller.complete(webViewController);
|
|
|
|
305
|
- // },
|
|
|
|
306
|
- // // TODO(iskakaushik): Remove this when collection literals makes it to stable.
|
|
|
|
307
|
- // // ignore: prefer_collection_literals
|
|
|
|
308
|
- // javascriptChannels: <JavascriptChannel>[
|
|
|
|
309
|
- // _toasterJavascriptChannel(context),
|
|
|
|
310
|
- // ].toSet(),
|
|
|
|
311
|
- // navigationDelegate: (NavigationRequest request) {
|
|
|
|
312
|
- // if (request.url.startsWith('https://www.youtube.com/')) {
|
|
|
|
313
|
- // print('blocking navigation to $request}');
|
|
|
|
314
|
- // return NavigationDecision.prevent;
|
|
|
|
315
|
- // }
|
|
|
|
316
|
- // print('allowing navigation to $request');
|
|
|
|
317
|
- // return NavigationDecision.navigate;
|
|
|
|
318
|
- // },
|
|
|
|
319
|
- // onPageStarted: (String url) {
|
|
|
|
320
|
- // print('Page started loading: $url');
|
|
|
|
321
|
- // },
|
|
|
|
322
|
- // onPageFinished: (String url) async {
|
|
|
|
323
|
- // print('Page finished loading: $url');
|
|
|
|
324
|
- // // showDownloadProgress(context);
|
|
|
|
325
|
- // final dir = await getExternalStorageDirectory();
|
|
|
|
326
|
- // String savePath = dir.path + "/one_key";
|
|
|
|
327
|
- // DioUtil().download(url, savePath,
|
|
|
|
328
|
- // onProgress: (received, total) {
|
|
|
|
329
|
- // // if (_progress != 100) {
|
|
|
|
330
|
- // // int progress = ((received / total) * 100).round();
|
|
|
|
331
|
- // // _progress = progress;
|
|
|
|
332
|
- // // _setState(() {});
|
|
|
|
333
|
- // // }
|
|
|
|
334
|
- // if (received == total) {
|
|
|
|
335
|
- // print('object');
|
|
|
|
336
|
- // //下载完成
|
|
|
|
337
|
- // // InstallPlugin.installApk(savePath, "com.naji.one_key");
|
|
|
|
338
|
- // }
|
|
|
|
339
|
- // });
|
|
|
|
340
|
- // },
|
|
|
|
341
|
- // gestureNavigationEnabled: true,
|
|
|
|
342
|
- // );
|
|
|
|
343
|
- // }),
|
|
|
|
344
|
- ));
|
84
|
+ gestureNavigationEnabled: true,
|
|
|
|
85
|
+ ));
|
|
|
|
86
|
+ }),
|
|
|
|
87
|
+ ])));
|
|
345
|
}
|
88
|
}
|
|
346
|
|
89
|
|
|
347
|
- // JavascriptChannel _toasterJavascriptChannel(BuildContext context) {
|
|
|
|
348
|
- // return JavascriptChannel(
|
|
|
|
349
|
- // name: 'Toaster',
|
|
|
|
350
|
- // onMessageReceived: (JavascriptMessage message) {
|
|
|
|
351
|
- // Scaffold.of(context).showSnackBar(
|
|
|
|
352
|
- // SnackBar(content: Text(message.message)),
|
|
|
|
353
|
- // );
|
|
|
|
354
|
- // });
|
|
|
|
355
|
- // }
|
90
|
+ JavascriptChannel _toasterJavascriptChannel(BuildContext context) {
|
|
|
|
91
|
+ return JavascriptChannel(
|
|
|
|
92
|
+ name: 'Toaster',
|
|
|
|
93
|
+ onMessageReceived: (JavascriptMessage message) {
|
|
|
|
94
|
+ Scaffold.of(context).showSnackBar(
|
|
|
|
95
|
+ SnackBar(content: Text(message.message)),
|
|
|
|
96
|
+ );
|
|
|
|
97
|
+ });
|
|
|
|
98
|
+ }
|
|
356
|
}
|
99
|
}
|
|
357
|
|
100
|
|
|
358
|
-// class WebPage extends StatelessWidget {
|
101
|
+// class WebPage extends StatefulWidget {
|
|
359
|
// final String title;
|
102
|
// final String title;
|
|
360
|
// final String url;
|
103
|
// final String url;
|
|
361
|
// final bool need;
|
104
|
// final bool need;
|
|
@@ -363,55 +106,382 @@ class _WebPageState extends State<WebPage> { |
|
@@ -363,55 +106,382 @@ class _WebPageState extends State<WebPage> { |
|
363
|
// const WebPage({Key key, this.title, this.url, this.need = false})
|
106
|
// const WebPage({Key key, this.title, this.url, this.need = false})
|
|
364
|
// : super(key: key);
|
107
|
// : super(key: key);
|
|
365
|
// @override
|
108
|
// @override
|
|
|
|
109
|
+// _WebPageState createState() => _WebPageState();
|
|
|
|
110
|
+// }
|
|
|
|
111
|
+
|
|
|
|
112
|
+// class _WebPageState extends State<WebPage> {
|
|
|
|
113
|
+// final GlobalKey webViewKey = GlobalKey();
|
|
|
|
114
|
+
|
|
|
|
115
|
+// InAppWebViewController webViewController;
|
|
|
|
116
|
+// InAppWebViewGroupOptions options = InAppWebViewGroupOptions(
|
|
|
|
117
|
+// crossPlatform: InAppWebViewOptions(
|
|
|
|
118
|
+// useShouldOverrideUrlLoading: true,
|
|
|
|
119
|
+// useOnDownloadStart: true,
|
|
|
|
120
|
+// mediaPlaybackRequiresUserGesture: false,
|
|
|
|
121
|
+// ),
|
|
|
|
122
|
+// android: AndroidInAppWebViewOptions(
|
|
|
|
123
|
+// useHybridComposition: true,
|
|
|
|
124
|
+// ),
|
|
|
|
125
|
+// ios: IOSInAppWebViewOptions(
|
|
|
|
126
|
+// allowsInlineMediaPlayback: true,
|
|
|
|
127
|
+// ));
|
|
|
|
128
|
+
|
|
|
|
129
|
+// PullToRefreshController pullToRefreshController;
|
|
|
|
130
|
+// ContextMenu contextMenu;
|
|
|
|
131
|
+// String url = "";
|
|
|
|
132
|
+// double progress = 0;
|
|
|
|
133
|
+// final urlController = TextEditingController();
|
|
|
|
134
|
+// // Future<void> openFile(filePath) async {
|
|
|
|
135
|
+// // final _result = await OpenFile.open(filePath);
|
|
|
|
136
|
+// // print(_result.message);
|
|
|
|
137
|
+
|
|
|
|
138
|
+// // // setState(() {
|
|
|
|
139
|
+// // // _openResult = "type=${_result.type} message=${_result.message}";
|
|
|
|
140
|
+// // // });
|
|
|
|
141
|
+// // }
|
|
|
|
142
|
+
|
|
|
|
143
|
+// @override
|
|
|
|
144
|
+// void initState() {
|
|
|
|
145
|
+// super.initState();
|
|
|
|
146
|
+
|
|
|
|
147
|
+// // Enable hybrid composition.
|
|
|
|
148
|
+// _init();
|
|
|
|
149
|
+// }
|
|
|
|
150
|
+
|
|
|
|
151
|
+// // Future<bool> _checkPermission() async {
|
|
|
|
152
|
+// // DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
|
|
|
153
|
+// // AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
|
|
|
154
|
+// // if (Platform.isAndroid && androidInfo.version.sdkInt <= 28) {
|
|
|
|
155
|
+// // final status = await Permission.storage.status;
|
|
|
|
156
|
+// // if (status != PermissionStatus.granted) {
|
|
|
|
157
|
+// // final result = await Permission.storage.request();
|
|
|
|
158
|
+// // if (result == PermissionStatus.granted) {
|
|
|
|
159
|
+// // return true;
|
|
|
|
160
|
+// // }
|
|
|
|
161
|
+// // } else {
|
|
|
|
162
|
+// // return true;
|
|
|
|
163
|
+// // }
|
|
|
|
164
|
+// // } else {
|
|
|
|
165
|
+// // return true;
|
|
|
|
166
|
+// // }
|
|
|
|
167
|
+// // return false;
|
|
|
|
168
|
+// // }
|
|
|
|
169
|
+
|
|
|
|
170
|
+// // Future<bool> checkPermissionStorage() async {
|
|
|
|
171
|
+// // var status = await Permission.storage.status;
|
|
|
|
172
|
+// // if (!status.isGranted) {
|
|
|
|
173
|
+// // status = await Permission.storage.request();
|
|
|
|
174
|
+// // if (status.isGranted) {
|
|
|
|
175
|
+// // return true;
|
|
|
|
176
|
+// // }
|
|
|
|
177
|
+// // } else {
|
|
|
|
178
|
+// // return true;
|
|
|
|
179
|
+// // }
|
|
|
|
180
|
+// // return false;
|
|
|
|
181
|
+// // }
|
|
|
|
182
|
+
|
|
|
|
183
|
+// _init() async {
|
|
|
|
184
|
+// // WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
185
|
+// // await FlutterDownloader.initialize(debug: true);
|
|
|
|
186
|
+// if (Platform.isAndroid) {
|
|
|
|
187
|
+// await AndroidInAppWebViewController.setWebContentsDebuggingEnabled(true);
|
|
|
|
188
|
+
|
|
|
|
189
|
+// var swAvailable = await AndroidWebViewFeature.isFeatureSupported(
|
|
|
|
190
|
+// AndroidWebViewFeature.SERVICE_WORKER_BASIC_USAGE);
|
|
|
|
191
|
+// var swInterceptAvailable = await AndroidWebViewFeature.isFeatureSupported(
|
|
|
|
192
|
+// AndroidWebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
|
|
|
|
193
|
+
|
|
|
|
194
|
+// if (swAvailable && swInterceptAvailable) {
|
|
|
|
195
|
+// AndroidServiceWorkerController serviceWorkerController =
|
|
|
|
196
|
+// AndroidServiceWorkerController.instance();
|
|
|
|
197
|
+
|
|
|
|
198
|
+// serviceWorkerController.serviceWorkerClient =
|
|
|
|
199
|
+// AndroidServiceWorkerClient(
|
|
|
|
200
|
+// shouldInterceptRequest: (request) async {
|
|
|
|
201
|
+// print(request);
|
|
|
|
202
|
+// return null;
|
|
|
|
203
|
+// },
|
|
|
|
204
|
+// );
|
|
|
|
205
|
+// }
|
|
|
|
206
|
+// }
|
|
|
|
207
|
+// // await FlutterDownloader.initialize(
|
|
|
|
208
|
+// // debug: true // optional: set false to disable printing logs to console
|
|
|
|
209
|
+// // );
|
|
|
|
210
|
+// // await Permission.storage.request();
|
|
|
|
211
|
+// }
|
|
|
|
212
|
+
|
|
|
|
213
|
+// @override
|
|
366
|
// Widget build(BuildContext context) {
|
214
|
// Widget build(BuildContext context) {
|
|
367
|
-// final Completer<WebViewController> _controller =
|
|
|
|
368
|
-// Completer<WebViewController>();
|
|
|
|
369
|
// return Scaffold(
|
215
|
// return Scaffold(
|
|
370
|
-// appBar: SystemAppBar(title, onTap: () {
|
|
|
|
371
|
-// if (need) {
|
|
|
|
372
|
-// Utils.changeStatusColor(color: MyColours.color_199095);
|
|
|
|
373
|
-// }
|
|
|
|
374
|
-// Navigator.of(context).pop();
|
|
|
|
375
|
-// }),
|
|
|
|
376
|
-// body: WillPopScope(
|
|
|
|
377
|
-// onWillPop: () async {
|
|
|
|
378
|
-// if (need) {
|
216
|
+// // We're using a Builder here so we have a context that is below the Scaffold
|
|
|
|
217
|
+// // to allow calling Scaffold.of(context) so we can show a snackbar.
|
|
|
|
218
|
+// appBar: SystemAppBar(
|
|
|
|
219
|
+// widget.title,
|
|
|
|
220
|
+// onTap: () {
|
|
|
|
221
|
+// if (widget.need) {
|
|
379
|
// Utils.changeStatusColor(color: MyColours.color_199095);
|
222
|
// Utils.changeStatusColor(color: MyColours.color_199095);
|
|
380
|
// }
|
223
|
// }
|
|
381
|
-// return true;
|
224
|
+// Navigator.of(context).pop();
|
|
382
|
// },
|
225
|
// },
|
|
383
|
-// child: WebView(
|
|
|
|
384
|
-// initialUrl: "http://colorcun.com/privacy1.html",
|
|
|
|
385
|
-// javascriptMode: JavascriptMode.unrestricted,
|
|
|
|
386
|
-// onWebViewCreated: (WebViewController webViewController) {
|
|
|
|
387
|
-// // Loading.showLoading(context);
|
|
|
|
388
|
-// _controller.complete(webViewController);
|
|
|
|
389
|
-// },
|
|
|
|
390
|
-// javascriptChannels: <JavascriptChannel>[
|
|
|
|
391
|
-// _toasterJavascriptChannel(context),
|
|
|
|
392
|
-// ].toSet(),
|
|
|
|
393
|
-// navigationDelegate: (NavigationRequest request) {
|
|
|
|
394
|
-// if (request.url.startsWith('https://www.youtube.com/')) {
|
|
|
|
395
|
-// return NavigationDecision.prevent;
|
226
|
+// ),
|
|
|
|
227
|
+// body: WillPopScope(
|
|
|
|
228
|
+// onWillPop: () async {
|
|
|
|
229
|
+// if (widget.need) {
|
|
|
|
230
|
+// Utils.changeStatusColor(color: MyColours.color_199095);
|
|
396
|
// }
|
231
|
// }
|
|
397
|
-// return NavigationDecision.navigate;
|
|
|
|
398
|
-// },
|
|
|
|
399
|
-// onPageStarted: (String url) {},
|
|
|
|
400
|
-// onPageFinished: (String url) {
|
|
|
|
401
|
-// // Loading.hideLoading(context);
|
232
|
+// return true;
|
|
402
|
// },
|
233
|
// },
|
|
403
|
-// gestureNavigationEnabled: true,
|
|
|
|
404
|
-// )),
|
|
|
|
405
|
-// );
|
|
|
|
406
|
-// }
|
234
|
+// child: Column(
|
|
|
|
235
|
+// children: [
|
|
|
|
236
|
+// Expanded(
|
|
|
|
237
|
+// child: InAppWebView(
|
|
|
|
238
|
+// key: webViewKey,
|
|
|
|
239
|
+// // contextMenu: contextMenu,
|
|
|
|
240
|
+// initialUrlRequest: URLRequest(
|
|
|
|
241
|
+// url: Uri.parse("http://colorcun.com/privacy1.html")),
|
|
|
|
242
|
+// // initialFile: "assets/index.html",
|
|
|
|
243
|
+// initialUserScripts: UnmodifiableListView<UserScript>([]),
|
|
|
|
244
|
+// initialOptions: options,
|
|
|
|
245
|
+// pullToRefreshController: pullToRefreshController,
|
|
|
|
246
|
+// onWebViewCreated: (controller) {
|
|
|
|
247
|
+// webViewController = controller;
|
|
|
|
248
|
+// },
|
|
|
|
249
|
+// onLoadStart: (controller, url) {
|
|
|
|
250
|
+// // setState(() {
|
|
|
|
251
|
+// // this.url = url.toString();
|
|
|
|
252
|
+// // urlController.text = this.url;
|
|
|
|
253
|
+// // });
|
|
|
|
254
|
+// },
|
|
|
|
255
|
+// androidOnPermissionRequest:
|
|
|
|
256
|
+// (controller, origin, resources) async {
|
|
|
|
257
|
+// // return PermissionRequestResponse(
|
|
|
|
258
|
+// // resources: resources,
|
|
|
|
259
|
+// // action: PermissionRequestResponseAction.GRANT);
|
|
|
|
260
|
+// },
|
|
|
|
261
|
+// shouldOverrideUrlLoading:
|
|
|
|
262
|
+// (controller, navigationAction) async {
|
|
|
|
263
|
+// var uri = navigationAction.request.url;
|
|
|
|
264
|
+
|
|
|
|
265
|
+// if (![
|
|
|
|
266
|
+// "http",
|
|
|
|
267
|
+// "https",
|
|
|
|
268
|
+// "file",
|
|
|
|
269
|
+// "chrome",
|
|
|
|
270
|
+// "data",
|
|
|
|
271
|
+// "javascript",
|
|
|
|
272
|
+// "about"
|
|
|
|
273
|
+// ].contains(uri.scheme)) {
|
|
|
|
274
|
+// if (await canLaunch(url)) {
|
|
|
|
275
|
+// // Launch the App
|
|
|
|
276
|
+// await launch(
|
|
|
|
277
|
+// url,
|
|
|
|
278
|
+// );
|
|
|
|
279
|
+// // and cancel the request
|
|
|
|
280
|
+// return NavigationActionPolicy.CANCEL;
|
|
|
|
281
|
+// }
|
|
|
|
282
|
+// }
|
|
407
|
|
283
|
|
|
408
|
-// JavascriptChannel _toasterJavascriptChannel(BuildContext context) {
|
|
|
|
409
|
-// return JavascriptChannel(
|
|
|
|
410
|
-// name: 'Toaster',
|
|
|
|
411
|
-// onMessageReceived: (JavascriptMessage message) {
|
|
|
|
412
|
-// Scaffold.of(context).showSnackBar(
|
|
|
|
413
|
-// SnackBar(content: Text(message.message)),
|
|
|
|
414
|
-// );
|
|
|
|
415
|
-// });
|
284
|
+// return NavigationActionPolicy.ALLOW;
|
|
|
|
285
|
+// },
|
|
|
|
286
|
+// onLoadStop: (controller, url) async {
|
|
|
|
287
|
+// // pullToRefreshController.endRefreshing();
|
|
|
|
288
|
+// // setState(() {
|
|
|
|
289
|
+// // this.url = url.toString();
|
|
|
|
290
|
+// // urlController.text = this.url;
|
|
|
|
291
|
+// // });
|
|
|
|
292
|
+// },
|
|
|
|
293
|
+// onLoadError: (controller, url, code, message) {
|
|
|
|
294
|
+// pullToRefreshController.endRefreshing();
|
|
|
|
295
|
+// },
|
|
|
|
296
|
+// onProgressChanged: (controller, progress) {
|
|
|
|
297
|
+// // if (progress == 100) {
|
|
|
|
298
|
+// pullToRefreshController.endRefreshing();
|
|
|
|
299
|
+// // }
|
|
|
|
300
|
+// // setState(() {
|
|
|
|
301
|
+// // this.progress = progress / 100;
|
|
|
|
302
|
+// // urlController.text = this.url;
|
|
|
|
303
|
+// // });
|
|
|
|
304
|
+// },
|
|
|
|
305
|
+// onUpdateVisitedHistory: (controller, url, androidIsReload) {
|
|
|
|
306
|
+// // setState(() {
|
|
|
|
307
|
+// // this.url = url.toString();
|
|
|
|
308
|
+// // urlController.text = this.url;
|
|
|
|
309
|
+// // });
|
|
|
|
310
|
+// },
|
|
|
|
311
|
+// onConsoleMessage: (controller, consoleMessage) {
|
|
|
|
312
|
+// print(consoleMessage);
|
|
|
|
313
|
+// },
|
|
|
|
314
|
+// onDownloadStart: (controller, url) async {
|
|
|
|
315
|
+// // print("onDownloadStart $url");
|
|
|
|
316
|
+// // Utils.showToast('开始下载...');
|
|
|
|
317
|
+// // // final taskId = await FlutterDownloader.enqueue(
|
|
|
|
318
|
+// // // url: url.toString(),
|
|
|
|
319
|
+// // // savedDir: (await getExternalStorageDirectory()).path,
|
|
|
|
320
|
+// // // showNotification:
|
|
|
|
321
|
+// // // true, // show download progress in status bar (for Android)
|
|
|
|
322
|
+// // // openFileFromNotification:
|
|
|
|
323
|
+// // // true, // click on notification to open downloaded file (for Android)
|
|
|
|
324
|
+// // // );
|
|
|
|
325
|
+// // final dir = await getExternalStorageDirectory();
|
|
|
|
326
|
+// // String savePath = dir.path + "/one_key";
|
|
|
|
327
|
+
|
|
|
|
328
|
+// // Directory directory = new Directory(savePath);
|
|
|
|
329
|
+// // if (directory.existsSync()) {
|
|
|
|
330
|
+// // //删除历史apk
|
|
|
|
331
|
+// // final List<FileSystemEntity> files = directory.listSync();
|
|
|
|
332
|
+// // for (FileSystemEntity file in files) {
|
|
|
|
333
|
+// // file.deleteSync();
|
|
|
|
334
|
+// // }
|
|
|
|
335
|
+// // }
|
|
|
|
336
|
+// // DioUtil().download(url.toString(), savePath,
|
|
|
|
337
|
+// // onProgress: (received, total) {
|
|
|
|
338
|
+// // // if (_progress != 100) {
|
|
|
|
339
|
+// // // int progress = ((received / total) * 100).round();
|
|
|
|
340
|
+// // // _progress = progress;
|
|
|
|
341
|
+// // // _setState(() {});
|
|
|
|
342
|
+// // // }
|
|
|
|
343
|
+// // if (received == total) {
|
|
|
|
344
|
+// // print('object');
|
|
|
|
345
|
+// // Utils.showToast('文件已保存在${savePath}');
|
|
|
|
346
|
+// // // openFile(savePath);
|
|
|
|
347
|
+// // //下载完成
|
|
|
|
348
|
+// // // InstallPlugin.installApk(savePath, "com.naji.one_key");
|
|
|
|
349
|
+// // }
|
|
|
|
350
|
+// // });
|
|
|
|
351
|
+// // // },
|
|
|
|
352
|
+// // // DioUtil().download(url.toString(),
|
|
|
|
353
|
+// // // (await getExternalStorageDirectory()).path,
|
|
|
|
354
|
+// // // onProgress: (received, total) {
|
|
|
|
355
|
+// // // // if (_progress != 100) {
|
|
|
|
356
|
+// // // // int progress = ((received / total) * 100).round();
|
|
|
|
357
|
+// // // // _progress = progress;
|
|
|
|
358
|
+// // // // _setState(() {});
|
|
|
|
359
|
+// // // // }
|
|
|
|
360
|
+// // // if (received == total) {
|
|
|
|
361
|
+// // // //下载完成
|
|
|
|
362
|
+// // // // InstallPlugin.installApk(savePath, "com.naji.one_key");
|
|
|
|
363
|
+// // // }
|
|
|
|
364
|
+// // // });
|
|
|
|
365
|
+// },
|
|
|
|
366
|
+// ))
|
|
|
|
367
|
+// ],
|
|
|
|
368
|
+// )
|
|
|
|
369
|
+// // Builder(builder: (BuildContext context) {
|
|
|
|
370
|
+// // return WebView(
|
|
|
|
371
|
+// // initialUrl: "http://colorcun.com/privacy1.html",
|
|
|
|
372
|
+// // javascriptMode: JavascriptMode.unrestricted,
|
|
|
|
373
|
+// // onWebViewCreated: (WebViewController webViewController) {
|
|
|
|
374
|
+// // _controller.complete(webViewController);
|
|
|
|
375
|
+// // },
|
|
|
|
376
|
+// // // TODO(iskakaushik): Remove this when collection literals makes it to stable.
|
|
|
|
377
|
+// // // ignore: prefer_collection_literals
|
|
|
|
378
|
+// // javascriptChannels: <JavascriptChannel>[
|
|
|
|
379
|
+// // _toasterJavascriptChannel(context),
|
|
|
|
380
|
+// // ].toSet(),
|
|
|
|
381
|
+// // navigationDelegate: (NavigationRequest request) {
|
|
|
|
382
|
+// // if (request.url.startsWith('https://www.youtube.com/')) {
|
|
|
|
383
|
+// // print('blocking navigation to $request}');
|
|
|
|
384
|
+// // return NavigationDecision.prevent;
|
|
|
|
385
|
+// // }
|
|
|
|
386
|
+// // print('allowing navigation to $request');
|
|
|
|
387
|
+// // return NavigationDecision.navigate;
|
|
|
|
388
|
+// // },
|
|
|
|
389
|
+// // onPageStarted: (String url) {
|
|
|
|
390
|
+// // print('Page started loading: $url');
|
|
|
|
391
|
+// // },
|
|
|
|
392
|
+// // onPageFinished: (String url) async {
|
|
|
|
393
|
+// // print('Page finished loading: $url');
|
|
|
|
394
|
+// // // showDownloadProgress(context);
|
|
|
|
395
|
+// // final dir = await getExternalStorageDirectory();
|
|
|
|
396
|
+// // String savePath = dir.path + "/one_key";
|
|
|
|
397
|
+// // DioUtil().download(url, savePath,
|
|
|
|
398
|
+// // onProgress: (received, total) {
|
|
|
|
399
|
+// // // if (_progress != 100) {
|
|
|
|
400
|
+// // // int progress = ((received / total) * 100).round();
|
|
|
|
401
|
+// // // _progress = progress;
|
|
|
|
402
|
+// // // _setState(() {});
|
|
|
|
403
|
+// // // }
|
|
|
|
404
|
+// // if (received == total) {
|
|
|
|
405
|
+// // print('object');
|
|
|
|
406
|
+// // //下载完成
|
|
|
|
407
|
+// // // InstallPlugin.installApk(savePath, "com.naji.one_key");
|
|
|
|
408
|
+// // }
|
|
|
|
409
|
+// // });
|
|
|
|
410
|
+// // },
|
|
|
|
411
|
+// // gestureNavigationEnabled: true,
|
|
|
|
412
|
+// // );
|
|
|
|
413
|
+// // }),
|
|
|
|
414
|
+// ));
|
|
416
|
// }
|
415
|
// }
|
|
|
|
416
|
+
|
|
|
|
417
|
+// // JavascriptChannel _toasterJavascriptChannel(BuildContext context) {
|
|
|
|
418
|
+// // return JavascriptChannel(
|
|
|
|
419
|
+// // name: 'Toaster',
|
|
|
|
420
|
+// // onMessageReceived: (JavascriptMessage message) {
|
|
|
|
421
|
+// // Scaffold.of(context).showSnackBar(
|
|
|
|
422
|
+// // SnackBar(content: Text(message.message)),
|
|
|
|
423
|
+// // );
|
|
|
|
424
|
+// // });
|
|
|
|
425
|
+// // }
|
|
417
|
// }
|
426
|
// }
|
|
|
|
427
|
+
|
|
|
|
428
|
+// // class WebPage extends StatelessWidget {
|
|
|
|
429
|
+// // final String title;
|
|
|
|
430
|
+// // final String url;
|
|
|
|
431
|
+// // final bool need;
|
|
|
|
432
|
+
|
|
|
|
433
|
+// // const WebPage({Key key, this.title, this.url, this.need = false})
|
|
|
|
434
|
+// // : super(key: key);
|
|
|
|
435
|
+// // @override
|
|
|
|
436
|
+// // Widget build(BuildContext context) {
|
|
|
|
437
|
+// // final Completer<WebViewController> _controller =
|
|
|
|
438
|
+// // Completer<WebViewController>();
|
|
|
|
439
|
+// // return Scaffold(
|
|
|
|
440
|
+// // appBar: SystemAppBar(title, onTap: () {
|
|
|
|
441
|
+// // if (need) {
|
|
|
|
442
|
+// // Utils.changeStatusColor(color: MyColours.color_199095);
|
|
|
|
443
|
+// // }
|
|
|
|
444
|
+// // Navigator.of(context).pop();
|
|
|
|
445
|
+// // }),
|
|
|
|
446
|
+// // body: WillPopScope(
|
|
|
|
447
|
+// // onWillPop: () async {
|
|
|
|
448
|
+// // if (need) {
|
|
|
|
449
|
+// // Utils.changeStatusColor(color: MyColours.color_199095);
|
|
|
|
450
|
+// // }
|
|
|
|
451
|
+// // return true;
|
|
|
|
452
|
+// // },
|
|
|
|
453
|
+// // child: WebView(
|
|
|
|
454
|
+// // initialUrl: "http://colorcun.com/privacy1.html",
|
|
|
|
455
|
+// // javascriptMode: JavascriptMode.unrestricted,
|
|
|
|
456
|
+// // onWebViewCreated: (WebViewController webViewController) {
|
|
|
|
457
|
+// // // Loading.showLoading(context);
|
|
|
|
458
|
+// // _controller.complete(webViewController);
|
|
|
|
459
|
+// // },
|
|
|
|
460
|
+// // javascriptChannels: <JavascriptChannel>[
|
|
|
|
461
|
+// // _toasterJavascriptChannel(context),
|
|
|
|
462
|
+// // ].toSet(),
|
|
|
|
463
|
+// // navigationDelegate: (NavigationRequest request) {
|
|
|
|
464
|
+// // if (request.url.startsWith('https://www.youtube.com/')) {
|
|
|
|
465
|
+// // return NavigationDecision.prevent;
|
|
|
|
466
|
+// // }
|
|
|
|
467
|
+// // return NavigationDecision.navigate;
|
|
|
|
468
|
+// // },
|
|
|
|
469
|
+// // onPageStarted: (String url) {},
|
|
|
|
470
|
+// // onPageFinished: (String url) {
|
|
|
|
471
|
+// // // Loading.hideLoading(context);
|
|
|
|
472
|
+// // },
|
|
|
|
473
|
+// // gestureNavigationEnabled: true,
|
|
|
|
474
|
+// // )),
|
|
|
|
475
|
+// // );
|
|
|
|
476
|
+// // }
|
|
|
|
477
|
+
|
|
|
|
478
|
+// // JavascriptChannel _toasterJavascriptChannel(BuildContext context) {
|
|
|
|
479
|
+// // return JavascriptChannel(
|
|
|
|
480
|
+// // name: 'Toaster',
|
|
|
|
481
|
+// // onMessageReceived: (JavascriptMessage message) {
|
|
|
|
482
|
+// // Scaffold.of(context).showSnackBar(
|
|
|
|
483
|
+// // SnackBar(content: Text(message.message)),
|
|
|
|
484
|
+// // );
|
|
|
|
485
|
+// // });
|
|
|
|
486
|
+// // }
|
|
|
|
487
|
+// // } |