Prechádzať zdrojové kódy

add support wide view port in Android

hunghd 7 rokov pred
rodič
commit
b277e8a512

+ 2 - 0
android/src/main/java/com/flutter_webview_plugin/FlutterWebviewPlugin.java

@@ -97,6 +97,7 @@ public class FlutterWebviewPlugin implements MethodCallHandler, PluginRegistry.A
         Map<String, String> headers = call.argument("headers");
         boolean scrollBar = call.argument("scrollBar");
         boolean allowFileURLs = call.argument("allowFileURLs");
+        boolean useWideViewPort = call.argument("useWideViewPort");
         String invalidUrlRegex = call.argument("invalidUrlRegex");
 
         if (webViewManager == null || webViewManager.closed == true) {
@@ -120,6 +121,7 @@ public class FlutterWebviewPlugin implements MethodCallHandler, PluginRegistry.A
                 supportMultipleWindows,
                 appCacheEnabled,
                 allowFileURLs,
+                useWideViewPort,
                 invalidUrlRegex
         );
         result.success(null);

+ 3 - 0
android/src/main/java/com/flutter_webview_plugin/WebviewManager.java

@@ -204,6 +204,7 @@ class WebviewManager {
             boolean supportMultipleWindows,
             boolean appCacheEnabled,
             boolean allowFileURLs,
+            boolean useWideViewPort,
             String invalidUrlRegex
     ) {
         webView.getSettings().setJavaScriptEnabled(withJavascript);
@@ -219,6 +220,8 @@ class WebviewManager {
         webView.getSettings().setAllowFileAccessFromFileURLs(allowFileURLs);
         webView.getSettings().setAllowUniversalAccessFromFileURLs(allowFileURLs);
 
+        webView.getSettings().setUseWideViewPort(useWideViewPort);
+
         webViewClient.updateInvalidUrlRegex(invalidUrlRegex);
 
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

+ 2 - 0
lib/src/base.dart

@@ -113,6 +113,7 @@ class FlutterWebviewPlugin {
     bool supportMultipleWindows,
     bool appCacheEnabled,
     bool allowFileURLs,
+    bool useWideViewPort,
     String invalidUrlRegex,
   }) async {
     final args = <String, dynamic>{
@@ -130,6 +131,7 @@ class FlutterWebviewPlugin {
       'supportMultipleWindows': supportMultipleWindows ?? false,
       'appCacheEnabled': appCacheEnabled ?? false,
       'allowFileURLs': allowFileURLs ?? false,
+      'useWideViewPort': useWideViewPort ?? false,
       'invalidUrlRegex': invalidUrlRegex,
     };