99
99
@override
100
100
void initState() {
101
101
super.initState();
102
- controller =
103
- WebViewController() ..loadRequest(Uri.parse('https://flutter.dev'));
102
+ controller = WebViewController()
103
+ ..loadRequest(Uri.parse('https://flutter.dev'));
104
104
}
105
105
106
106
@override
@@ -148,28 +148,27 @@ steps:
148
148
@override
149
149
void initState() {
150
150
super.initState();
151
- controller =
152
- WebViewController()
153
- ..setNavigationDelegate(
154
- NavigationDelegate(
155
- onPageStarted: (url) {
156
- setState(() {
157
- loadingPercentage = 0;
158
- });
159
- },
160
- onProgress: (progress) {
161
- setState(() {
162
- loadingPercentage = progress;
163
- });
164
- },
165
- onPageFinished: (url) {
166
- setState(() {
167
- loadingPercentage = 100;
168
- });
169
- },
170
- ),
171
- )
172
- ..loadRequest(Uri.parse('https://flutter.dev'));
151
+ controller = WebViewController()
152
+ ..setNavigationDelegate(
153
+ NavigationDelegate(
154
+ onPageStarted: (url) {
155
+ setState(() {
156
+ loadingPercentage = 0;
157
+ });
158
+ },
159
+ onProgress: (progress) {
160
+ setState(() {
161
+ loadingPercentage = progress;
162
+ });
163
+ },
164
+ onPageFinished: (url) {
165
+ setState(() {
166
+ loadingPercentage = 100;
167
+ });
168
+ },
169
+ ),
170
+ )
171
+ ..loadRequest(Uri.parse('https://flutter.dev'));
173
172
}
174
173
175
174
@override
@@ -207,8 +206,8 @@ steps:
207
206
- @override
208
207
- void initState() {
209
208
- super.initState();
210
- - controller =
211
- - WebViewController() ..loadRequest(Uri.parse('https://flutter.dev'));
209
+ - controller = WebViewController()
210
+ - ..loadRequest(Uri.parse('https://flutter.dev'));
212
211
- }
213
212
-
214
213
@override
@@ -309,8 +308,8 @@ steps:
309
308
+ @override
310
309
+ void initState() {
311
310
+ super.initState();
312
- + controller =
313
- + WebViewController() ..loadRequest(Uri.parse('https://flutter.dev'));
311
+ + controller = WebViewController()
312
+ + ..loadRequest(Uri.parse('https://flutter.dev'));
314
313
+ }
315
314
+
316
315
@override
@@ -342,7 +341,7 @@ steps:
342
341
343
342
@override
344
343
State<WebViewStack> createState() => _WebViewStackState();
345
- @@ -14,40 +16,36 @@ class WebViewStack extends StatefulWidget {
344
+ @@ -14,39 +16,36 @@ class WebViewStack extends StatefulWidget {
346
345
347
346
class _WebViewStackState extends State<WebViewStack> {
348
347
var loadingPercentage = 0;
@@ -351,28 +350,27 @@ steps:
351
350
@override
352
351
void initState() {
353
352
super.initState();
354
- - controller =
355
- - WebViewController()
356
- - ..setNavigationDelegate(
357
- - NavigationDelegate(
358
- - onPageStarted: (url) {
359
- - setState(() {
360
- - loadingPercentage = 0;
361
- - });
362
- - },
363
- - onProgress: (progress) {
364
- - setState(() {
365
- - loadingPercentage = progress;
366
- - });
367
- - },
368
- - onPageFinished: (url) {
369
- - setState(() {
370
- - loadingPercentage = 100;
371
- - });
372
- - },
373
- - ),
374
- - )
375
- - ..loadRequest(Uri.parse('https://flutter.dev'));
353
+ - controller = WebViewController()
354
+ - ..setNavigationDelegate(
355
+ - NavigationDelegate(
356
+ - onPageStarted: (url) {
357
+ - setState(() {
358
+ - loadingPercentage = 0;
359
+ - });
360
+ - },
361
+ - onProgress: (progress) {
362
+ - setState(() {
363
+ - loadingPercentage = progress;
364
+ - });
365
+ - },
366
+ - onPageFinished: (url) {
367
+ - setState(() {
368
+ - loadingPercentage = 100;
369
+ - });
370
+ - },
371
+ - ),
372
+ - )
373
+ - ..loadRequest(Uri.parse('https://flutter.dev'));
376
374
+ widget.controller.setNavigationDelegate(
377
375
+ NavigationDelegate(
378
376
+ onPageStarted: (url) {
@@ -467,13 +465,12 @@ steps:
467
465
await controller.loadRequest(Uri.parse('https://youtube.com'));
468
466
}
469
467
},
470
- itemBuilder:
471
- (context) => [
472
- const PopupMenuItem<_MenuOptions>(
473
- value: _MenuOptions.navigationDelegate,
474
- child: Text('Navigate to YouTube'),
475
- ),
476
- ],
468
+ itemBuilder: (context) => [
469
+ const PopupMenuItem<_MenuOptions>(
470
+ value: _MenuOptions.navigationDelegate,
471
+ child: Text('Navigate to YouTube'),
472
+ ),
473
+ ],
477
474
);
478
475
}
479
476
}
@@ -552,16 +549,16 @@ steps:
552
549
+ ).showSnackBar(SnackBar(content: Text('$userAgent')));
553
550
}
554
551
},
555
- itemBuilder:
556
- @@ -27 ,6 +41 ,10 @@ class Menu extends StatelessWidget {
557
- value: _MenuOptions.navigationDelegate,
558
- child: Text('Navigate to YouTube'),
559
- ),
560
- + const PopupMenuItem<_MenuOptions>(
561
- + value: _MenuOptions.userAgent,
562
- + child: Text('Show user-agent'),
563
- + ),
564
- ],
552
+ itemBuilder: (context) => [
553
+ @@ -26 ,6 +40 ,10 @@ class Menu extends StatelessWidget {
554
+ value: _MenuOptions.navigationDelegate,
555
+ child: Text('Navigate to YouTube'),
556
+ ),
557
+ + const PopupMenuItem<_MenuOptions>(
558
+ + value: _MenuOptions.userAgent,
559
+ + child: Text('Show user-agent'),
560
+ + ),
561
+ ],
565
562
);
566
563
}
567
564
- name : Patch lib/src/web_view_stack.dart
@@ -677,16 +674,16 @@ steps:
677
674
+req.send();''');
678
675
}
679
676
},
680
- itemBuilder:
681
- @@ -45 ,6 +58 ,10 @@ class _MenuState extends State<Menu> {
682
- value: _MenuOptions.userAgent,
683
- child: Text('Show user-agent'),
684
- ),
685
- + const PopupMenuItem<_MenuOptions>(
686
- + value: _MenuOptions.javascriptChannel,
687
- + child: Text('Lookup IP Address'),
688
- + ),
689
- ],
677
+ itemBuilder: (context) => [
678
+ @@ -44 ,6 +57 ,10 @@ class _MenuState extends State<Menu> {
679
+ value: _MenuOptions.userAgent,
680
+ child: Text('Show user-agent'),
681
+ ),
682
+ + const PopupMenuItem<_MenuOptions>(
683
+ + value: _MenuOptions.javascriptChannel,
684
+ + child: Text('Lookup IP Address'),
685
+ + ),
686
+ ],
690
687
);
691
688
}
692
689
- name : Patch lib/src/web_view_stack.dart
@@ -767,32 +764,32 @@ steps:
767
764
+ await _onRemoveCookie(widget.controller);
768
765
}
769
766
},
770
- itemBuilder:
771
- @@ -62 ,7 +83 ,81 @@ req.send();''');
772
- value: _MenuOptions.javascriptChannel,
773
- child: Text('Lookup IP Address'),
774
- ),
775
- + const PopupMenuItem<_MenuOptions>(
776
- + value: _MenuOptions.clearCookies,
777
- + child: Text('Clear cookies'),
778
- + ),
779
- + const PopupMenuItem<_MenuOptions>(
780
- + value: _MenuOptions.listCookies,
781
- + child: Text('List cookies'),
782
- + ),
783
- + const PopupMenuItem<_MenuOptions>(
784
- + value: _MenuOptions.addCookie,
785
- + child: Text('Add cookie'),
786
- + ),
787
- + const PopupMenuItem<_MenuOptions>(
788
- + value: _MenuOptions.setCookie,
789
- + child: Text('Set cookie'),
790
- + ),
791
- + const PopupMenuItem<_MenuOptions>(
792
- + value: _MenuOptions.removeCookie,
793
- + child: Text('Remove cookie'),
794
- + ),
795
- ],
767
+ itemBuilder: (context) => [
768
+ @@ -61 ,7 +82 ,81 @@ req.send();''');
769
+ value: _MenuOptions.javascriptChannel,
770
+ child: Text('Lookup IP Address'),
771
+ ),
772
+ + const PopupMenuItem<_MenuOptions>(
773
+ + value: _MenuOptions.clearCookies,
774
+ + child: Text('Clear cookies'),
775
+ + ),
776
+ + const PopupMenuItem<_MenuOptions>(
777
+ + value: _MenuOptions.listCookies,
778
+ + child: Text('List cookies'),
779
+ + ),
780
+ + const PopupMenuItem<_MenuOptions>(
781
+ + value: _MenuOptions.addCookie,
782
+ + child: Text('Add cookie'),
783
+ + ),
784
+ + const PopupMenuItem<_MenuOptions>(
785
+ + value: _MenuOptions.setCookie,
786
+ + child: Text('Set cookie'),
787
+ + ),
788
+ + const PopupMenuItem<_MenuOptions>(
789
+ + value: _MenuOptions.removeCookie,
790
+ + child: Text('Remove cookie'),
791
+ + ),
792
+ ],
796
793
);
797
794
}
798
795
+
@@ -937,27 +934,27 @@ steps:
937
934
+ await _onLoadHtmlStringExample(widget.controller, context);
938
935
}
939
936
},
940
- itemBuilder:
941
- @@ -103 ,6 +136 ,18 @@ req.send();''');
942
- value: _MenuOptions.removeCookie,
943
- child: Text('Remove cookie'),
944
- ),
945
- + const PopupMenuItem<_MenuOptions>(
946
- + value: _MenuOptions.loadFlutterAsset,
947
- + child: Text('Load Flutter Asset'),
948
- + ),
949
- + const PopupMenuItem<_MenuOptions>(
950
- + value: _MenuOptions.loadHtmlString,
951
- + child: Text('Load HTML string'),
952
- + ),
953
- + const PopupMenuItem<_MenuOptions>(
954
- + value: _MenuOptions.loadLocalFile,
955
- + child: Text('Load local file'),
956
- + ),
957
- ],
937
+ itemBuilder: (context) => [
938
+ @@ -102 ,6 +135 ,18 @@ req.send();''');
939
+ value: _MenuOptions.removeCookie,
940
+ child: Text('Remove cookie'),
941
+ ),
942
+ + const PopupMenuItem<_MenuOptions>(
943
+ + value: _MenuOptions.loadFlutterAsset,
944
+ + child: Text('Load Flutter Asset'),
945
+ + ),
946
+ + const PopupMenuItem<_MenuOptions>(
947
+ + value: _MenuOptions.loadHtmlString,
948
+ + child: Text('Load HTML string'),
949
+ + ),
950
+ + const PopupMenuItem<_MenuOptions>(
951
+ + value: _MenuOptions.loadLocalFile,
952
+ + child: Text('Load local file'),
953
+ + ),
954
+ ],
958
955
);
959
956
}
960
- @@ -160 ,4 +205 ,37 @@ req.send();''');
957
+ @@ -159 ,4 +204 ,37 @@ req.send();''');
961
958
context,
962
959
).showSnackBar(const SnackBar(content: Text('Custom cookie removed.')));
963
960
}
0 commit comments