Skip to content

Commit

Permalink
[webview_flutter] Add zoomEnabled to webview flutter platform interfa…
Browse files Browse the repository at this point in the history
…ce (flutter#4404)

This is the first-step task to add a zoomEnabled param on the WebView widget.
  • Loading branch information
NickalasB authored Oct 5, 2021
1 parent dc7b864 commit 0558169
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.0

* Add `zoomEnabled` functionality to `WebSettings`.

## 1.0.0

* Extracted platform interface from `webview_flutter`.
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class MethodChannelWebViewPlatform implements WebViewPlatformController {
_addIfNonNull(
'allowsInlineMediaPlayback', settings.allowsInlineMediaPlayback);
_addSettingIfPresent('userAgent', settings.userAgent);
_addIfNonNull('zoomEnabled', settings.zoomEnabled);
return map;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class WebSettings {
this.debuggingEnabled,
this.gestureNavigationEnabled,
this.allowsInlineMediaPlayback,
this.zoomEnabled,
required this.userAgent,
}) : assert(userAgent != null);

Expand Down Expand Up @@ -111,6 +112,9 @@ class WebSettings {
/// See also [WebView.userAgent].
final WebSetting<String?> userAgent;

/// Sets whether the WebView should support zooming using its on-screen zoom controls and gestures.
final bool? zoomEnabled;

/// Whether to allow swipe based navigation in iOS.
///
/// See also: [WebView.gestureNavigationEnabled]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/packages/webview_flut
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview_flutter%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 1.0.0
version: 1.1.0

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';

import 'package:webview_flutter_platform_interface/src/method_channel/webview_method_channel.dart';
import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart';

Expand Down Expand Up @@ -229,6 +228,7 @@ void main() {
debuggingEnabled: true,
gestureNavigationEnabled: true,
allowsInlineMediaPlayback: true,
zoomEnabled: false,
);
await webViewPlatform.updateSettings(settings);

Expand All @@ -245,6 +245,7 @@ void main() {
'debuggingEnabled': true,
'gestureNavigationEnabled': true,
'allowsInlineMediaPlayback': true,
'zoomEnabled': false,
},
),
],
Expand Down

0 comments on commit 0558169

Please sign in to comment.