Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ Future<Null> launch(String url, {
bool supportMultipleWindows: false,
bool appCacheEnabled: false,
bool allowFileURLs: false,
bool displayZoomControls: false,
bool useWideViewPort: false,
bool withOverviewMode: false,
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ private void openUrl(MethodCall call, MethodChannel.Result result) {
boolean clearCache = call.argument("clearCache");
boolean clearCookies = call.argument("clearCookies");
boolean withZoom = call.argument("withZoom");
boolean displayZoomControls = call.argument("displayZoomControls");
boolean withLocalStorage = call.argument("withLocalStorage");
boolean withOverviewMode = call.argument("withOverviewMode");
boolean supportMultipleWindows = call.argument("supportMultipleWindows");
boolean appCacheEnabled = call.argument("appCacheEnabled");
Map<String, String> headers = call.argument("headers");
Expand All @@ -120,7 +122,9 @@ private void openUrl(MethodCall call, MethodChannel.Result result) {
url,
headers,
withZoom,
displayZoomControls,
withLocalStorage,
withOverviewMode,
scrollBar,
supportMultipleWindows,
appCacheEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,9 @@ void openUrl(
String url,
Map<String, String> headers,
boolean withZoom,
boolean displayZoomControls,
boolean withLocalStorage,
boolean withOverviewMode,
boolean scrollBar,
boolean supportMultipleWindows,
boolean appCacheEnabled,
Expand All @@ -356,7 +358,9 @@ void openUrl(
webView.getSettings().setJavaScriptEnabled(withJavascript);
webView.getSettings().setBuiltInZoomControls(withZoom);
webView.getSettings().setSupportZoom(withZoom);
webView.getSettings().setDisplayZoomControls(displayZoomControls);
webView.getSettings().setDomStorageEnabled(withLocalStorage);
webView.getSettings().setLoadWithOverviewMode(withOverviewMode);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(supportMultipleWindows);

webView.getSettings().setSupportMultipleWindows(supportMultipleWindows);
Expand Down
8 changes: 8 additions & 0 deletions lib/src/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ class FlutterWebviewPlugin {
/// - [invalidUrlRegex] is the regular expression of URLs that web view shouldn't load.
/// For example, when webview is redirected to a specific URL, you want to intercept
/// this process by stopping loading this URL and replacing webview by another screen.
/// Android only settings:
/// - [displayZoomControls]: display zoom controls on webview
/// - [withOverviewMode]: enable overview mode for Android webview ( setLoadWithOverviewMode )
/// - [useWideViewPort]: use wide viewport for Android webview ( setUseWideViewPort )
Future<Null> launch(String url, {
Map<String, String> headers,
bool withJavascript,
Expand All @@ -121,8 +125,10 @@ class FlutterWebviewPlugin {
Rect rect,
String userAgent,
bool withZoom,
bool displayZoomControls,
bool withLocalStorage,
bool withLocalUrl,
bool withOverviewMode,
bool scrollBar,
bool supportMultipleWindows,
bool appCacheEnabled,
Expand All @@ -141,6 +147,7 @@ class FlutterWebviewPlugin {
'enableAppScheme': enableAppScheme ?? true,
'userAgent': userAgent,
'withZoom': withZoom ?? false,
'displayZoomControls': displayZoomControls ?? false,
'withLocalStorage': withLocalStorage ?? true,
'withLocalUrl': withLocalUrl ?? false,
'scrollBar': scrollBar ?? true,
Expand All @@ -150,6 +157,7 @@ class FlutterWebviewPlugin {
'useWideViewPort': useWideViewPort ?? false,
'invalidUrlRegex': invalidUrlRegex,
'geolocationEnabled': geolocationEnabled ?? false,
'withOverviewMode': withOverviewMode ?? false,
'debuggingEnabled': debuggingEnabled ?? false,
};

Expand Down
9 changes: 9 additions & 0 deletions lib/src/webview_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ class WebviewScaffold extends StatefulWidget {
this.persistentFooterButtons,
this.bottomNavigationBar,
this.withZoom,
this.displayZoomControls,
this.withLocalStorage,
this.withLocalUrl,
this.withOverviewMode,
this.useWideViewPort,
this.scrollBar,
this.supportMultipleWindows,
this.appCacheEnabled,
Expand All @@ -48,6 +51,7 @@ class WebviewScaffold extends StatefulWidget {
final List<Widget> persistentFooterButtons;
final Widget bottomNavigationBar;
final bool withZoom;
final bool displayZoomControls;
final bool withLocalStorage;
final bool withLocalUrl;
final bool scrollBar;
Expand All @@ -59,6 +63,8 @@ class WebviewScaffold extends StatefulWidget {
final bool resizeToAvoidBottomInset;
final String invalidUrlRegex;
final bool geolocationEnabled;
final bool withOverviewMode;
final bool useWideViewPort;
final bool debuggingEnabled;

@override
Expand Down Expand Up @@ -148,8 +154,11 @@ class _WebviewScaffoldState extends State<WebviewScaffold> {
userAgent: widget.userAgent,
rect: _rect,
withZoom: widget.withZoom,
displayZoomControls: widget.displayZoomControls,
withLocalStorage: widget.withLocalStorage,
withLocalUrl: widget.withLocalUrl,
withOverviewMode: widget.withOverviewMode,
useWideViewPort: widget.useWideViewPort,
scrollBar: widget.scrollBar,
supportMultipleWindows: widget.supportMultipleWindows,
appCacheEnabled: widget.appCacheEnabled,
Expand Down