Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 0262add

Browse files
committed
Load navigation controls immediately.
Make sure the navigation controls in the example App are loaded immediately but only enable when the WebViewController is available. This is the same behavior as in the example App from the main webview_flutter package.
1 parent cc3c53c commit 0262add

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

packages/webview_flutter/webview_flutter_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.14
2+
3+
* Update example App so navigation menu loads immediatly but only becomes available when `WebViewController` is available (same behavior as example App in webview_flutter package).
4+
15
## 2.0.13
26

37
* Extract Android implementation from `webview_flutter`.

packages/webview_flutter/webview_flutter_android/example/lib/main.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,15 @@ class _NavigationControls extends StatelessWidget {
289289
final bool webViewReady =
290290
snapshot.connectionState == ConnectionState.done;
291291
final WebViewController? controller = snapshot.data;
292-
if (controller == null) return Container();
292+
293293
return Row(
294294
children: <Widget>[
295295
IconButton(
296296
icon: const Icon(Icons.arrow_back_ios),
297297
onPressed: !webViewReady
298298
? null
299299
: () async {
300-
if (await controller.canGoBack()) {
300+
if (await controller!.canGoBack()) {
301301
await controller.goBack();
302302
} else {
303303
// ignore: deprecated_member_use
@@ -313,7 +313,7 @@ class _NavigationControls extends StatelessWidget {
313313
onPressed: !webViewReady
314314
? null
315315
: () async {
316-
if (await controller.canGoForward()) {
316+
if (await controller!.canGoForward()) {
317317
await controller.goForward();
318318
} else {
319319
// ignore: deprecated_member_use
@@ -330,7 +330,7 @@ class _NavigationControls extends StatelessWidget {
330330
onPressed: !webViewReady
331331
? null
332332
: () {
333-
controller.reload();
333+
controller!.reload();
334334
},
335335
),
336336
],

packages/webview_flutter/webview_flutter_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: webview_flutter_android
22
description: A Flutter plugin that provides a WebView widget on Android.
33
repository: https://github.com/flutter/plugins/tree/master/packages/webview_flutter/webview_flutter_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
5-
version: 2.0.13
5+
version: 2.0.14
66

77
environment:
88
sdk: ">=2.14.0 <3.0.0"

0 commit comments

Comments
 (0)