Skip to content

Commit d6d0c06

Browse files
committed
Update webview_flutter
1 parent b224cf7 commit d6d0c06

File tree

21 files changed

+150
-133
lines changed

21 files changed

+150
-133
lines changed

webview_flutter/codelab_rebuild.yaml

Lines changed: 120 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ steps:
9999
@override
100100
void initState() {
101101
super.initState();
102-
controller =
103-
WebViewController()..loadRequest(Uri.parse('https://flutter.dev'));
102+
controller = WebViewController()
103+
..loadRequest(Uri.parse('https://flutter.dev'));
104104
}
105105
106106
@override
@@ -148,28 +148,27 @@ steps:
148148
@override
149149
void initState() {
150150
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'));
173172
}
174173
175174
@override
@@ -207,8 +206,8 @@ steps:
207206
- @override
208207
- void initState() {
209208
- super.initState();
210-
- controller =
211-
- WebViewController()..loadRequest(Uri.parse('https://flutter.dev'));
209+
- controller = WebViewController()
210+
- ..loadRequest(Uri.parse('https://flutter.dev'));
212211
- }
213212
-
214213
@override
@@ -309,8 +308,8 @@ steps:
309308
+ @override
310309
+ void initState() {
311310
+ super.initState();
312-
+ controller =
313-
+ WebViewController()..loadRequest(Uri.parse('https://flutter.dev'));
311+
+ controller = WebViewController()
312+
+ ..loadRequest(Uri.parse('https://flutter.dev'));
314313
+ }
315314
+
316315
@override
@@ -342,7 +341,7 @@ steps:
342341
343342
@override
344343
State<WebViewStack> createState() => _WebViewStackState();
345-
@@ -14,40 +16,36 @@ class WebViewStack extends StatefulWidget {
344+
@@ -14,39 +16,36 @@ class WebViewStack extends StatefulWidget {
346345
347346
class _WebViewStackState extends State<WebViewStack> {
348347
var loadingPercentage = 0;
@@ -351,28 +350,27 @@ steps:
351350
@override
352351
void initState() {
353352
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'));
376374
+ widget.controller.setNavigationDelegate(
377375
+ NavigationDelegate(
378376
+ onPageStarted: (url) {
@@ -467,13 +465,12 @@ steps:
467465
await controller.loadRequest(Uri.parse('https://youtube.com'));
468466
}
469467
},
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+
],
477474
);
478475
}
479476
}
@@ -552,16 +549,16 @@ steps:
552549
+ ).showSnackBar(SnackBar(content: Text('$userAgent')));
553550
}
554551
},
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+
],
565562
);
566563
}
567564
- name: Patch lib/src/web_view_stack.dart
@@ -677,16 +674,16 @@ steps:
677674
+req.send();''');
678675
}
679676
},
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+
],
690687
);
691688
}
692689
- name: Patch lib/src/web_view_stack.dart
@@ -767,32 +764,32 @@ steps:
767764
+ await _onRemoveCookie(widget.controller);
768765
}
769766
},
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+
],
796793
);
797794
}
798795
+
@@ -937,27 +934,27 @@ steps:
937934
+ await _onLoadHtmlStringExample(widget.controller, context);
938935
}
939936
},
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+
],
958955
);
959956
}
960-
@@ -160,4 +205,37 @@ req.send();''');
957+
@@ -159,4 +204,37 @@ req.send();''');
961958
context,
962959
).showSnackBar(const SnackBar(content: Text('Custom cookie removed.')));
963960
}

webview_flutter/step_03/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<MacroExpansion>
3132
<BuildableReference
@@ -54,6 +55,7 @@
5455
buildConfiguration = "Debug"
5556
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5657
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
5759
launchStyle = "0"
5860
useCustomWorkingDirectory = "NO"
5961
ignoresPersistentStateOnLaunch = "NO"

webview_flutter/step_03/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies:
3434
# The following adds the Cupertino Icons font to your application.
3535
# Use with the CupertinoIcons class for iOS style icons.
3636
cupertino_icons: ^1.0.8
37-
webview_flutter: ^4.10.0
37+
webview_flutter: ^4.11.0
3838

3939
dev_dependencies:
4040
flutter_test:

webview_flutter/step_04/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<MacroExpansion>
3132
<BuildableReference
@@ -54,6 +55,7 @@
5455
buildConfiguration = "Debug"
5556
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5657
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
5759
launchStyle = "0"
5860
useCustomWorkingDirectory = "NO"
5961
ignoresPersistentStateOnLaunch = "NO"

webview_flutter/step_04/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies:
3434
# The following adds the Cupertino Icons font to your application.
3535
# Use with the CupertinoIcons class for iOS style icons.
3636
cupertino_icons: ^1.0.8
37-
webview_flutter: ^4.10.0
37+
webview_flutter: ^4.11.0
3838

3939
dev_dependencies:
4040
flutter_test:

webview_flutter/step_05/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<MacroExpansion>
3132
<BuildableReference
@@ -54,6 +55,7 @@
5455
buildConfiguration = "Debug"
5556
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5657
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
5759
launchStyle = "0"
5860
useCustomWorkingDirectory = "NO"
5961
ignoresPersistentStateOnLaunch = "NO"

webview_flutter/step_05/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies:
3434
# The following adds the Cupertino Icons font to your application.
3535
# Use with the CupertinoIcons class for iOS style icons.
3636
cupertino_icons: ^1.0.8
37-
webview_flutter: ^4.10.0
37+
webview_flutter: ^4.11.0
3838

3939
dev_dependencies:
4040
flutter_test:

0 commit comments

Comments
 (0)