Skip to content

Commit caa8f92

Browse files
author
hunghd
committed
add support wide view port in Android
1 parent d15cf70 commit caa8f92

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ private void openUrl(MethodCall call, MethodChannel.Result result) {
9797
Map<String, String> headers = call.argument("headers");
9898
boolean scrollBar = call.argument("scrollBar");
9999
boolean allowFileURLs = call.argument("allowFileURLs");
100+
boolean useWideViewPort = call.argument("useWideViewPort");
100101
String invalidUrlRegex = call.argument("invalidUrlRegex");
101102

102103
if (webViewManager == null || webViewManager.closed == true) {
@@ -120,6 +121,7 @@ private void openUrl(MethodCall call, MethodChannel.Result result) {
120121
supportMultipleWindows,
121122
appCacheEnabled,
122123
allowFileURLs,
124+
useWideViewPort,
123125
invalidUrlRegex
124126
);
125127
result.success(null);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ void openUrl(
204204
boolean supportMultipleWindows,
205205
boolean appCacheEnabled,
206206
boolean allowFileURLs,
207+
boolean useWideViewPort,
207208
String invalidUrlRegex
208209
) {
209210
webView.getSettings().setJavaScriptEnabled(withJavascript);
@@ -219,6 +220,8 @@ void openUrl(
219220
webView.getSettings().setAllowFileAccessFromFileURLs(allowFileURLs);
220221
webView.getSettings().setAllowUniversalAccessFromFileURLs(allowFileURLs);
221222

223+
webView.getSettings().setUseWideViewPort(useWideViewPort);
224+
222225
webViewClient.updateInvalidUrlRegex(invalidUrlRegex);
223226

224227
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

lib/src/base.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class FlutterWebviewPlugin {
113113
bool supportMultipleWindows,
114114
bool appCacheEnabled,
115115
bool allowFileURLs,
116+
bool useWideViewPort,
116117
String invalidUrlRegex,
117118
}) async {
118119
final args = <String, dynamic>{
@@ -130,6 +131,7 @@ class FlutterWebviewPlugin {
130131
'supportMultipleWindows': supportMultipleWindows ?? false,
131132
'appCacheEnabled': appCacheEnabled ?? false,
132133
'allowFileURLs': allowFileURLs ?? false,
134+
'useWideViewPort': useWideViewPort ?? false,
133135
'invalidUrlRegex': invalidUrlRegex,
134136
};
135137

0 commit comments

Comments
 (0)