Skip to content

Commit 1d03c58

Browse files
authored
Merge pull request #401 from justsoft/master
Exposes displayZoomControls, withOverviewMode and useWideViewPort set…
2 parents 90f7cf4 + 7e2cef1 commit 1d03c58

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ Future<Null> launch(String url, {
193193
bool supportMultipleWindows: false,
194194
bool appCacheEnabled: false,
195195
bool allowFileURLs: false,
196+
bool displayZoomControls: false,
197+
bool useWideViewPort: false,
198+
bool withOverviewMode: false,
196199
});
197200
```
198201

android/src/main/java/com/flutter_webview_plugin/FlutterWebviewPlugin.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ private void openUrl(MethodCall call, MethodChannel.Result result) {
9393
boolean clearCache = call.argument("clearCache");
9494
boolean clearCookies = call.argument("clearCookies");
9595
boolean withZoom = call.argument("withZoom");
96+
boolean displayZoomControls = call.argument("displayZoomControls");
9697
boolean withLocalStorage = call.argument("withLocalStorage");
98+
boolean withOverviewMode = call.argument("withOverviewMode");
9799
boolean supportMultipleWindows = call.argument("supportMultipleWindows");
98100
boolean appCacheEnabled = call.argument("appCacheEnabled");
99101
Map<String, String> headers = call.argument("headers");
@@ -120,7 +122,9 @@ private void openUrl(MethodCall call, MethodChannel.Result result) {
120122
url,
121123
headers,
122124
withZoom,
125+
displayZoomControls,
123126
withLocalStorage,
127+
withOverviewMode,
124128
scrollBar,
125129
supportMultipleWindows,
126130
appCacheEnabled,

android/src/main/java/com/flutter_webview_plugin/WebviewManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ void openUrl(
343343
String url,
344344
Map<String, String> headers,
345345
boolean withZoom,
346+
boolean displayZoomControls,
346347
boolean withLocalStorage,
348+
boolean withOverviewMode,
347349
boolean scrollBar,
348350
boolean supportMultipleWindows,
349351
boolean appCacheEnabled,
@@ -356,7 +358,9 @@ void openUrl(
356358
webView.getSettings().setJavaScriptEnabled(withJavascript);
357359
webView.getSettings().setBuiltInZoomControls(withZoom);
358360
webView.getSettings().setSupportZoom(withZoom);
361+
webView.getSettings().setDisplayZoomControls(displayZoomControls);
359362
webView.getSettings().setDomStorageEnabled(withLocalStorage);
363+
webView.getSettings().setLoadWithOverviewMode(withOverviewMode);
360364
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(supportMultipleWindows);
361365

362366
webView.getSettings().setSupportMultipleWindows(supportMultipleWindows);

lib/src/base.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ class FlutterWebviewPlugin {
111111
/// - [invalidUrlRegex] is the regular expression of URLs that web view shouldn't load.
112112
/// For example, when webview is redirected to a specific URL, you want to intercept
113113
/// this process by stopping loading this URL and replacing webview by another screen.
114+
/// Android only settings:
115+
/// - [displayZoomControls]: display zoom controls on webview
116+
/// - [withOverviewMode]: enable overview mode for Android webview ( setLoadWithOverviewMode )
117+
/// - [useWideViewPort]: use wide viewport for Android webview ( setUseWideViewPort )
114118
Future<Null> launch(String url, {
115119
Map<String, String> headers,
116120
bool withJavascript,
@@ -121,8 +125,10 @@ class FlutterWebviewPlugin {
121125
Rect rect,
122126
String userAgent,
123127
bool withZoom,
128+
bool displayZoomControls,
124129
bool withLocalStorage,
125130
bool withLocalUrl,
131+
bool withOverviewMode,
126132
bool scrollBar,
127133
bool supportMultipleWindows,
128134
bool appCacheEnabled,
@@ -141,6 +147,7 @@ class FlutterWebviewPlugin {
141147
'enableAppScheme': enableAppScheme ?? true,
142148
'userAgent': userAgent,
143149
'withZoom': withZoom ?? false,
150+
'displayZoomControls': displayZoomControls ?? false,
144151
'withLocalStorage': withLocalStorage ?? true,
145152
'withLocalUrl': withLocalUrl ?? false,
146153
'scrollBar': scrollBar ?? true,
@@ -150,6 +157,7 @@ class FlutterWebviewPlugin {
150157
'useWideViewPort': useWideViewPort ?? false,
151158
'invalidUrlRegex': invalidUrlRegex,
152159
'geolocationEnabled': geolocationEnabled ?? false,
160+
'withOverviewMode': withOverviewMode ?? false,
153161
'debuggingEnabled': debuggingEnabled ?? false,
154162
};
155163

lib/src/webview_scaffold.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ class WebviewScaffold extends StatefulWidget {
2222
this.persistentFooterButtons,
2323
this.bottomNavigationBar,
2424
this.withZoom,
25+
this.displayZoomControls,
2526
this.withLocalStorage,
2627
this.withLocalUrl,
28+
this.withOverviewMode,
29+
this.useWideViewPort,
2730
this.scrollBar,
2831
this.supportMultipleWindows,
2932
this.appCacheEnabled,
@@ -48,6 +51,7 @@ class WebviewScaffold extends StatefulWidget {
4851
final List<Widget> persistentFooterButtons;
4952
final Widget bottomNavigationBar;
5053
final bool withZoom;
54+
final bool displayZoomControls;
5155
final bool withLocalStorage;
5256
final bool withLocalUrl;
5357
final bool scrollBar;
@@ -59,6 +63,8 @@ class WebviewScaffold extends StatefulWidget {
5963
final bool resizeToAvoidBottomInset;
6064
final String invalidUrlRegex;
6165
final bool geolocationEnabled;
66+
final bool withOverviewMode;
67+
final bool useWideViewPort;
6268
final bool debuggingEnabled;
6369

6470
@override
@@ -148,8 +154,11 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
148154
userAgent: widget.userAgent,
149155
rect: _rect,
150156
withZoom: widget.withZoom,
157+
displayZoomControls: widget.displayZoomControls,
151158
withLocalStorage: widget.withLocalStorage,
152159
withLocalUrl: widget.withLocalUrl,
160+
withOverviewMode: widget.withOverviewMode,
161+
useWideViewPort: widget.useWideViewPort,
153162
scrollBar: widget.scrollBar,
154163
supportMultipleWindows: widget.supportMultipleWindows,
155164
appCacheEnabled: widget.appCacheEnabled,

0 commit comments

Comments
 (0)