diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java index e75bfbc1..edb19192 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserActivity.java @@ -31,7 +31,7 @@ import com.pichillilorenzo.flutter_inappwebview.in_app_webview.InAppWebView; import com.pichillilorenzo.flutter_inappwebview.in_app_webview.InAppWebViewChromeClient; import com.pichillilorenzo.flutter_inappwebview.in_app_webview.InAppWebViewSettings; import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshLayout; -import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshOptions; +import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshSettings; import com.pichillilorenzo.flutter_inappwebview.types.URLRequest; import com.pichillilorenzo.flutter_inappwebview.types.UserScript; @@ -81,13 +81,13 @@ public class InAppBrowserActivity extends AppCompatActivity implements InAppBrow setContentView(R.layout.activity_web_view); - Map pullToRefreshInitialOptions = (Map) b.getSerializable("pullToRefreshInitialOptions"); + Map pullToRefreshInitialSettings = (Map) b.getSerializable("pullToRefreshInitialSettings"); MethodChannel pullToRefreshLayoutChannel = new MethodChannel(manager.plugin.messenger, "com.pichillilorenzo/flutter_inappwebview_pull_to_refresh_" + id); - PullToRefreshOptions pullToRefreshOptions = new PullToRefreshOptions(); - pullToRefreshOptions.parse(pullToRefreshInitialOptions); + PullToRefreshSettings pullToRefreshSettings = new PullToRefreshSettings(); + pullToRefreshSettings.parse(pullToRefreshInitialSettings); pullToRefreshLayout = findViewById(R.id.pullToRefresh); pullToRefreshLayout.channel = pullToRefreshLayoutChannel; - pullToRefreshLayout.options = pullToRefreshOptions; + pullToRefreshLayout.options = pullToRefreshSettings; pullToRefreshLayout.prepare(); webView = findViewById(R.id.webView); diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserManager.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserManager.java index 8a5d8a75..abe89189 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserManager.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_browser/InAppBrowserManager.java @@ -174,7 +174,7 @@ public class InAppBrowserManager implements MethodChannel.MethodCallHandler { Map contextMenu = (Map) arguments.get("contextMenu"); Integer windowId = (Integer) arguments.get("windowId"); List> initialUserScripts = (List>) arguments.get("initialUserScripts"); - Map pullToRefreshInitialOptions = (Map) arguments.get("pullToRefreshOptions"); + Map pullToRefreshInitialSettings = (Map) arguments.get("pullToRefreshSettings"); Bundle extras = new Bundle(); extras.putString("fromActivity", activity.getClass().getName()); @@ -191,7 +191,7 @@ public class InAppBrowserManager implements MethodChannel.MethodCallHandler { extras.putSerializable("contextMenu", (Serializable) contextMenu); extras.putInt("windowId", windowId != null ? windowId : -1); extras.putSerializable("initialUserScripts", (Serializable) initialUserScripts); - extras.putSerializable("pullToRefreshInitialOptions", (Serializable) pullToRefreshInitialOptions); + extras.putSerializable("pullToRefreshInitialSettings", (Serializable) pullToRefreshInitialSettings); startInAppBrowserActivity(activity, extras); } diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/FlutterWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/FlutterWebView.java index 8f165019..bf0d0629 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/FlutterWebView.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/FlutterWebView.java @@ -21,7 +21,7 @@ import com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin; import com.pichillilorenzo.flutter_inappwebview.InAppWebViewMethodHandler; import com.pichillilorenzo.flutter_inappwebview.plugin_scripts_js.JavaScriptBridgeJS; import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshLayout; -import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshOptions; +import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshSettings; import com.pichillilorenzo.flutter_inappwebview.types.PlatformWebView; import com.pichillilorenzo.flutter_inappwebview.types.URLRequest; import com.pichillilorenzo.flutter_inappwebview.types.UserScript; @@ -55,7 +55,7 @@ public class FlutterWebView implements PlatformWebView { Map contextMenu = (Map) params.get("contextMenu"); Integer windowId = (Integer) params.get("windowId"); List> initialUserScripts = (List>) params.get("initialUserScripts"); - Map pullToRefreshInitialOptions = (Map) params.get("pullToRefreshOptions"); + Map pullToRefreshInitialSettings = (Map) params.get("pullToRefreshSettings"); InAppWebViewSettings options = new InAppWebViewSettings(); options.parse(initialSettings); @@ -81,9 +81,9 @@ public class FlutterWebView implements PlatformWebView { // set MATCH_PARENT layout params to the WebView, otherwise it won't take all the available space! webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); MethodChannel pullToRefreshLayoutChannel = new MethodChannel(plugin.messenger, "com.pichillilorenzo/flutter_inappwebview_pull_to_refresh_" + id); - PullToRefreshOptions pullToRefreshOptions = new PullToRefreshOptions(); - pullToRefreshOptions.parse(pullToRefreshInitialOptions); - pullToRefreshLayout = new PullToRefreshLayout(context, pullToRefreshLayoutChannel, pullToRefreshOptions); + PullToRefreshSettings pullToRefreshSettings = new PullToRefreshSettings(); + pullToRefreshSettings.parse(pullToRefreshInitialSettings); + pullToRefreshLayout = new PullToRefreshLayout(context, pullToRefreshLayoutChannel, pullToRefreshSettings); pullToRefreshLayout.addView(webView); pullToRefreshLayout.prepare(); } diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshLayout.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshLayout.java index 24e29db4..8a53df17 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshLayout.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshLayout.java @@ -21,9 +21,9 @@ public class PullToRefreshLayout extends SwipeRefreshLayout implements MethodCha static final String LOG_TAG = "PullToRefreshLayout"; public MethodChannel channel; - public PullToRefreshOptions options; + public PullToRefreshSettings options; - public PullToRefreshLayout(@NonNull Context context, @NonNull MethodChannel channel, @NonNull PullToRefreshOptions options) { + public PullToRefreshLayout(@NonNull Context context, @NonNull MethodChannel channel, @NonNull PullToRefreshSettings options) { super(context); this.channel = channel; this.options = options; diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshOptions.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshSettings.java similarity index 68% rename from android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshOptions.java rename to android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshSettings.java index 20d47e5b..4a13c943 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshOptions.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/pull_to_refresh/PullToRefreshSettings.java @@ -7,8 +7,8 @@ import com.pichillilorenzo.flutter_inappwebview.IWebViewSettings; import java.util.HashMap; import java.util.Map; -public class PullToRefreshOptions implements IWebViewSettings { - public static final String LOG_TAG = "PullToRefreshOptions"; +public class PullToRefreshSettings implements IWebViewSettings { + public static final String LOG_TAG = "PullToRefreshSettings"; public Boolean enabled = true; @Nullable @@ -22,7 +22,7 @@ public class PullToRefreshOptions implements IWebViewSettings options) { + public PullToRefreshSettings parse(Map options) { for (Map.Entry pair : options.entrySet()) { String key = pair.getKey(); Object value = pair.getValue(); @@ -56,20 +56,20 @@ public class PullToRefreshOptions implements IWebViewSettings toMap() { - Map options = new HashMap<>(); - options.put("enabled", enabled); - options.put("color", color); - options.put("backgroundColor", backgroundColor); - options.put("distanceToTriggerSync", distanceToTriggerSync); - options.put("slingshotDistance", slingshotDistance); - options.put("size", size); - return options; + Map settings = new HashMap<>(); + settings.put("enabled", enabled); + settings.put("color", color); + settings.put("backgroundColor", backgroundColor); + settings.put("distanceToTriggerSync", distanceToTriggerSync); + settings.put("slingshotDistance", slingshotDistance); + settings.put("size", size); + return settings; } @Override public Map getRealSettings(PullToRefreshLayout pullToRefreshLayout) { - Map realOptions = toMap(); - return realOptions; + Map realSettings = toMap(); + return realSettings; } } \ No newline at end of file diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec new file mode 100644 index 00000000..663d5b29 --- /dev/null +++ b/example/ios/Flutter/Flutter.podspec @@ -0,0 +1,18 @@ +# +# NOTE: This podspec is NOT to be published. It is only used as a local source! +# This is a generated file; do not edit or check into version control. +# + +Pod::Spec.new do |s| + s.name = 'Flutter' + s.version = '1.0.0' + s.summary = 'High-performance, high-fidelity mobile apps.' + s.homepage = 'https://flutter.io' + s.license = { :type => 'MIT' } + s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } + s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } + s.ios.deployment_target = '9.0' + # Framework linking is handled by Flutter tooling, not CocoaPods. + # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. + s.vendored_frameworks = 'path/to/nothing' +end diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh index dad54015..9e98dd5e 100755 --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -3,11 +3,12 @@ export "FLUTTER_ROOT=/Users/lorenzopichilli/fvm/versions/2.10.4" export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example" export "COCOAPODS_PARALLEL_CODE_SIGN=true" -export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_TARGET=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=false" +export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.packages" +export "PACKAGE_CONFIG=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/.dart_tool/package_config.json" diff --git a/ios/Classes/InAppBrowser/InAppBrowserManager.swift b/ios/Classes/InAppBrowser/InAppBrowserManager.swift index ea4b4b05..2bda1598 100755 --- a/ios/Classes/InAppBrowser/InAppBrowserManager.swift +++ b/ios/Classes/InAppBrowser/InAppBrowserManager.swift @@ -80,7 +80,7 @@ public class InAppBrowserManager: NSObject, FlutterPlugin { let contextMenu = arguments["contextMenu"] as! [String: Any] let windowId = arguments["windowId"] as? Int64 let initialUserScripts = arguments["initialUserScripts"] as? [[String: Any]] - let pullToRefreshInitialOptions = arguments["pullToRefreshOptions"] as! [String: Any?] + let pullToRefreshInitialSettings = arguments["pullToRefreshSettings"] as! [String: Any?] let webViewController = prepareInAppBrowserWebViewController(settings: settings) @@ -94,7 +94,7 @@ public class InAppBrowserManager: NSObject, FlutterPlugin { webViewController.contextMenu = contextMenu webViewController.windowId = windowId webViewController.initialUserScripts = initialUserScripts ?? [] - webViewController.pullToRefreshInitialOptions = pullToRefreshInitialOptions + webViewController.pullToRefreshInitialSettings = pullToRefreshInitialSettings presentViewController(webViewController: webViewController) } diff --git a/ios/Classes/InAppBrowser/InAppBrowserWebViewController.swift b/ios/Classes/InAppBrowser/InAppBrowserWebViewController.swift index b5369d61..3e4c8c83 100755 --- a/ios/Classes/InAppBrowser/InAppBrowserWebViewController.swift +++ b/ios/Classes/InAppBrowser/InAppBrowserWebViewController.swift @@ -36,7 +36,7 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega var initialBaseUrl: String? var previousStatusBarStyle = -1 var initialUserScripts: [[String: Any]] = [] - var pullToRefreshInitialOptions: [String: Any?] = [:] + var pullToRefreshInitialSettings: [String: Any?] = [:] var methodCallDelegate: InAppWebViewMethodHandler? public override func loadView() { @@ -47,7 +47,7 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega userScripts.append(UserScript.fromMap(map: intialUserScript, windowId: windowId)!) } - let preWebviewConfiguration = InAppWebView.preWKWebViewConfiguration(options: webViewSettings) + let preWebviewConfiguration = InAppWebView.preWKWebViewConfiguration(settings: webViewSettings) if let wId = windowId, let webViewTransport = InAppWebView.windowWebViews[wId] { webView = webViewTransport.webView webView.contextMenu = contextMenu @@ -67,9 +67,9 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega let pullToRefreshLayoutChannel = FlutterMethodChannel(name: "com.pichillilorenzo/flutter_inappwebview_pull_to_refresh_" + id, binaryMessenger: SwiftFlutterPlugin.instance!.registrar!.messenger()) - let pullToRefreshOptions = PullToRefreshSettings() - let _ = pullToRefreshOptions.parse(options: pullToRefreshInitialOptions) - let pullToRefreshControl = PullToRefreshControl(channel: pullToRefreshLayoutChannel, options: pullToRefreshOptions) + let pullToRefreshSettings = PullToRefreshSettings() + let _ = pullToRefreshSettings.parse(settings: pullToRefreshInitialSettings) + let pullToRefreshControl = PullToRefreshControl(channel: pullToRefreshLayoutChannel, settings: pullToRefreshSettings) webView.pullToRefreshControl = pullToRefreshControl pullToRefreshControl.delegate = webView pullToRefreshControl.prepare() @@ -429,8 +429,8 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega public func setSettings(newSettings: InAppBrowserSettings, newSettingsMap: [String: Any]) { let newInAppWebViewOptions = InAppWebViewSettings() - let _ = newInAppWebViewOptions.parse(options: newSettingsMap) - self.webView.setOptions(newSettings: newInAppWebViewOptions, newOptionsMap: newSettingsMap) + let _ = newInAppWebViewOptions.parse(settings: newSettingsMap) + self.webView.setSettings(newSettings: newInAppWebViewOptions, newSettingsMap: newSettingsMap) if newSettingsMap["hidden"] != nil, browserSettings?.hidden != newSettings.hidden { if newSettings.hidden { @@ -474,7 +474,7 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega } if newSettingsMap["hideToolbarBottom"] != nil, browserSettings?.hideToolbarBottom != newSettings.hideToolbarBottom { - navigationController?.isToolbarHidden = !newOptions.hideToolbarBottom + navigationController?.isToolbarHidden = !newSettings.hideToolbarBottom } if newSettingsMap["toolbarBottomBackgroundColor"] != nil, browserSettings?.toolbarBottomBackgroundColor != newSettings.toolbarBottomBackgroundColor { diff --git a/ios/Classes/InAppWebView/FlutterWebViewController.swift b/ios/Classes/InAppWebView/FlutterWebViewController.swift index 6e7b146f..daaaacf4 100755 --- a/ios/Classes/InAppWebView/FlutterWebViewController.swift +++ b/ios/Classes/InAppWebView/FlutterWebViewController.swift @@ -33,7 +33,7 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView { let contextMenu = params["contextMenu"] as? [String: Any] let windowId = params["windowId"] as? Int64 let initialUserScripts = params["initialUserScripts"] as? [[String: Any]] - let pullToRefreshInitialOptions = params["pullToRefreshOptions"] as! [String: Any?] + let pullToRefreshInitialSettings = params["pullToRefreshSettings"] as! [String: Any?] var userScripts: [UserScript] = [] if let initialUserScripts = initialUserScripts { @@ -44,7 +44,7 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView { let settings = InAppWebViewSettings() let _ = settings.parse(settings: initialSettings) - let preWebviewConfiguration = InAppWebView.preWKWebViewConfiguration(options: settings) + let preWebviewConfiguration = InAppWebView.preWKWebViewConfiguration(settings: settings) if let wId = windowId, let webViewTransport = InAppWebView.windowWebViews[wId] { webView = webViewTransport.webView @@ -65,9 +65,9 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView { let pullToRefreshLayoutChannel = FlutterMethodChannel(name: "com.pichillilorenzo/flutter_inappwebview_pull_to_refresh_" + String(describing: viewId), binaryMessenger: registrar.messenger()) - let pullToRefreshOptions = PullToRefreshSettings() - let _ = pullToRefreshOptions.parse(settings: pullToRefreshInitialOptions) - let pullToRefreshControl = PullToRefreshControl(channel: pullToRefreshLayoutChannel, options: pullToRefreshOptions) + let pullToRefreshSettings = PullToRefreshSettings() + let _ = pullToRefreshSettings.parse(settings: pullToRefreshInitialSettings) + let pullToRefreshControl = PullToRefreshControl(channel: pullToRefreshLayoutChannel, settings: pullToRefreshSettings) webView!.pullToRefreshControl = pullToRefreshControl pullToRefreshControl.delegate = webView! pullToRefreshControl.prepare() diff --git a/ios/Classes/PullToRefresh/PullToRefreshControl.swift b/ios/Classes/PullToRefresh/PullToRefreshControl.swift index 4e2a9e4d..96475881 100644 --- a/ios/Classes/PullToRefresh/PullToRefreshControl.swift +++ b/ios/Classes/PullToRefresh/PullToRefreshControl.swift @@ -11,14 +11,14 @@ import Flutter public class PullToRefreshControl : UIRefreshControl, FlutterPlugin { var channel: FlutterMethodChannel? - var options: PullToRefreshSettings? + var settings: PullToRefreshSettings? var shouldCallOnRefresh = false var delegate: PullToRefreshDelegate? - public init(channel: FlutterMethodChannel?, options: PullToRefreshSettings?) { + public init(channel: FlutterMethodChannel?, settings: PullToRefreshSettings?) { super.init() self.channel = channel - self.options = options + self.settings = settings } required init?(coder: NSCoder) { @@ -31,7 +31,7 @@ public class PullToRefreshControl : UIRefreshControl, FlutterPlugin { public func prepare() { self.channel?.setMethodCallHandler(self.handle) - if let options = options { + if let options = settings { if options.enabled { delegate?.enablePullToRefresh() } diff --git a/ios/Classes/PullToRefresh/PullToRefreshSettings.swift b/ios/Classes/PullToRefresh/PullToRefreshSettings.swift index 585b022a..01125db7 100644 --- a/ios/Classes/PullToRefresh/PullToRefreshSettings.swift +++ b/ios/Classes/PullToRefresh/PullToRefreshSettings.swift @@ -1,5 +1,5 @@ // -// PullToRefreshOptions.swift +// pullToRefreshSettings.swift // flutter_inappwebview // // Created by Lorenzo Pichilli on 03/03/21. diff --git a/lib/src/android/service_worker_controller.dart b/lib/src/android/service_worker_controller.dart index 4711c8fa..d9dc4cf9 100644 --- a/lib/src/android/service_worker_controller.dart +++ b/lib/src/android/service_worker_controller.dart @@ -28,17 +28,15 @@ class ServiceWorkerController { } static Future _handleMethod(MethodCall call) async { - ServiceWorkerController controller = - ServiceWorkerController.instance(); - ServiceWorkerClient? serviceWorkerClient = - controller.serviceWorkerClient; + ServiceWorkerController controller = ServiceWorkerController.instance(); + ServiceWorkerClient? serviceWorkerClient = controller.serviceWorkerClient; switch (call.method) { case "shouldInterceptRequest": if (serviceWorkerClient != null && serviceWorkerClient.shouldInterceptRequest != null) { Map arguments = - call.arguments.cast(); + call.arguments.cast(); WebResourceRequest request = WebResourceRequest.fromMap(arguments)!; return (await serviceWorkerClient.shouldInterceptRequest!(request)) @@ -164,7 +162,7 @@ class ServiceWorkerClient { /// ///**NOTE**: available on Android 24+. final Future Function(WebResourceRequest request)? - shouldInterceptRequest; + shouldInterceptRequest; ServiceWorkerClient({this.shouldInterceptRequest}); } diff --git a/lib/src/android/webview_feature.dart b/lib/src/android/webview_feature.dart index 064c1019..b51cd5b9 100644 --- a/lib/src/android/webview_feature.dart +++ b/lib/src/android/webview_feature.dart @@ -72,174 +72,167 @@ class WebViewFeature { /// static const CREATE_WEB_MESSAGE_CHANNEL = - const WebViewFeature._internal("CREATE_WEB_MESSAGE_CHANNEL"); + const WebViewFeature._internal("CREATE_WEB_MESSAGE_CHANNEL"); /// static const DISABLED_ACTION_MODE_MENU_ITEMS = - const WebViewFeature._internal("DISABLED_ACTION_MODE_MENU_ITEMS"); + const WebViewFeature._internal("DISABLED_ACTION_MODE_MENU_ITEMS"); /// static const FORCE_DARK = const WebViewFeature._internal("FORCE_DARK"); /// static const FORCE_DARK_STRATEGY = - const WebViewFeature._internal("FORCE_DARK_STRATEGY"); + const WebViewFeature._internal("FORCE_DARK_STRATEGY"); /// static const GET_WEB_CHROME_CLIENT = - const WebViewFeature._internal("GET_WEB_CHROME_CLIENT"); + const WebViewFeature._internal("GET_WEB_CHROME_CLIENT"); /// static const GET_WEB_VIEW_CLIENT = - const WebViewFeature._internal("GET_WEB_VIEW_CLIENT"); + const WebViewFeature._internal("GET_WEB_VIEW_CLIENT"); /// static const GET_WEB_VIEW_RENDERER = - const WebViewFeature._internal("GET_WEB_VIEW_RENDERER"); + const WebViewFeature._internal("GET_WEB_VIEW_RENDERER"); /// - static const MULTI_PROCESS = - const WebViewFeature._internal("MULTI_PROCESS"); + static const MULTI_PROCESS = const WebViewFeature._internal("MULTI_PROCESS"); /// static const OFF_SCREEN_PRERASTER = - const WebViewFeature._internal("OFF_SCREEN_PRERASTER"); + const WebViewFeature._internal("OFF_SCREEN_PRERASTER"); /// static const POST_WEB_MESSAGE = - const WebViewFeature._internal("POST_WEB_MESSAGE"); + const WebViewFeature._internal("POST_WEB_MESSAGE"); /// static const PROXY_OVERRIDE = - const WebViewFeature._internal("PROXY_OVERRIDE"); + const WebViewFeature._internal("PROXY_OVERRIDE"); /// static const RECEIVE_HTTP_ERROR = - const WebViewFeature._internal("RECEIVE_HTTP_ERROR"); + const WebViewFeature._internal("RECEIVE_HTTP_ERROR"); /// static const RECEIVE_WEB_RESOURCE_ERROR = - const WebViewFeature._internal("RECEIVE_WEB_RESOURCE_ERROR"); + const WebViewFeature._internal("RECEIVE_WEB_RESOURCE_ERROR"); /// static const SAFE_BROWSING_ALLOWLIST = - const WebViewFeature._internal("SAFE_BROWSING_ALLOWLIST"); + const WebViewFeature._internal("SAFE_BROWSING_ALLOWLIST"); /// static const SAFE_BROWSING_ENABLE = - const WebViewFeature._internal("SAFE_BROWSING_ENABLE"); + const WebViewFeature._internal("SAFE_BROWSING_ENABLE"); /// static const SAFE_BROWSING_HIT = - const WebViewFeature._internal("SAFE_BROWSING_HIT"); + const WebViewFeature._internal("SAFE_BROWSING_HIT"); /// static const SAFE_BROWSING_PRIVACY_POLICY_URL = - const WebViewFeature._internal("SAFE_BROWSING_PRIVACY_POLICY_URL"); + const WebViewFeature._internal("SAFE_BROWSING_PRIVACY_POLICY_URL"); /// static const SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY = - const WebViewFeature._internal( - "SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY"); + const WebViewFeature._internal("SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY"); /// static const SAFE_BROWSING_RESPONSE_PROCEED = - const WebViewFeature._internal("SAFE_BROWSING_RESPONSE_PROCEED"); + const WebViewFeature._internal("SAFE_BROWSING_RESPONSE_PROCEED"); /// static const SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL = - const WebViewFeature._internal( - "SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL"); + const WebViewFeature._internal( + "SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL"); ///Use [SAFE_BROWSING_ALLOWLIST] instead. @Deprecated('Use SAFE_BROWSING_ALLOWLIST instead') static const SAFE_BROWSING_WHITELIST = - const WebViewFeature._internal("SAFE_BROWSING_WHITELIST"); + const WebViewFeature._internal("SAFE_BROWSING_WHITELIST"); /// static const SERVICE_WORKER_BASIC_USAGE = - const WebViewFeature._internal("SERVICE_WORKER_BASIC_USAGE"); + const WebViewFeature._internal("SERVICE_WORKER_BASIC_USAGE"); /// static const SERVICE_WORKER_BLOCK_NETWORK_LOADS = - const WebViewFeature._internal( - "SERVICE_WORKER_BLOCK_NETWORK_LOADS"); + const WebViewFeature._internal("SERVICE_WORKER_BLOCK_NETWORK_LOADS"); /// static const SERVICE_WORKER_CACHE_MODE = - const WebViewFeature._internal("SERVICE_WORKER_CACHE_MODE"); + const WebViewFeature._internal("SERVICE_WORKER_CACHE_MODE"); /// static const SERVICE_WORKER_CONTENT_ACCESS = - const WebViewFeature._internal("SERVICE_WORKER_CONTENT_ACCESS"); + const WebViewFeature._internal("SERVICE_WORKER_CONTENT_ACCESS"); /// static const SERVICE_WORKER_FILE_ACCESS = - const WebViewFeature._internal("SERVICE_WORKER_FILE_ACCESS"); + const WebViewFeature._internal("SERVICE_WORKER_FILE_ACCESS"); /// static const SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST = - const WebViewFeature._internal( - "SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST"); + const WebViewFeature._internal("SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST"); /// static const SHOULD_OVERRIDE_WITH_REDIRECTS = - const WebViewFeature._internal("SHOULD_OVERRIDE_WITH_REDIRECTS"); + const WebViewFeature._internal("SHOULD_OVERRIDE_WITH_REDIRECTS"); /// static const START_SAFE_BROWSING = - const WebViewFeature._internal("START_SAFE_BROWSING"); + const WebViewFeature._internal("START_SAFE_BROWSING"); /// static const TRACING_CONTROLLER_BASIC_USAGE = - const WebViewFeature._internal("TRACING_CONTROLLER_BASIC_USAGE"); + const WebViewFeature._internal("TRACING_CONTROLLER_BASIC_USAGE"); /// static const VISUAL_STATE_CALLBACK = - const WebViewFeature._internal("VISUAL_STATE_CALLBACK"); + const WebViewFeature._internal("VISUAL_STATE_CALLBACK"); /// static const WEB_MESSAGE_CALLBACK_ON_MESSAGE = - const WebViewFeature._internal("WEB_MESSAGE_CALLBACK_ON_MESSAGE"); + const WebViewFeature._internal("WEB_MESSAGE_CALLBACK_ON_MESSAGE"); /// static const WEB_MESSAGE_LISTENER = - const WebViewFeature._internal("WEB_MESSAGE_LISTENER"); + const WebViewFeature._internal("WEB_MESSAGE_LISTENER"); /// static const WEB_MESSAGE_PORT_CLOSE = - const WebViewFeature._internal("WEB_MESSAGE_PORT_CLOSE"); + const WebViewFeature._internal("WEB_MESSAGE_PORT_CLOSE"); /// static const WEB_MESSAGE_PORT_POST_MESSAGE = - const WebViewFeature._internal("WEB_MESSAGE_PORT_POST_MESSAGE"); + const WebViewFeature._internal("WEB_MESSAGE_PORT_POST_MESSAGE"); /// static const WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK = - const WebViewFeature._internal( - "WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK"); + const WebViewFeature._internal("WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK"); /// static const WEB_RESOURCE_ERROR_GET_CODE = - const WebViewFeature._internal("WEB_RESOURCE_ERROR_GET_CODE"); + const WebViewFeature._internal("WEB_RESOURCE_ERROR_GET_CODE"); /// static const WEB_RESOURCE_ERROR_GET_DESCRIPTION = - const WebViewFeature._internal( - "WEB_RESOURCE_ERROR_GET_DESCRIPTION"); + const WebViewFeature._internal("WEB_RESOURCE_ERROR_GET_DESCRIPTION"); /// static const WEB_RESOURCE_REQUEST_IS_REDIRECT = - const WebViewFeature._internal("WEB_RESOURCE_REQUEST_IS_REDIRECT"); + const WebViewFeature._internal("WEB_RESOURCE_REQUEST_IS_REDIRECT"); /// static const WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE = - const WebViewFeature._internal( - "WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE"); + const WebViewFeature._internal("WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE"); /// static const WEB_VIEW_RENDERER_TERMINATE = - const WebViewFeature._internal("WEB_VIEW_RENDERER_TERMINATE"); + const WebViewFeature._internal("WEB_VIEW_RENDERER_TERMINATE"); bool operator ==(value) => value == _value; @@ -258,7 +251,6 @@ class WebViewFeature { } } - ///Class that represents an Android-specific utility class for checking which WebView Support Library features are supported on the device. ///Use [WebViewFeature] instead. @Deprecated("Use WebViewFeature instead") diff --git a/lib/src/chrome_safari_browser/chrome_safari_browser.dart b/lib/src/chrome_safari_browser/chrome_safari_browser.dart index 3a0df349..389f0662 100755 --- a/lib/src/chrome_safari_browser/chrome_safari_browser.dart +++ b/lib/src/chrome_safari_browser/chrome_safari_browser.dart @@ -88,8 +88,9 @@ class ChromeSafariBrowser { ///[settings]: Settings for the [ChromeSafariBrowser]. Future open( {required Uri url, - // ignore: deprecated_member_use_from_same_package - @Deprecated('Use settings instead') ChromeSafariBrowserClassOptions? options, + @Deprecated('Use settings instead') + // ignore: deprecated_member_use_from_same_package + ChromeSafariBrowserClassOptions? options, ChromeSafariBrowserSettings? settings}) async { assert(url.toString().isNotEmpty); this.throwIsAlreadyOpened(message: 'Cannot open $url!'); @@ -99,7 +100,8 @@ class ChromeSafariBrowser { menuItemList.add({"id": value.id, "label": value.label}); }); - var initialSettings = settings?.toMap() ?? options?.toMap() ?? + var initialSettings = settings?.toMap() ?? + options?.toMap() ?? ChromeSafariBrowserSettings().toMap(); Map args = {}; diff --git a/lib/src/chrome_safari_browser/chrome_safari_browser_settings.dart b/lib/src/chrome_safari_browser/chrome_safari_browser_settings.dart index e62f6637..c540eb3c 100755 --- a/lib/src/chrome_safari_browser/chrome_safari_browser_settings.dart +++ b/lib/src/chrome_safari_browser/chrome_safari_browser_settings.dart @@ -32,7 +32,6 @@ class ChromeSafariBrowserOptions { ///Class that represents the settings that can be used for an [ChromeSafariBrowser] window. class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { - ///The share state that should be applied to the custom tab. The default value is [CustomTabsShareState.SHARE_STATE_DEFAULT]. /// ///**NOTE**: Not available in a Trusted Web Activity. @@ -179,25 +178,25 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { ChromeSafariBrowserSettings( {this.shareState = CustomTabsShareState.SHARE_STATE_DEFAULT, - this.showTitle = true, - this.toolbarBackgroundColor, - this.enableUrlBarHiding = false, - this.instantAppsEnabled = false, - this.packageName, - this.keepAliveEnabled = false, - this.isSingleInstance = false, - this.noHistory = false, - this.isTrustedWebActivity = false, - this.additionalTrustedOrigins = const [], - this.displayMode, - this.screenOrientation = TrustedWebActivityScreenOrientation.DEFAULT, - this.entersReaderIfAvailable = false, - this.barCollapsingEnabled = false, - this.dismissButtonStyle = DismissButtonStyle.DONE, - this.preferredBarTintColor, - this.preferredControlTintColor, - this.presentationStyle = ModalPresentationStyle.FULL_SCREEN, - this.transitionStyle = ModalTransitionStyle.COVER_VERTICAL}); + this.showTitle = true, + this.toolbarBackgroundColor, + this.enableUrlBarHiding = false, + this.instantAppsEnabled = false, + this.packageName, + this.keepAliveEnabled = false, + this.isSingleInstance = false, + this.noHistory = false, + this.isTrustedWebActivity = false, + this.additionalTrustedOrigins = const [], + this.displayMode, + this.screenOrientation = TrustedWebActivityScreenOrientation.DEFAULT, + this.entersReaderIfAvailable = false, + this.barCollapsingEnabled = false, + this.dismissButtonStyle = DismissButtonStyle.DONE, + this.preferredBarTintColor, + this.preferredControlTintColor, + this.presentationStyle = ModalPresentationStyle.FULL_SCREEN, + this.transitionStyle = ModalTransitionStyle.COVER_VERTICAL}); @override Map toMap() { @@ -226,8 +225,7 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions { } static ChromeSafariBrowserSettings fromMap(Map map) { - ChromeSafariBrowserSettings options = - new ChromeSafariBrowserSettings(); + ChromeSafariBrowserSettings options = new ChromeSafariBrowserSettings(); options.shareState = map["shareState"]; options.showTitle = map["showTitle"]; options.toolbarBackgroundColor = diff --git a/lib/src/cookie_manager.dart b/lib/src/cookie_manager.dart index 2465abec..00cc2cce 100755 --- a/lib/src/cookie_manager.dart +++ b/lib/src/cookie_manager.dart @@ -438,7 +438,7 @@ class CookieManager { Map args = {}; List cookieListMap = - await CookieManager._channel.invokeMethod('getAllCookies', args); + await CookieManager._channel.invokeMethod('getAllCookies', args); cookieListMap = cookieListMap.cast>(); cookieListMap.forEach((cookieMap) { diff --git a/lib/src/in_app_browser/in_app_browser.dart b/lib/src/in_app_browser/in_app_browser.dart index 552e801d..8df9535d 100755 --- a/lib/src/in_app_browser/in_app_browser.dart +++ b/lib/src/in_app_browser/in_app_browser.dart @@ -107,15 +107,22 @@ class InAppBrowser { ///[settings]: Settings for the [InAppBrowser]. Future openUrlRequest( {required URLRequest urlRequest, - // ignore: deprecated_member_use_from_same_package - @Deprecated('Use settings instead') InAppBrowserClassOptions? options, - InAppBrowserClassSettings? settings}) async { + // ignore: deprecated_member_use_from_same_package + @Deprecated('Use settings instead') InAppBrowserClassOptions? options, + InAppBrowserClassSettings? settings}) async { this.throwIfAlreadyOpened(message: 'Cannot open $urlRequest!'); assert(urlRequest.url != null && urlRequest.url.toString().isNotEmpty); - var initialSettings = settings?.toMap() ?? options?.toMap() ?? + var initialSettings = settings?.toMap() ?? + options?.toMap() ?? InAppBrowserClassSettings().toMap(); + Map pullToRefreshSettings = + pullToRefreshController?.settings.toMap() ?? + // ignore: deprecated_member_use_from_same_package + pullToRefreshController?.options.toMap() ?? + PullToRefreshSettings(enabled: false).toMap(); + Map args = {}; args.putIfAbsent('id', () => id); args.putIfAbsent('urlRequest', () => urlRequest.toMap()); @@ -125,11 +132,7 @@ class InAppBrowser { args.putIfAbsent('implementation', () => implementation.toValue()); args.putIfAbsent('initialUserScripts', () => initialUserScripts?.map((e) => e.toMap()).toList() ?? []); - args.putIfAbsent( - 'pullToRefreshOptions', - () => - pullToRefreshController?.options.toMap() ?? - PullToRefreshOptions(enabled: false).toMap()); + args.putIfAbsent('pullToRefreshSettings', () => pullToRefreshSettings); await _sharedChannel.invokeMethod('open', args); } @@ -178,9 +181,16 @@ class InAppBrowser { this.throwIfAlreadyOpened(message: 'Cannot open $assetFilePath!'); assert(assetFilePath.isNotEmpty); - var initialSettings = settings?.toMap() ?? options?.toMap() ?? + var initialSettings = settings?.toMap() ?? + options?.toMap() ?? InAppBrowserClassSettings().toMap(); + Map pullToRefreshSettings = + pullToRefreshController?.settings.toMap() ?? + // ignore: deprecated_member_use_from_same_package + pullToRefreshController?.options.toMap() ?? + PullToRefreshSettings(enabled: false).toMap(); + Map args = {}; args.putIfAbsent('id', () => id); args.putIfAbsent('assetFilePath', () => assetFilePath); @@ -190,11 +200,7 @@ class InAppBrowser { args.putIfAbsent('implementation', () => implementation.toValue()); args.putIfAbsent('initialUserScripts', () => initialUserScripts?.map((e) => e.toMap()).toList() ?? []); - args.putIfAbsent( - 'pullToRefreshOptions', - () => - pullToRefreshController?.options.toMap() ?? - PullToRefreshOptions(enabled: false).toMap()); + args.putIfAbsent('pullToRefreshSettings', () => pullToRefreshSettings); await _sharedChannel.invokeMethod('open', args); } @@ -221,9 +227,16 @@ class InAppBrowser { InAppBrowserClassSettings? settings}) async { this.throwIfAlreadyOpened(message: 'Cannot open data!'); - var initialSettings = settings?.toMap() ?? options?.toMap() ?? + var initialSettings = settings?.toMap() ?? + options?.toMap() ?? InAppBrowserClassSettings().toMap(); + Map pullToRefreshSettings = + pullToRefreshController?.settings.toMap() ?? + // ignore: deprecated_member_use_from_same_package + pullToRefreshController?.options.toMap() ?? + PullToRefreshSettings(enabled: false).toMap(); + Map args = {}; args.putIfAbsent('id', () => id); args.putIfAbsent('settings', () => initialSettings); @@ -231,18 +244,14 @@ class InAppBrowser { args.putIfAbsent('mimeType', () => mimeType); args.putIfAbsent('encoding', () => encoding); args.putIfAbsent('baseUrl', () => baseUrl?.toString() ?? "about:blank"); - args.putIfAbsent( - 'historyUrl', () => (historyUrl ?? androidHistoryUrl)?.toString() ?? "about:blank"); + args.putIfAbsent('historyUrl', + () => (historyUrl ?? androidHistoryUrl)?.toString() ?? "about:blank"); args.putIfAbsent('contextMenu', () => contextMenu?.toMap() ?? {}); args.putIfAbsent('windowId', () => windowId); args.putIfAbsent('implementation', () => implementation.toValue()); args.putIfAbsent('initialUserScripts', () => initialUserScripts?.map((e) => e.toMap()).toList() ?? []); - args.putIfAbsent( - 'pullToRefreshOptions', - () => - pullToRefreshController?.options.toMap() ?? - PullToRefreshOptions(enabled: false).toMap()); + args.putIfAbsent('pullToRefreshSettings', () => pullToRefreshSettings); await _sharedChannel.invokeMethod('open', args); } @@ -309,7 +318,8 @@ class InAppBrowser { } ///Sets the [InAppBrowser] settings with the new [settings] and evaluates them. - Future setSettings({required InAppBrowserClassSettings settings}) async { + Future setSettings( + {required InAppBrowserClassSettings settings}) async { this.throwIfNotOpened(); Map args = {}; @@ -323,10 +333,11 @@ class InAppBrowser { Map args = {}; Map? settings = - await _channel.invokeMethod('getSettings', args); + await _channel.invokeMethod('getSettings', args); if (settings != null) { settings = settings.cast(); - return InAppBrowserClassSettings.fromMap(settings as Map); + return InAppBrowserClassSettings.fromMap( + settings as Map); } return null; @@ -802,7 +813,7 @@ class InAppBrowser { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsShowPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback))) Future? - onGeolocationPermissionsShowPrompt(String origin) {} + onGeolocationPermissionsShowPrompt(String origin) {} ///Use [onGeolocationPermissionsHidePrompt] instead. @Deprecated("Use onGeolocationPermissionsHidePrompt instead") @@ -863,8 +874,7 @@ class InAppBrowser { /// ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessUnresponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess))) - Future? onRenderProcessUnresponsive( - Uri? url) {} + Future? onRenderProcessUnresponsive(Uri? url) {} ///Use [onRenderProcessResponsive] instead. @Deprecated("Use onRenderProcessResponsive instead") @@ -883,8 +893,7 @@ class InAppBrowser { /// ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessResponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess))) - Future? onRenderProcessResponsive( - Uri? url) {} + Future? onRenderProcessResponsive(Uri? url) {} ///Use [onRenderProcessGone] instead. @Deprecated("Use onRenderProcessGone instead") @@ -928,7 +937,6 @@ class InAppBrowser { ///- Android native WebView ([Official API - WebChromeClient.onReceivedIcon](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap))) void onReceivedIcon(Uint8List icon) {} - ///Use [onReceivedTouchIconUrl] instead. @Deprecated('Use onReceivedTouchIconUrl instead') void androidOnReceivedTouchIconUrl(Uri url, bool precomposed) {} @@ -943,7 +951,6 @@ class InAppBrowser { ///- Android native WebView ([Official API - WebChromeClient.onReceivedTouchIconUrl](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean))) void onReceivedTouchIconUrl(Uri url, bool precomposed) {} - ///Use [onJsBeforeUnload] instead. @Deprecated('Use onJsBeforeUnload instead') Future? androidOnJsBeforeUnload( diff --git a/lib/src/in_app_browser/in_app_browser_settings.dart b/lib/src/in_app_browser/in_app_browser_settings.dart index 82b2dae7..4c05512e 100755 --- a/lib/src/in_app_browser/in_app_browser_settings.dart +++ b/lib/src/in_app_browser/in_app_browser_settings.dart @@ -46,7 +46,7 @@ class InAppBrowserClassSettings { InAppBrowserClassSettings( {InAppBrowserSettings? browserSettings, - InAppWebViewSettings? webViewSettings}) { + InAppWebViewSettings? webViewSettings}) { this.browserSettings = browserSettings ?? InAppBrowserSettings(); this.webViewSettings = webViewSettings ?? InAppWebViewSettings(); } @@ -60,7 +60,8 @@ class InAppBrowserClassSettings { return options; } - static Map instanceToMap(InAppBrowserClassSettings settings) { + static Map instanceToMap( + InAppBrowserClassSettings settings) { return settings.toMap(); } @@ -73,7 +74,8 @@ class InAppBrowserClassSettings { return toMap().toString(); } - static InAppBrowserClassSettings fromMap(Map options, {InAppBrowserClassSettings? instance}) { + static InAppBrowserClassSettings fromMap(Map options, + {InAppBrowserClassSettings? instance}) { if (instance == null) { instance = InAppBrowserClassSettings(); } @@ -88,8 +90,8 @@ class InAppBrowserClassSettings { } ///This class represents all [InAppBrowser] settings available. -class InAppBrowserSettings implements BrowserOptions, AndroidOptions, IosOptions { - +class InAppBrowserSettings + implements BrowserOptions, AndroidOptions, IosOptions { ///Set to `true` to create the browser and load the page, but not show it. Omit or set to `false` to have the browser open and load normally. ///The default value is `false`. /// @@ -224,25 +226,25 @@ class InAppBrowserSettings implements BrowserOptions, AndroidOptions, IosOptions InAppBrowserSettings( {this.hidden = false, - this.hideToolbarTop = false, - this.toolbarTopBackgroundColor, - this.hideUrlBar = false, - this.hideProgressBar = false, - this.toolbarTopTranslucent = true, - this.toolbarTopTintColor, - this.hideToolbarBottom = false, - this.toolbarBottomBackgroundColor, - this.toolbarBottomTintColor, - this.toolbarBottomTranslucent = true, - this.closeButtonCaption, - this.closeButtonColor, - this.presentationStyle = ModalPresentationStyle.FULL_SCREEN, - this.transitionStyle = ModalTransitionStyle.COVER_VERTICAL, - this.hideTitleBar = false, - this.toolbarTopFixedTitle, - this.closeOnCannotGoBack = true, - this.allowGoBackWithBackButton = true, - this.shouldCloseOnBackButtonPressed = false}); + this.hideToolbarTop = false, + this.toolbarTopBackgroundColor, + this.hideUrlBar = false, + this.hideProgressBar = false, + this.toolbarTopTranslucent = true, + this.toolbarTopTintColor, + this.hideToolbarBottom = false, + this.toolbarBottomBackgroundColor, + this.toolbarBottomTintColor, + this.toolbarBottomTranslucent = true, + this.closeButtonCaption, + this.closeButtonColor, + this.presentationStyle = ModalPresentationStyle.FULL_SCREEN, + this.transitionStyle = ModalTransitionStyle.COVER_VERTICAL, + this.hideTitleBar = false, + this.toolbarTopFixedTitle, + this.closeOnCannotGoBack = true, + this.allowGoBackWithBackButton = true, + this.shouldCloseOnBackButtonPressed = false}); @override Map toMap() { @@ -282,9 +284,11 @@ class InAppBrowserSettings implements BrowserOptions, AndroidOptions, IosOptions instance.toolbarTopFixedTitle = map["toolbarTopFixedTitle"]; instance.closeOnCannotGoBack = map["closeOnCannotGoBack"]; instance.allowGoBackWithBackButton = map["allowGoBackWithBackButton"]; - instance.shouldCloseOnBackButtonPressed = map["shouldCloseOnBackButtonPressed"]; + instance.shouldCloseOnBackButtonPressed = + map["shouldCloseOnBackButtonPressed"]; instance.toolbarTopTranslucent = map["toolbarTopTranslucent"]; - instance.toolbarTopTintColor = UtilColor.fromHex(map["toolbarTopTintColor"]); + instance.toolbarTopTintColor = + UtilColor.fromHex(map["toolbarTopTintColor"]); instance.hideToolbarBottom = map["hideToolbarBottom"]; instance.toolbarBottomBackgroundColor = UtilColor.fromHex(map["toolbarBottomBackgroundColor"]); @@ -294,9 +298,9 @@ class InAppBrowserSettings implements BrowserOptions, AndroidOptions, IosOptions instance.closeButtonCaption = map["closeButtonCaption"]; instance.closeButtonColor = UtilColor.fromHex(map["closeButtonColor"]); instance.presentationStyle = - ModalPresentationStyle.fromValue(map["presentationStyle"])!; + ModalPresentationStyle.fromValue(map["presentationStyle"])!; instance.transitionStyle = - ModalTransitionStyle.fromValue(map["transitionStyle"])!; + ModalTransitionStyle.fromValue(map["transitionStyle"])!; return instance; } diff --git a/lib/src/in_app_browser/ios/in_app_browser_options.dart b/lib/src/in_app_browser/ios/in_app_browser_options.dart index ef99cc6e..3120b101 100755 --- a/lib/src/in_app_browser/ios/in_app_browser_options.dart +++ b/lib/src/in_app_browser/ios/in_app_browser_options.dart @@ -76,7 +76,8 @@ class IOSInAppBrowserOptions implements BrowserOptions, IosOptions { static IOSInAppBrowserOptions fromMap(Map map) { var instance = IOSInAppBrowserOptions(); instance.toolbarTopTranslucent = map["toolbarTopTranslucent"]; - instance.toolbarTopTintColor = UtilColor.fromHex(map["toolbarTopTintColor"]); + instance.toolbarTopTintColor = + UtilColor.fromHex(map["toolbarTopTintColor"]); instance.hideToolbarBottom = map["hideToolbarBottom"]; instance.toolbarBottomBackgroundColor = UtilColor.fromHex(map["toolbarBottomBackgroundColor"]); diff --git a/lib/src/in_app_webview/android/in_app_webview_controller.dart b/lib/src/in_app_webview/android/in_app_webview_controller.dart index 4966db68..f75f2d63 100644 --- a/lib/src/in_app_webview/android/in_app_webview_controller.dart +++ b/lib/src/in_app_webview/android/in_app_webview_controller.dart @@ -127,7 +127,8 @@ class AndroidInAppWebViewController with AndroidInAppWebViewControllerMixin { } ///Use [InAppWebViewController.getSafeBrowsingPrivacyPolicyUrl] instead. - @Deprecated("Use InAppWebViewController.getSafeBrowsingPrivacyPolicyUrl instead") + @Deprecated( + "Use InAppWebViewController.getSafeBrowsingPrivacyPolicyUrl instead") static Future getSafeBrowsingPrivacyPolicyUrl() async { return await InAppWebViewController.getSafeBrowsingPrivacyPolicyUrl(); } @@ -142,15 +143,18 @@ class AndroidInAppWebViewController with AndroidInAppWebViewControllerMixin { ///Use [InAppWebViewController.getCurrentWebViewPackage] instead. @Deprecated("Use InAppWebViewController.getCurrentWebViewPackage instead") static Future getCurrentWebViewPackage() async { - Map? packageInfo = (await InAppWebViewController.getCurrentWebViewPackage())?.toMap(); + Map? packageInfo = + (await InAppWebViewController.getCurrentWebViewPackage())?.toMap(); return AndroidWebViewPackageInfo.fromMap(packageInfo); } ///Use [InAppWebViewController.setWebContentsDebuggingEnabled] instead. - @Deprecated("Use InAppWebViewController.setWebContentsDebuggingEnabled instead") + @Deprecated( + "Use InAppWebViewController.setWebContentsDebuggingEnabled instead") static Future setWebContentsDebuggingEnabled( bool debuggingEnabled) async { - return await InAppWebViewController.setWebContentsDebuggingEnabled(debuggingEnabled); + return await InAppWebViewController.setWebContentsDebuggingEnabled( + debuggingEnabled); } ///Use [InAppWebViewController.getOriginalUrl] instead. @@ -160,4 +164,4 @@ class AndroidInAppWebViewController with AndroidInAppWebViewControllerMixin { String? url = await _channel.invokeMethod('getOriginalUrl', args); return url != null ? Uri.parse(url) : null; } -} \ No newline at end of file +} diff --git a/lib/src/in_app_webview/headless_in_app_webview.dart b/lib/src/in_app_webview/headless_in_app_webview.dart index 7daab789..eee235ad 100644 --- a/lib/src/in_app_webview/headless_in_app_webview.dart +++ b/lib/src/in_app_webview/headless_in_app_webview.dart @@ -11,7 +11,7 @@ import 'webview.dart'; import 'in_app_webview_controller.dart'; import 'in_app_webview_settings.dart'; import '../pull_to_refresh/pull_to_refresh_controller.dart'; -import '../pull_to_refresh/pull_to_refresh_options.dart'; +import '../pull_to_refresh/pull_to_refresh_settings.dart'; import '../util.dart'; ///Class that represents a WebView in headless mode. @@ -43,90 +43,104 @@ class HeadlessInAppWebView implements WebView { ///**NOTE for Android**: `Size` width and height values will be converted to `int` values because they cannot have `double` values. final Size initialSize; - HeadlessInAppWebView( - {this.initialSize = const Size(-1, -1), - this.windowId, - this.initialUrlRequest, - this.initialFile, - this.initialData, - @Deprecated('Use initialSettings instead') this.initialOptions, - this.initialSettings, - this.contextMenu, - this.initialUserScripts, - this.pullToRefreshController, - this.implementation = WebViewImplementation.NATIVE, - this.onWebViewCreated, - this.onLoadStart, - this.onLoadStop, - this.onLoadError, - this.onLoadHttpError, - this.onProgressChanged, - this.onConsoleMessage, - this.shouldOverrideUrlLoading, - this.onLoadResource, - this.onScrollChanged, - @Deprecated('Use onDownloadStartRequest instead') - this.onDownloadStart, - this.onDownloadStartRequest, - this.onLoadResourceCustomScheme, - this.onCreateWindow, - this.onCloseWindow, - this.onJsAlert, - this.onJsConfirm, - this.onJsPrompt, - this.onReceivedHttpAuthRequest, - this.onReceivedServerTrustAuthRequest, - this.onReceivedClientCertRequest, - this.onFindResultReceived, - this.shouldInterceptAjaxRequest, - this.onAjaxReadyStateChange, - this.onAjaxProgress, - this.shouldInterceptFetchRequest, - this.onUpdateVisitedHistory, - this.onPrint, - this.onLongPressHitTestResult, - this.onEnterFullscreen, - this.onExitFullscreen, - this.onPageCommitVisible, - this.onTitleChanged, - this.onWindowFocus, - this.onWindowBlur, - this.onOverScrolled, - @Deprecated('Use onSafeBrowsingHit instead') this.androidOnSafeBrowsingHit, - this.onSafeBrowsingHit, - @Deprecated('Use onPermissionRequest instead') this.androidOnPermissionRequest, - this.onPermissionRequest, - @Deprecated('Use onGeolocationPermissionsShowPrompt instead') this.androidOnGeolocationPermissionsShowPrompt, - this.onGeolocationPermissionsShowPrompt, - @Deprecated('Use onGeolocationPermissionsHidePrompt instead') this.androidOnGeolocationPermissionsHidePrompt, - this.onGeolocationPermissionsHidePrompt, - @Deprecated('Use shouldInterceptRequest instead') this.androidShouldInterceptRequest, - this.shouldInterceptRequest, - @Deprecated('Use onRenderProcessGone instead') this.androidOnRenderProcessGone, - this.onRenderProcessGone, - @Deprecated('Use onRenderProcessResponsive instead') this.androidOnRenderProcessResponsive, - this.onRenderProcessResponsive, - @Deprecated('Use onRenderProcessUnresponsive instead') this.androidOnRenderProcessUnresponsive, - this.onRenderProcessUnresponsive, - @Deprecated('Use onFormResubmission instead') this.androidOnFormResubmission, - this.onFormResubmission, - @Deprecated('Use onZoomScaleChanged instead') this.androidOnScaleChanged, - @Deprecated('Use onReceivedIcon instead') this.androidOnReceivedIcon, - this.onReceivedIcon, - @Deprecated('Use onReceivedTouchIconUrl instead') this.androidOnReceivedTouchIconUrl, - this.onReceivedTouchIconUrl, - @Deprecated('Use onJsBeforeUnload instead') this.androidOnJsBeforeUnload, - this.onJsBeforeUnload, - @Deprecated('Use onReceivedLoginRequest instead') this.androidOnReceivedLoginRequest, - this.onReceivedLoginRequest, - @Deprecated('Use onWebContentProcessDidTerminate instead') this.iosOnWebContentProcessDidTerminate, - this.onWebContentProcessDidTerminate, - @Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead') this.iosOnDidReceiveServerRedirectForProvisionalNavigation, - this.onDidReceiveServerRedirectForProvisionalNavigation, - @Deprecated('Use onNavigationResponse instead') this.iosOnNavigationResponse, - this.onNavigationResponse, - @Deprecated('Use shouldAllowDeprecatedTLS instead') this.iosShouldAllowDeprecatedTLS, - this.shouldAllowDeprecatedTLS,}) { + HeadlessInAppWebView({ + this.initialSize = const Size(-1, -1), + this.windowId, + this.initialUrlRequest, + this.initialFile, + this.initialData, + @Deprecated('Use initialSettings instead') this.initialOptions, + this.initialSettings, + this.contextMenu, + this.initialUserScripts, + this.pullToRefreshController, + this.implementation = WebViewImplementation.NATIVE, + this.onWebViewCreated, + this.onLoadStart, + this.onLoadStop, + this.onLoadError, + this.onLoadHttpError, + this.onProgressChanged, + this.onConsoleMessage, + this.shouldOverrideUrlLoading, + this.onLoadResource, + this.onScrollChanged, + @Deprecated('Use onDownloadStartRequest instead') this.onDownloadStart, + this.onDownloadStartRequest, + this.onLoadResourceCustomScheme, + this.onCreateWindow, + this.onCloseWindow, + this.onJsAlert, + this.onJsConfirm, + this.onJsPrompt, + this.onReceivedHttpAuthRequest, + this.onReceivedServerTrustAuthRequest, + this.onReceivedClientCertRequest, + this.onFindResultReceived, + this.shouldInterceptAjaxRequest, + this.onAjaxReadyStateChange, + this.onAjaxProgress, + this.shouldInterceptFetchRequest, + this.onUpdateVisitedHistory, + this.onPrint, + this.onLongPressHitTestResult, + this.onEnterFullscreen, + this.onExitFullscreen, + this.onPageCommitVisible, + this.onTitleChanged, + this.onWindowFocus, + this.onWindowBlur, + this.onOverScrolled, + @Deprecated('Use onSafeBrowsingHit instead') this.androidOnSafeBrowsingHit, + this.onSafeBrowsingHit, + @Deprecated('Use onPermissionRequest instead') + this.androidOnPermissionRequest, + this.onPermissionRequest, + @Deprecated('Use onGeolocationPermissionsShowPrompt instead') + this.androidOnGeolocationPermissionsShowPrompt, + this.onGeolocationPermissionsShowPrompt, + @Deprecated('Use onGeolocationPermissionsHidePrompt instead') + this.androidOnGeolocationPermissionsHidePrompt, + this.onGeolocationPermissionsHidePrompt, + @Deprecated('Use shouldInterceptRequest instead') + this.androidShouldInterceptRequest, + this.shouldInterceptRequest, + @Deprecated('Use onRenderProcessGone instead') + this.androidOnRenderProcessGone, + this.onRenderProcessGone, + @Deprecated('Use onRenderProcessResponsive instead') + this.androidOnRenderProcessResponsive, + this.onRenderProcessResponsive, + @Deprecated('Use onRenderProcessUnresponsive instead') + this.androidOnRenderProcessUnresponsive, + this.onRenderProcessUnresponsive, + @Deprecated('Use onFormResubmission instead') + this.androidOnFormResubmission, + this.onFormResubmission, + @Deprecated('Use onZoomScaleChanged instead') this.androidOnScaleChanged, + @Deprecated('Use onReceivedIcon instead') this.androidOnReceivedIcon, + this.onReceivedIcon, + @Deprecated('Use onReceivedTouchIconUrl instead') + this.androidOnReceivedTouchIconUrl, + this.onReceivedTouchIconUrl, + @Deprecated('Use onJsBeforeUnload instead') this.androidOnJsBeforeUnload, + this.onJsBeforeUnload, + @Deprecated('Use onReceivedLoginRequest instead') + this.androidOnReceivedLoginRequest, + this.onReceivedLoginRequest, + @Deprecated('Use onWebContentProcessDidTerminate instead') + this.iosOnWebContentProcessDidTerminate, + this.onWebContentProcessDidTerminate, + @Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead') + this.iosOnDidReceiveServerRedirectForProvisionalNavigation, + this.onDidReceiveServerRedirectForProvisionalNavigation, + @Deprecated('Use onNavigationResponse instead') + this.iosOnNavigationResponse, + this.onNavigationResponse, + @Deprecated('Use shouldAllowDeprecatedTLS instead') + this.iosShouldAllowDeprecatedTLS, + this.shouldAllowDeprecatedTLS, + }) { id = IdGenerator.generate(); webViewController = new InAppWebViewController(id, this); this._channel = @@ -155,10 +169,16 @@ class HeadlessInAppWebView implements WebView { } _started = true; - Map initialSettings = (this.initialSettings != null ? - this.initialSettings?.toMap() : - // ignore: deprecated_member_use_from_same_package - this.initialOptions?.toMap()) ?? {}; + Map initialSettings = this.initialSettings?.toMap() ?? + // ignore: deprecated_member_use_from_same_package + this.initialOptions?.toMap() ?? + {}; + + Map pullToRefreshSettings = + this.pullToRefreshController?.settings.toMap() ?? + // ignore: deprecated_member_use_from_same_package + this.pullToRefreshController?.options.toMap() ?? + PullToRefreshSettings(enabled: false).toMap(); Map args = {}; args.putIfAbsent('id', () => id); @@ -174,9 +194,7 @@ class HeadlessInAppWebView implements WebView { 'implementation': this.implementation.toValue(), 'initialUserScripts': this.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], - 'pullToRefreshOptions': - this.pullToRefreshController?.options.toMap() ?? - PullToRefreshOptions(enabled: false).toMap(), + 'pullToRefreshSettings': pullToRefreshSettings, 'initialSize': this.initialSize.toMap() }); await _sharedChannel.invokeMethod('run', args); @@ -425,8 +443,7 @@ class HeadlessInAppWebView implements WebView { onScrollChanged; @override - void Function( - InAppWebViewController controller, Uri? url, bool? isReload)? + void Function(InAppWebViewController controller, Uri? url, bool? isReload)? onUpdateVisitedHistory; @override @@ -528,53 +545,74 @@ class HeadlessInAppWebView implements WebView { androidOnReceivedLoginRequest; @override - void Function(InAppWebViewController controller)? onDidReceiveServerRedirectForProvisionalNavigation; + void Function(InAppWebViewController controller)? + onDidReceiveServerRedirectForProvisionalNavigation; @override - Future Function(InAppWebViewController controller, Uri? url)? onFormResubmission; + Future Function( + InAppWebViewController controller, Uri? url)? onFormResubmission; @override - void Function(InAppWebViewController controller)? onGeolocationPermissionsHidePrompt; + void Function(InAppWebViewController controller)? + onGeolocationPermissionsHidePrompt; @override - Future Function(InAppWebViewController controller, String origin)? onGeolocationPermissionsShowPrompt; + Future Function( + InAppWebViewController controller, String origin)? + onGeolocationPermissionsShowPrompt; @override - Future Function(InAppWebViewController controller, JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload; + Future Function(InAppWebViewController controller, + JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload; @override - Future Function(InAppWebViewController controller, NavigationResponse navigationResponse)? onNavigationResponse; + Future Function(InAppWebViewController controller, + NavigationResponse navigationResponse)? onNavigationResponse; @override - Future Function(InAppWebViewController controller, String origin, List resources)? onPermissionRequest; + Future Function(InAppWebViewController controller, + String origin, List resources)? onPermissionRequest; @override - void Function(InAppWebViewController controller, Uint8List icon)? onReceivedIcon; + void Function(InAppWebViewController controller, Uint8List icon)? + onReceivedIcon; @override - void Function(InAppWebViewController controller, LoginRequest loginRequest)? onReceivedLoginRequest; + void Function(InAppWebViewController controller, LoginRequest loginRequest)? + onReceivedLoginRequest; @override - void Function(InAppWebViewController controller, Uri url, bool precomposed)? onReceivedTouchIconUrl; + void Function(InAppWebViewController controller, Uri url, bool precomposed)? + onReceivedTouchIconUrl; @override - void Function(InAppWebViewController controller, RenderProcessGoneDetail detail)? onRenderProcessGone; + void Function( + InAppWebViewController controller, RenderProcessGoneDetail detail)? + onRenderProcessGone; @override - Future Function(InAppWebViewController controller, Uri? url)? onRenderProcessResponsive; + Future Function( + InAppWebViewController controller, Uri? url)? onRenderProcessResponsive; @override - Future Function(InAppWebViewController controller, Uri? url)? onRenderProcessUnresponsive; + Future Function( + InAppWebViewController controller, Uri? url)? onRenderProcessUnresponsive; @override - Future Function(InAppWebViewController controller, Uri url, SafeBrowsingThreat? threatType)? onSafeBrowsingHit; + Future Function(InAppWebViewController controller, + Uri url, SafeBrowsingThreat? threatType)? onSafeBrowsingHit; @override - void Function(InAppWebViewController controller)? onWebContentProcessDidTerminate; + void Function(InAppWebViewController controller)? + onWebContentProcessDidTerminate; @override - Future Function(InAppWebViewController controller, URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS; + Future Function( + InAppWebViewController controller, + URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS; @override - Future Function(InAppWebViewController controller, WebResourceRequest request)? shouldInterceptRequest; + Future Function( + InAppWebViewController controller, WebResourceRequest request)? + shouldInterceptRequest; } diff --git a/lib/src/in_app_webview/in_app_webview.dart b/lib/src/in_app_webview/in_app_webview.dart index 3f3cf36b..70057cad 100755 --- a/lib/src/in_app_webview/in_app_webview.dart +++ b/lib/src/in_app_webview/in_app_webview.dart @@ -82,38 +82,52 @@ class InAppWebView extends StatefulWidget implements WebView { this.onZoomScaleChanged, @Deprecated('Use onSafeBrowsingHit instead') this.androidOnSafeBrowsingHit, this.onSafeBrowsingHit, - @Deprecated('Use onPermissionRequest instead') this.androidOnPermissionRequest, + @Deprecated('Use onPermissionRequest instead') + this.androidOnPermissionRequest, this.onPermissionRequest, - @Deprecated('Use onGeolocationPermissionsShowPrompt instead') this.androidOnGeolocationPermissionsShowPrompt, + @Deprecated('Use onGeolocationPermissionsShowPrompt instead') + this.androidOnGeolocationPermissionsShowPrompt, this.onGeolocationPermissionsShowPrompt, - @Deprecated('Use onGeolocationPermissionsHidePrompt instead') this.androidOnGeolocationPermissionsHidePrompt, + @Deprecated('Use onGeolocationPermissionsHidePrompt instead') + this.androidOnGeolocationPermissionsHidePrompt, this.onGeolocationPermissionsHidePrompt, - @Deprecated('Use shouldInterceptRequest instead') this.androidShouldInterceptRequest, + @Deprecated('Use shouldInterceptRequest instead') + this.androidShouldInterceptRequest, this.shouldInterceptRequest, - @Deprecated('Use onRenderProcessGone instead') this.androidOnRenderProcessGone, + @Deprecated('Use onRenderProcessGone instead') + this.androidOnRenderProcessGone, this.onRenderProcessGone, - @Deprecated('Use onRenderProcessResponsive instead') this.androidOnRenderProcessResponsive, + @Deprecated('Use onRenderProcessResponsive instead') + this.androidOnRenderProcessResponsive, this.onRenderProcessResponsive, - @Deprecated('Use onRenderProcessUnresponsive instead') this.androidOnRenderProcessUnresponsive, + @Deprecated('Use onRenderProcessUnresponsive instead') + this.androidOnRenderProcessUnresponsive, this.onRenderProcessUnresponsive, - @Deprecated('Use onFormResubmission instead') this.androidOnFormResubmission, + @Deprecated('Use onFormResubmission instead') + this.androidOnFormResubmission, this.onFormResubmission, @Deprecated('Use onZoomScaleChanged instead') this.androidOnScaleChanged, @Deprecated('Use onReceivedIcon instead') this.androidOnReceivedIcon, this.onReceivedIcon, - @Deprecated('Use onReceivedTouchIconUrl instead') this.androidOnReceivedTouchIconUrl, + @Deprecated('Use onReceivedTouchIconUrl instead') + this.androidOnReceivedTouchIconUrl, this.onReceivedTouchIconUrl, @Deprecated('Use onJsBeforeUnload instead') this.androidOnJsBeforeUnload, this.onJsBeforeUnload, - @Deprecated('Use onReceivedLoginRequest instead') this.androidOnReceivedLoginRequest, + @Deprecated('Use onReceivedLoginRequest instead') + this.androidOnReceivedLoginRequest, this.onReceivedLoginRequest, - @Deprecated('Use onWebContentProcessDidTerminate instead') this.iosOnWebContentProcessDidTerminate, + @Deprecated('Use onWebContentProcessDidTerminate instead') + this.iosOnWebContentProcessDidTerminate, this.onWebContentProcessDidTerminate, - @Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead') this.iosOnDidReceiveServerRedirectForProvisionalNavigation, + @Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead') + this.iosOnDidReceiveServerRedirectForProvisionalNavigation, this.onDidReceiveServerRedirectForProvisionalNavigation, - @Deprecated('Use onNavigationResponse instead') this.iosOnNavigationResponse, + @Deprecated('Use onNavigationResponse instead') + this.iosOnNavigationResponse, this.onNavigationResponse, - @Deprecated('Use shouldAllowDeprecatedTLS instead') this.iosShouldAllowDeprecatedTLS, + @Deprecated('Use shouldAllowDeprecatedTLS instead') + this.iosShouldAllowDeprecatedTLS, this.shouldAllowDeprecatedTLS, this.gestureRecognizers, }) : super(key: key); @@ -428,55 +442,84 @@ class InAppWebView extends StatefulWidget implements WebView { androidOnReceivedLoginRequest; @override - final void Function(InAppWebViewController controller)? onDidReceiveServerRedirectForProvisionalNavigation; + final void Function(InAppWebViewController controller)? + onDidReceiveServerRedirectForProvisionalNavigation; @override - final Future Function(InAppWebViewController controller, Uri? url)? onFormResubmission; + final Future Function( + InAppWebViewController controller, Uri? url)? onFormResubmission; @override - final void Function(InAppWebViewController controller)? onGeolocationPermissionsHidePrompt; + final void Function(InAppWebViewController controller)? + onGeolocationPermissionsHidePrompt; @override - final Future Function(InAppWebViewController controller, String origin)? onGeolocationPermissionsShowPrompt; + final Future Function( + InAppWebViewController controller, String origin)? + onGeolocationPermissionsShowPrompt; @override - final Future Function(InAppWebViewController controller, JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload; + final Future Function( + InAppWebViewController controller, + JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload; @override - final Future Function(InAppWebViewController controller, NavigationResponse navigationResponse)? onNavigationResponse; + final Future Function( + InAppWebViewController controller, + NavigationResponse navigationResponse)? onNavigationResponse; @override - final Future Function(InAppWebViewController controller, String origin, List resources)? onPermissionRequest; + final Future Function( + InAppWebViewController controller, + String origin, + List resources)? onPermissionRequest; @override - final void Function(InAppWebViewController controller, Uint8List icon)? onReceivedIcon; + final void Function(InAppWebViewController controller, Uint8List icon)? + onReceivedIcon; @override - final void Function(InAppWebViewController controller, LoginRequest loginRequest)? onReceivedLoginRequest; + final void Function( + InAppWebViewController controller, LoginRequest loginRequest)? + onReceivedLoginRequest; @override - final void Function(InAppWebViewController controller, Uri url, bool precomposed)? onReceivedTouchIconUrl; + final void Function( + InAppWebViewController controller, Uri url, bool precomposed)? + onReceivedTouchIconUrl; @override - final void Function(InAppWebViewController controller, RenderProcessGoneDetail detail)? onRenderProcessGone; + final void Function( + InAppWebViewController controller, RenderProcessGoneDetail detail)? + onRenderProcessGone; @override - final Future Function(InAppWebViewController controller, Uri? url)? onRenderProcessResponsive; + final Future Function( + InAppWebViewController controller, Uri? url)? onRenderProcessResponsive; @override - final Future Function(InAppWebViewController controller, Uri? url)? onRenderProcessUnresponsive; + final Future Function( + InAppWebViewController controller, Uri? url)? onRenderProcessUnresponsive; @override - final Future Function(InAppWebViewController controller, Uri url, SafeBrowsingThreat? threatType)? onSafeBrowsingHit; + final Future Function( + InAppWebViewController controller, + Uri url, + SafeBrowsingThreat? threatType)? onSafeBrowsingHit; @override - final void Function(InAppWebViewController controller)? onWebContentProcessDidTerminate; + final void Function(InAppWebViewController controller)? + onWebContentProcessDidTerminate; @override - final Future Function(InAppWebViewController controller, URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS; + final Future Function( + InAppWebViewController controller, + URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS; @override - final Future Function(InAppWebViewController controller, WebResourceRequest request)? shouldInterceptRequest; + final Future Function( + InAppWebViewController controller, WebResourceRequest request)? + shouldInterceptRequest; } class _InAppWebViewState extends State { @@ -484,16 +527,24 @@ class _InAppWebViewState extends State { @override Widget build(BuildContext context) { - Map initialSettings = (widget.initialSettings != null ? - widget.initialSettings?.toMap() : - // ignore: deprecated_member_use_from_same_package - widget.initialOptions?.toMap()) ?? {}; + Map initialSettings = widget.initialSettings?.toMap() ?? + // ignore: deprecated_member_use_from_same_package + widget.initialOptions?.toMap() ?? + {}; + + Map pullToRefreshSettings = + widget.pullToRefreshController?.settings.toMap() ?? + // ignore: deprecated_member_use_from_same_package + widget.pullToRefreshController?.options.toMap() ?? + PullToRefreshSettings(enabled: false).toMap(); if (defaultTargetPlatform == TargetPlatform.android) { - var useHybridComposition = (widget.initialSettings != null ? - widget.initialSettings?.useHybridComposition : - // ignore: deprecated_member_use_from_same_package - widget.initialOptions?.android.useHybridComposition) ?? false; + var useHybridComposition = (widget.initialSettings != null + ? widget.initialSettings?.useHybridComposition + : + // ignore: deprecated_member_use_from_same_package + widget.initialOptions?.android.useHybridComposition) ?? + false; if (!useHybridComposition && widget.pullToRefreshController != null) { throw new Exception( @@ -530,9 +581,7 @@ class _InAppWebViewState extends State { 'initialUserScripts': widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], - 'pullToRefreshOptions': - widget.pullToRefreshController?.options.toMap() ?? - PullToRefreshOptions(enabled: false).toMap() + 'pullToRefreshSettings': pullToRefreshSettings }, creationParamsCodec: const StandardMessageCodec(), ) @@ -558,9 +607,7 @@ class _InAppWebViewState extends State { 'implementation': widget.implementation.toValue(), 'initialUserScripts': widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], - 'pullToRefreshOptions': - widget.pullToRefreshController?.options.toMap() ?? - PullToRefreshOptions(enabled: false).toMap() + 'pullToRefreshSettings': pullToRefreshSettings }, creationParamsCodec: const StandardMessageCodec(), ); @@ -580,9 +627,7 @@ class _InAppWebViewState extends State { 'implementation': widget.implementation.toValue(), 'initialUserScripts': widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], - 'pullToRefreshOptions': - widget.pullToRefreshController?.options.toMap() ?? - PullToRefreshOptions(enabled: false).toMap() + 'pullToRefreshSettings': pullToRefreshSettings }, creationParamsCodec: const StandardMessageCodec(), ); diff --git a/lib/src/in_app_webview/in_app_webview_controller.dart b/lib/src/in_app_webview/in_app_webview_controller.dart index 6f1f750a..5c32faa3 100644 --- a/lib/src/in_app_webview/in_app_webview_controller.dart +++ b/lib/src/in_app_webview/in_app_webview_controller.dart @@ -46,7 +46,8 @@ final _JAVASCRIPT_HANDLER_FORBIDDEN_NAMES = UnmodifiableListView([ /// ///If you are using the [InAppWebView] widget, an [InAppWebViewController] instance can be obtained by setting the [InAppWebView.onWebViewCreated] ///callback. Instead, if you are using an [InAppBrowser] instance, you can get it through the [InAppBrowser.webViewController] attribute. -class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWebViewControllerMixin { +class InAppWebViewController + with AndroidInAppWebViewControllerMixin, IOSInAppWebViewControllerMixin { WebView? _webview; late MethodChannel _channel; static MethodChannel _staticChannel = IN_APP_WEBVIEW_STATIC_CHANNEL; @@ -275,22 +276,30 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe case "onGeolocationPermissionsShowPrompt": if ((_webview != null && (_webview!.onGeolocationPermissionsShowPrompt != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnGeolocationPermissionsShowPrompt != null)) || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnGeolocationPermissionsShowPrompt != + null)) || _inAppBrowser != null) { String origin = call.arguments["origin"]; if (_webview != null) { if (_webview!.onGeolocationPermissionsShowPrompt != null) - return (await _webview!.onGeolocationPermissionsShowPrompt!(this, origin))?.toMap(); + return (await _webview!.onGeolocationPermissionsShowPrompt!( + this, origin)) + ?.toMap(); else { - // ignore: deprecated_member_use_from_same_package - return (await _webview!.androidOnGeolocationPermissionsShowPrompt!(this, origin))?.toMap(); + return (await _webview! + // ignore: deprecated_member_use_from_same_package + .androidOnGeolocationPermissionsShowPrompt!(this, origin)) + ?.toMap(); } } else { - return ((await _inAppBrowser!.onGeolocationPermissionsShowPrompt(origin)) ?? - // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.androidOnGeolocationPermissionsShowPrompt(origin)))?.toMap(); + return ((await _inAppBrowser! + .onGeolocationPermissionsShowPrompt(origin)) ?? + (await _inAppBrowser! + // ignore: deprecated_member_use_from_same_package + .androidOnGeolocationPermissionsShowPrompt(origin))) + ?.toMap(); } } break; @@ -305,8 +314,7 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe // ignore: deprecated_member_use_from_same_package _webview!.androidOnGeolocationPermissionsHidePrompt!(this); } - } - else if (_inAppBrowser != null) { + } else if (_inAppBrowser != null) { _inAppBrowser!.onGeolocationPermissionsHidePrompt(); // ignore: deprecated_member_use_from_same_package _inAppBrowser!.androidOnGeolocationPermissionsHidePrompt(); @@ -315,8 +323,8 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe case "shouldInterceptRequest": if ((_webview != null && (_webview!.shouldInterceptRequest != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidShouldInterceptRequest != null)) || + // ignore: deprecated_member_use_from_same_package + _webview!.androidShouldInterceptRequest != null)) || _inAppBrowser != null) { Map arguments = call.arguments.cast(); @@ -324,69 +332,84 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe if (_webview != null) { if (_webview!.shouldInterceptRequest != null) - return (await _webview!.shouldInterceptRequest!(this, request))?.toMap(); + return (await _webview!.shouldInterceptRequest!(this, request)) + ?.toMap(); else { // ignore: deprecated_member_use_from_same_package - return (await _webview!.androidShouldInterceptRequest!(this, request))?.toMap(); + return (await _webview!.androidShouldInterceptRequest!( + this, request)) + ?.toMap(); } } else { return ((await _inAppBrowser!.shouldInterceptRequest(request)) ?? - // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.androidShouldInterceptRequest(request)))?.toMap(); + (await _inAppBrowser! + // ignore: deprecated_member_use_from_same_package + .androidShouldInterceptRequest(request))) + ?.toMap(); } } break; case "onRenderProcessUnresponsive": if ((_webview != null && (_webview!.onRenderProcessUnresponsive != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnRenderProcessUnresponsive != null)) || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnRenderProcessUnresponsive != null)) || _inAppBrowser != null) { String? url = call.arguments["url"]; Uri? uri = url != null ? Uri.parse(url) : null; if (_webview != null) { if (_webview!.onRenderProcessUnresponsive != null) - return (await _webview!.onRenderProcessUnresponsive!(this, uri))?.toMap(); + return (await _webview!.onRenderProcessUnresponsive!(this, uri)) + ?.toMap(); else { // ignore: deprecated_member_use_from_same_package - return (await _webview!.androidOnRenderProcessUnresponsive!(this, uri))?.toMap(); + return (await _webview!.androidOnRenderProcessUnresponsive!( + this, uri)) + ?.toMap(); } } else { return ((await _inAppBrowser!.onRenderProcessUnresponsive(uri)) ?? - // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.androidOnRenderProcessUnresponsive(uri)))?.toMap(); + (await _inAppBrowser! + // ignore: deprecated_member_use_from_same_package + .androidOnRenderProcessUnresponsive(uri))) + ?.toMap(); } } break; case "onRenderProcessResponsive": if ((_webview != null && (_webview!.onRenderProcessResponsive != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnRenderProcessResponsive != null)) || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnRenderProcessResponsive != null)) || _inAppBrowser != null) { String? url = call.arguments["url"]; Uri? uri = url != null ? Uri.parse(url) : null; if (_webview != null) { if (_webview!.onRenderProcessResponsive != null) - return (await _webview!.onRenderProcessResponsive!(this, uri))?.toMap(); + return (await _webview!.onRenderProcessResponsive!(this, uri)) + ?.toMap(); else { // ignore: deprecated_member_use_from_same_package - return (await _webview!.androidOnRenderProcessResponsive!(this, uri))?.toMap(); + return (await _webview!.androidOnRenderProcessResponsive!( + this, uri)) + ?.toMap(); } } else { return ((await _inAppBrowser!.onRenderProcessResponsive(uri)) ?? - // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.androidOnRenderProcessResponsive(uri)))?.toMap(); + (await _inAppBrowser! + // ignore: deprecated_member_use_from_same_package + .androidOnRenderProcessResponsive(uri))) + ?.toMap(); } } break; case "onRenderProcessGone": if ((_webview != null && (_webview!.onRenderProcessGone != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnRenderProcessGone != null)) || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnRenderProcessGone != null)) || _inAppBrowser != null) { Map arguments = call.arguments.cast(); @@ -400,8 +423,7 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe // ignore: deprecated_member_use_from_same_package _webview!.androidOnRenderProcessGone!(this, detail); } - } - else if (_inAppBrowser != null) { + } else if (_inAppBrowser != null) { _inAppBrowser!.onRenderProcessGone(detail); // ignore: deprecated_member_use_from_same_package _inAppBrowser!.androidOnRenderProcessGone(detail); @@ -410,9 +432,9 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe break; case "onFormResubmission": if ((_webview != null && - (_webview!.onFormResubmission != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnFormResubmission != null)) || + (_webview!.onFormResubmission != null || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnFormResubmission != null)) || _inAppBrowser != null) { String? url = call.arguments["url"]; Uri? uri = url != null ? Uri.parse(url) : null; @@ -422,12 +444,14 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe return (await _webview!.onFormResubmission!(this, uri))?.toMap(); else { // ignore: deprecated_member_use_from_same_package - return (await _webview!.androidOnFormResubmission!(this, uri))?.toMap(); + return (await _webview!.androidOnFormResubmission!(this, uri)) + ?.toMap(); } } else { return ((await _inAppBrowser!.onFormResubmission(uri)) ?? - // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.androidOnFormResubmission(uri)))?.toMap(); + // ignore: deprecated_member_use_from_same_package + (await _inAppBrowser!.androidOnFormResubmission(uri))) + ?.toMap(); } } break; @@ -455,10 +479,10 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe } break; case "onReceivedIcon": - if ((_webview != null && ( - _webview!.onReceivedIcon != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnReceivedIcon != null)) || + if ((_webview != null && + (_webview!.onReceivedIcon != null || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnReceivedIcon != null)) || _inAppBrowser != null) { Uint8List icon = Uint8List.fromList(call.arguments["icon"].cast()); @@ -480,8 +504,8 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe case "onReceivedTouchIconUrl": if ((_webview != null && (_webview!.onReceivedTouchIconUrl != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnReceivedTouchIconUrl != null)) || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnReceivedTouchIconUrl != null)) || _inAppBrowser != null) { String url = call.arguments["url"]; bool precomposed = call.arguments["precomposed"]; @@ -545,10 +569,10 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe } break; case "onJsBeforeUnload": - if ((_webview != null && ( - _webview!.onJsBeforeUnload != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnJsBeforeUnload != null)) || + if ((_webview != null && + (_webview!.onJsBeforeUnload != null || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnJsBeforeUnload != null)) || _inAppBrowser != null) { Map arguments = call.arguments.cast(); @@ -557,23 +581,30 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe if (_webview != null) { if (_webview!.onJsBeforeUnload != null) - return (await _webview!.onJsBeforeUnload!(this, jsBeforeUnloadRequest))?.toMap(); + return (await _webview!.onJsBeforeUnload!( + this, jsBeforeUnloadRequest)) + ?.toMap(); else { // ignore: deprecated_member_use_from_same_package - return (await _webview!.androidOnJsBeforeUnload!(this, jsBeforeUnloadRequest))?.toMap(); + return (await _webview!.androidOnJsBeforeUnload!( + this, jsBeforeUnloadRequest)) + ?.toMap(); } } else { - return ((await _inAppBrowser!.onJsBeforeUnload(jsBeforeUnloadRequest)) ?? - // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.androidOnJsBeforeUnload(jsBeforeUnloadRequest)))?.toMap(); + return ((await _inAppBrowser! + .onJsBeforeUnload(jsBeforeUnloadRequest)) ?? + (await _inAppBrowser! + // ignore: deprecated_member_use_from_same_package + .androidOnJsBeforeUnload(jsBeforeUnloadRequest))) + ?.toMap(); } } break; case "onSafeBrowsingHit": - if ((_webview != null && ( - _webview!.onSafeBrowsingHit != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnSafeBrowsingHit != null)) || + if ((_webview != null && + (_webview!.onSafeBrowsingHit != null || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnSafeBrowsingHit != null)) || _inAppBrowser != null) { String url = call.arguments["url"]; SafeBrowsingThreat? threatType = @@ -582,23 +613,28 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe if (_webview != null) { if (_webview!.onSafeBrowsingHit != null) - return (await _webview!.onSafeBrowsingHit!(this, uri, threatType))?.toMap(); + return (await _webview!.onSafeBrowsingHit!(this, uri, threatType)) + ?.toMap(); else { // ignore: deprecated_member_use_from_same_package - return (await _webview!.androidOnSafeBrowsingHit!(this, uri, threatType))?.toMap(); + return (await _webview!.androidOnSafeBrowsingHit!( + this, uri, threatType)) + ?.toMap(); } } else { return ((await _inAppBrowser!.onSafeBrowsingHit(uri, threatType)) ?? - // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.androidOnSafeBrowsingHit(uri, threatType)))?.toMap(); + (await _inAppBrowser! + // ignore: deprecated_member_use_from_same_package + .androidOnSafeBrowsingHit(uri, threatType))) + ?.toMap(); } } break; case "onReceivedLoginRequest": if ((_webview != null && (_webview!.onReceivedLoginRequest != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnReceivedLoginRequest != null)) || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnReceivedLoginRequest != null)) || _inAppBrowser != null) { Map arguments = call.arguments.cast(); @@ -689,23 +725,30 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe case "onPermissionRequest": if ((_webview != null && (_webview!.onPermissionRequest != null || - // ignore: deprecated_member_use_from_same_package - _webview!.androidOnPermissionRequest != null)) || + // ignore: deprecated_member_use_from_same_package + _webview!.androidOnPermissionRequest != null)) || _inAppBrowser != null) { String origin = call.arguments["origin"]; List resources = call.arguments["resources"].cast(); if (_webview != null) { if (_webview!.onPermissionRequest != null) - return (await _webview!.onPermissionRequest!(this, origin, resources))?.toMap(); + return (await _webview!.onPermissionRequest!( + this, origin, resources)) + ?.toMap(); else { // ignore: deprecated_member_use_from_same_package - return (await _webview!.androidOnPermissionRequest!(this, origin, resources))?.toMap(); + return (await _webview!.androidOnPermissionRequest!( + this, origin, resources)) + ?.toMap(); } } else { - return ((await _inAppBrowser!.onPermissionRequest(origin, resources)) ?? - // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.androidOnPermissionRequest(origin, resources)))?.toMap(); + return ((await _inAppBrowser! + .onPermissionRequest(origin, resources)) ?? + (await _inAppBrowser! + // ignore: deprecated_member_use_from_same_package + .androidOnPermissionRequest(origin, resources))) + ?.toMap(); } } break; @@ -724,8 +767,8 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe case "onWebContentProcessDidTerminate": if (_webview != null && (_webview!.onWebContentProcessDidTerminate != null || - // ignore: deprecated_member_use_from_same_package - _webview!.iosOnWebContentProcessDidTerminate != null)) { + // ignore: deprecated_member_use_from_same_package + _webview!.iosOnWebContentProcessDidTerminate != null)) { if (_webview!.onWebContentProcessDidTerminate != null) _webview!.onWebContentProcessDidTerminate!(this); else { @@ -751,55 +794,70 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe break; case "onDidReceiveServerRedirectForProvisionalNavigation": if (_webview != null && - (_webview!.onDidReceiveServerRedirectForProvisionalNavigation != null || - // ignore: deprecated_member_use_from_same_package - _webview!.iosOnDidReceiveServerRedirectForProvisionalNavigation != null)) { - if (_webview!.onDidReceiveServerRedirectForProvisionalNavigation != null) + (_webview!.onDidReceiveServerRedirectForProvisionalNavigation != + null || + _webview! + // ignore: deprecated_member_use_from_same_package + .iosOnDidReceiveServerRedirectForProvisionalNavigation != + null)) { + if (_webview!.onDidReceiveServerRedirectForProvisionalNavigation != + null) _webview!.onDidReceiveServerRedirectForProvisionalNavigation!(this); else { - // ignore: deprecated_member_use_from_same_package - _webview!.iosOnDidReceiveServerRedirectForProvisionalNavigation!(this); + _webview! + // ignore: deprecated_member_use_from_same_package + .iosOnDidReceiveServerRedirectForProvisionalNavigation!(this); } } else if (_inAppBrowser != null) { _inAppBrowser!.onDidReceiveServerRedirectForProvisionalNavigation(); - // ignore: deprecated_member_use_from_same_package - _inAppBrowser!.iosOnDidReceiveServerRedirectForProvisionalNavigation(); + _inAppBrowser! + // ignore: deprecated_member_use_from_same_package + .iosOnDidReceiveServerRedirectForProvisionalNavigation(); } break; case "onNavigationResponse": - if ((_webview != null && ( - _webview!.onNavigationResponse != null || - // ignore: deprecated_member_use_from_same_package - _webview!.iosOnNavigationResponse != null)) || + if ((_webview != null && + (_webview!.onNavigationResponse != null || + // ignore: deprecated_member_use_from_same_package + _webview!.iosOnNavigationResponse != null)) || _inAppBrowser != null) { Map arguments = call.arguments.cast(); // ignore: deprecated_member_use_from_same_package IOSWKNavigationResponse iosOnNavigationResponse = - // ignore: deprecated_member_use_from_same_package + // ignore: deprecated_member_use_from_same_package IOSWKNavigationResponse.fromMap(arguments)!; - NavigationResponse navigationResponse = NavigationResponse.fromMap(arguments)!; + NavigationResponse navigationResponse = + NavigationResponse.fromMap(arguments)!; if (_webview != null) { if (_webview!.onNavigationResponse != null) - return (await _webview!.onNavigationResponse!(this, navigationResponse))?.toMap(); + return (await _webview!.onNavigationResponse!( + this, navigationResponse)) + ?.toMap(); else { // ignore: deprecated_member_use_from_same_package - return (await _webview!.iosOnNavigationResponse!(this, iosOnNavigationResponse))?.toMap(); + return (await _webview!.iosOnNavigationResponse!( + this, iosOnNavigationResponse)) + ?.toMap(); } } else { - return (await _inAppBrowser!.onNavigationResponse(navigationResponse))?.toMap() ?? - // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.iosOnNavigationResponse(iosOnNavigationResponse))?.toMap(); + return (await _inAppBrowser! + .onNavigationResponse(navigationResponse)) + ?.toMap() ?? + (await _inAppBrowser! + // ignore: deprecated_member_use_from_same_package + .iosOnNavigationResponse(iosOnNavigationResponse)) + ?.toMap(); } } break; case "shouldAllowDeprecatedTLS": if ((_webview != null && (_webview!.shouldAllowDeprecatedTLS != null || - // ignore: deprecated_member_use_from_same_package - _webview!.iosShouldAllowDeprecatedTLS != null)) || + // ignore: deprecated_member_use_from_same_package + _webview!.iosShouldAllowDeprecatedTLS != null)) || _inAppBrowser != null) { Map arguments = call.arguments.cast(); @@ -808,15 +866,21 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe if (_webview != null) { if (_webview!.shouldAllowDeprecatedTLS != null) - return (await _webview!.shouldAllowDeprecatedTLS!(this, challenge))?.toMap(); + return (await _webview!.shouldAllowDeprecatedTLS!( + this, challenge)) + ?.toMap(); else { // ignore: deprecated_member_use_from_same_package - return (await _webview!.iosShouldAllowDeprecatedTLS!(this, challenge))?.toMap(); + return (await _webview!.iosShouldAllowDeprecatedTLS!( + this, challenge)) + ?.toMap(); } } else { - return (await _inAppBrowser!.shouldAllowDeprecatedTLS(challenge))?.toMap() ?? + return (await _inAppBrowser!.shouldAllowDeprecatedTLS(challenge)) + ?.toMap() ?? // ignore: deprecated_member_use_from_same_package - (await _inAppBrowser!.iosShouldAllowDeprecatedTLS(challenge))?.toMap(); + (await _inAppBrowser!.iosShouldAllowDeprecatedTLS(challenge)) + ?.toMap(); } } break; @@ -1327,8 +1391,8 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe Uri? iosAllowingReadAccessTo, Uri? allowingReadAccessTo}) async { assert(urlRequest.url != null && urlRequest.url.toString().isNotEmpty); - assert(allowingReadAccessTo == null || - allowingReadAccessTo.isScheme("file")); + assert( + allowingReadAccessTo == null || allowingReadAccessTo.isScheme("file")); assert(iosAllowingReadAccessTo == null || iosAllowingReadAccessTo.isScheme("file")); @@ -1387,8 +1451,8 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe @Deprecated('Use allowingReadAccessTo instead') Uri? iosAllowingReadAccessTo, Uri? allowingReadAccessTo}) async { - assert(allowingReadAccessTo == null || - allowingReadAccessTo.isScheme("file")); + assert( + allowingReadAccessTo == null || allowingReadAccessTo.isScheme("file")); assert(iosAllowingReadAccessTo == null || iosAllowingReadAccessTo.isScheme("file")); @@ -1821,7 +1885,7 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe Map args = {}; Map? settings = - await _channel.invokeMethod('getSettings', args); + await _channel.invokeMethod('getSettings', args); if (settings != null) { settings = settings.cast(); return InAppWebViewSettings.fromMap(settings as Map); @@ -2819,8 +2883,8 @@ class InAppWebViewController with AndroidInAppWebViewControllerMixin, IOSInAppWe static Future getCurrentWebViewPackage() async { Map args = {}; Map? packageInfo = - (await _staticChannel.invokeMethod('getCurrentWebViewPackage', args)) - ?.cast(); + (await _staticChannel.invokeMethod('getCurrentWebViewPackage', args)) + ?.cast(); return WebViewPackageInfo.fromMap(packageInfo); } diff --git a/lib/src/in_app_webview/in_app_webview_settings.dart b/lib/src/in_app_webview/in_app_webview_settings.dart index 6ba05f9c..5a4c09aa 100755 --- a/lib/src/in_app_webview/in_app_webview_settings.dart +++ b/lib/src/in_app_webview/in_app_webview_settings.dart @@ -33,9 +33,9 @@ class WebViewOptions { } } - ///This class represents all the WebView settings available. -class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOptions, IosOptions { +class InAppWebViewSettings + implements WebViewOptions, BrowserOptions, AndroidOptions, IosOptions { ///Set to `true` to be able to listen at the [WebView.shouldOverrideUrlLoading] event. The default value is `false`. /// ///**Supported Platforms/Implementations**: @@ -957,126 +957,127 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt InAppWebViewSettings( {this.useShouldOverrideUrlLoading = false, - this.useOnLoadResource = false, - this.useOnDownloadStart = false, - this.clearCache = false, - this.userAgent = "", - this.applicationNameForUserAgent = "", - this.javaScriptEnabled = true, - this.javaScriptCanOpenWindowsAutomatically = false, - this.mediaPlaybackRequiresUserGesture = true, - this.minimumFontSize, - this.verticalScrollBarEnabled = true, - this.horizontalScrollBarEnabled = true, - this.resourceCustomSchemes = const [], - this.contentBlockers = const [], - this.preferredContentMode = UserPreferredContentMode.RECOMMENDED, - this.useShouldInterceptAjaxRequest = false, - this.useShouldInterceptFetchRequest = false, - this.incognito = false, - this.cacheEnabled = true, - this.transparentBackground = false, - this.disableVerticalScroll = false, - this.disableHorizontalScroll = false, - this.disableContextMenu = false, - this.supportZoom = true, - this.allowFileAccessFromFileURLs = false, - this.allowUniversalAccessFromFileURLs = false, - this.textZoom = 100, - this.clearSessionCache = false, - this.builtInZoomControls = true, - this.displayZoomControls = false, - this.databaseEnabled = true, - this.domStorageEnabled = true, - this.useWideViewPort = true, - this.safeBrowsingEnabled = true, - this.mixedContentMode, - this.allowContentAccess = true, - this.allowFileAccess = true, - this.appCachePath, - this.blockNetworkImage = false, - this.blockNetworkLoads = false, - this.cacheMode = CacheMode.LOAD_DEFAULT, - this.cursiveFontFamily = "cursive", - this.defaultFixedFontSize = 16, - this.defaultFontSize = 16, - this.defaultTextEncodingName = "UTF-8", - this.disabledActionModeMenuItems, - this.fantasyFontFamily = "fantasy", - this.fixedFontFamily = "monospace", - this.forceDark = ForceDark.FORCE_DARK_OFF, - this.geolocationEnabled = true, - this.layoutAlgorithm, - this.loadWithOverviewMode = true, - this.loadsImagesAutomatically = true, - this.minimumLogicalFontSize = 8, - this.needInitialFocus = true, - this.offscreenPreRaster = false, - this.sansSerifFontFamily = "sans-serif", - this.serifFontFamily = "sans-serif", - this.standardFontFamily = "sans-serif", - this.saveFormData = true, - this.thirdPartyCookiesEnabled = true, - this.hardwareAcceleration = true, - this.initialScale = 0, - this.supportMultipleWindows = false, - this.regexToCancelSubFramesLoading, - this.useHybridComposition = false, - this.useShouldInterceptRequest = false, - this.useOnRenderProcessGone = false, - this.overScrollMode = OverScrollMode.OVER_SCROLL_IF_CONTENT_SCROLLS, - this.networkAvailable, - this.scrollBarStyle = ScrollBarStyle.SCROLLBARS_INSIDE_OVERLAY, - this.verticalScrollbarPosition = - VerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT, - this.scrollBarDefaultDelayBeforeFade, - this.scrollbarFadingEnabled = true, - this.scrollBarFadeDuration, - this.rendererPriorityPolicy, - this.disableDefaultErrorPage = false, - this.verticalScrollbarThumbColor, - this.verticalScrollbarTrackColor, - this.horizontalScrollbarThumbColor, - this.horizontalScrollbarTrackColor, - this.disallowOverScroll = false, - this.enableViewportScale = false, - this.suppressesIncrementalRendering = false, - this.allowsAirPlayForMediaPlayback = true, - this.allowsBackForwardNavigationGestures = true, - this.allowsLinkPreview = true, - this.ignoresViewportScaleLimits = false, - this.allowsInlineMediaPlayback = false, - this.allowsPictureInPictureMediaPlayback = true, - this.isFraudulentWebsiteWarningEnabled = true, - this.selectionGranularity = SelectionGranularity.DYNAMIC, - this.dataDetectorTypes = const [DataDetectorTypes.NONE], - this.sharedCookiesEnabled = false, - this.automaticallyAdjustsScrollIndicatorInsets = false, - this.accessibilityIgnoresInvertColors = false, - this.decelerationRate = ScrollViewDecelerationRate.NORMAL, - this.alwaysBounceVertical = false, - this.alwaysBounceHorizontal = false, - this.scrollsToTop = true, - this.isPagingEnabled = false, - this.maximumZoomScale = 1.0, - this.minimumZoomScale = 1.0, - this.contentInsetAdjustmentBehavior = - ScrollViewContentInsetAdjustmentBehavior.NEVER, - this.isDirectionalLockEnabled = false, - this.mediaType, - this.pageZoom = 1.0, - this.limitsNavigationsToAppBoundDomains = false, - this.useOnNavigationResponse = false, - this.applePayAPIEnabled = false, - this.allowingReadAccessTo, - this.disableLongPressContextMenuOnLinks = false, - this.disableInputAccessoryView = false}) { + this.useOnLoadResource = false, + this.useOnDownloadStart = false, + this.clearCache = false, + this.userAgent = "", + this.applicationNameForUserAgent = "", + this.javaScriptEnabled = true, + this.javaScriptCanOpenWindowsAutomatically = false, + this.mediaPlaybackRequiresUserGesture = true, + this.minimumFontSize, + this.verticalScrollBarEnabled = true, + this.horizontalScrollBarEnabled = true, + this.resourceCustomSchemes = const [], + this.contentBlockers = const [], + this.preferredContentMode = UserPreferredContentMode.RECOMMENDED, + this.useShouldInterceptAjaxRequest = false, + this.useShouldInterceptFetchRequest = false, + this.incognito = false, + this.cacheEnabled = true, + this.transparentBackground = false, + this.disableVerticalScroll = false, + this.disableHorizontalScroll = false, + this.disableContextMenu = false, + this.supportZoom = true, + this.allowFileAccessFromFileURLs = false, + this.allowUniversalAccessFromFileURLs = false, + this.textZoom = 100, + this.clearSessionCache = false, + this.builtInZoomControls = true, + this.displayZoomControls = false, + this.databaseEnabled = true, + this.domStorageEnabled = true, + this.useWideViewPort = true, + this.safeBrowsingEnabled = true, + this.mixedContentMode, + this.allowContentAccess = true, + this.allowFileAccess = true, + this.appCachePath, + this.blockNetworkImage = false, + this.blockNetworkLoads = false, + this.cacheMode = CacheMode.LOAD_DEFAULT, + this.cursiveFontFamily = "cursive", + this.defaultFixedFontSize = 16, + this.defaultFontSize = 16, + this.defaultTextEncodingName = "UTF-8", + this.disabledActionModeMenuItems, + this.fantasyFontFamily = "fantasy", + this.fixedFontFamily = "monospace", + this.forceDark = ForceDark.FORCE_DARK_OFF, + this.geolocationEnabled = true, + this.layoutAlgorithm, + this.loadWithOverviewMode = true, + this.loadsImagesAutomatically = true, + this.minimumLogicalFontSize = 8, + this.needInitialFocus = true, + this.offscreenPreRaster = false, + this.sansSerifFontFamily = "sans-serif", + this.serifFontFamily = "sans-serif", + this.standardFontFamily = "sans-serif", + this.saveFormData = true, + this.thirdPartyCookiesEnabled = true, + this.hardwareAcceleration = true, + this.initialScale = 0, + this.supportMultipleWindows = false, + this.regexToCancelSubFramesLoading, + this.useHybridComposition = false, + this.useShouldInterceptRequest = false, + this.useOnRenderProcessGone = false, + this.overScrollMode = OverScrollMode.OVER_SCROLL_IF_CONTENT_SCROLLS, + this.networkAvailable, + this.scrollBarStyle = ScrollBarStyle.SCROLLBARS_INSIDE_OVERLAY, + this.verticalScrollbarPosition = + VerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT, + this.scrollBarDefaultDelayBeforeFade, + this.scrollbarFadingEnabled = true, + this.scrollBarFadeDuration, + this.rendererPriorityPolicy, + this.disableDefaultErrorPage = false, + this.verticalScrollbarThumbColor, + this.verticalScrollbarTrackColor, + this.horizontalScrollbarThumbColor, + this.horizontalScrollbarTrackColor, + this.disallowOverScroll = false, + this.enableViewportScale = false, + this.suppressesIncrementalRendering = false, + this.allowsAirPlayForMediaPlayback = true, + this.allowsBackForwardNavigationGestures = true, + this.allowsLinkPreview = true, + this.ignoresViewportScaleLimits = false, + this.allowsInlineMediaPlayback = false, + this.allowsPictureInPictureMediaPlayback = true, + this.isFraudulentWebsiteWarningEnabled = true, + this.selectionGranularity = SelectionGranularity.DYNAMIC, + this.dataDetectorTypes = const [DataDetectorTypes.NONE], + this.sharedCookiesEnabled = false, + this.automaticallyAdjustsScrollIndicatorInsets = false, + this.accessibilityIgnoresInvertColors = false, + this.decelerationRate = ScrollViewDecelerationRate.NORMAL, + this.alwaysBounceVertical = false, + this.alwaysBounceHorizontal = false, + this.scrollsToTop = true, + this.isPagingEnabled = false, + this.maximumZoomScale = 1.0, + this.minimumZoomScale = 1.0, + this.contentInsetAdjustmentBehavior = + ScrollViewContentInsetAdjustmentBehavior.NEVER, + this.isDirectionalLockEnabled = false, + this.mediaType, + this.pageZoom = 1.0, + this.limitsNavigationsToAppBoundDomains = false, + this.useOnNavigationResponse = false, + this.applePayAPIEnabled = false, + this.allowingReadAccessTo, + this.disableLongPressContextMenuOnLinks = false, + this.disableInputAccessoryView = false}) { if (this.minimumFontSize == null) this.minimumFontSize = - defaultTargetPlatform == TargetPlatform.android ? 8 : 0; + defaultTargetPlatform == TargetPlatform.android ? 8 : 0; assert(!this.resourceCustomSchemes.contains("http") && !this.resourceCustomSchemes.contains("https")); - assert(allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file")); + assert( + allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file")); } @override @@ -1099,7 +1100,7 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt "applicationNameForUserAgent": applicationNameForUserAgent, "javaScriptEnabled": javaScriptEnabled, "javaScriptCanOpenWindowsAutomatically": - javaScriptCanOpenWindowsAutomatically, + javaScriptCanOpenWindowsAutomatically, "mediaPlaybackRequiresUserGesture": mediaPlaybackRequiresUserGesture, "verticalScrollBarEnabled": verticalScrollBarEnabled, "horizontalScrollBarEnabled": horizontalScrollBarEnabled, @@ -1177,18 +1178,18 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt "suppressesIncrementalRendering": suppressesIncrementalRendering, "allowsAirPlayForMediaPlayback": allowsAirPlayForMediaPlayback, "allowsBackForwardNavigationGestures": - allowsBackForwardNavigationGestures, + allowsBackForwardNavigationGestures, "allowsLinkPreview": allowsLinkPreview, "ignoresViewportScaleLimits": ignoresViewportScaleLimits, "allowsInlineMediaPlayback": allowsInlineMediaPlayback, "allowsPictureInPictureMediaPlayback": - allowsPictureInPictureMediaPlayback, + allowsPictureInPictureMediaPlayback, "isFraudulentWebsiteWarningEnabled": isFraudulentWebsiteWarningEnabled, "selectionGranularity": selectionGranularity.toValue(), "dataDetectorTypes": dataDetectorTypesList, "sharedCookiesEnabled": sharedCookiesEnabled, "automaticallyAdjustsScrollIndicatorInsets": - automaticallyAdjustsScrollIndicatorInsets, + automaticallyAdjustsScrollIndicatorInsets, "accessibilityIgnoresInvertColors": accessibilityIgnoresInvertColors, "decelerationRate": decelerationRate.toValue(), "alwaysBounceVertical": alwaysBounceVertical, @@ -1198,7 +1199,7 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt "maximumZoomScale": maximumZoomScale, "minimumZoomScale": minimumZoomScale, "contentInsetAdjustmentBehavior": - contentInsetAdjustmentBehavior.toValue(), + contentInsetAdjustmentBehavior.toValue(), "isDirectionalLockEnabled": isDirectionalLockEnabled, "mediaType": mediaType, "pageZoom": pageZoom, @@ -1223,10 +1224,9 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt } List dataDetectorTypes = []; List dataDetectorTypesList = - List.from(map["dataDetectorTypes"] ?? []); + List.from(map["dataDetectorTypes"] ?? []); dataDetectorTypesList.forEach((dataDetectorTypeValue) { - var dataDetectorType = - DataDetectorTypes.fromValue(dataDetectorTypeValue); + var dataDetectorType = DataDetectorTypes.fromValue(dataDetectorTypeValue); if (dataDetectorType != null) { dataDetectorTypes.add(dataDetectorType); } @@ -1241,20 +1241,20 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt instance.applicationNameForUserAgent = map["applicationNameForUserAgent"]; instance.javaScriptEnabled = map["javaScriptEnabled"]; instance.javaScriptCanOpenWindowsAutomatically = - map["javaScriptCanOpenWindowsAutomatically"]; + map["javaScriptCanOpenWindowsAutomatically"]; instance.mediaPlaybackRequiresUserGesture = - map["mediaPlaybackRequiresUserGesture"]; + map["mediaPlaybackRequiresUserGesture"]; instance.verticalScrollBarEnabled = map["verticalScrollBarEnabled"]; instance.horizontalScrollBarEnabled = map["horizontalScrollBarEnabled"]; instance.resourceCustomSchemes = - List.from(map["resourceCustomSchemes"] ?? []); + List.from(map["resourceCustomSchemes"] ?? []); instance.contentBlockers = contentBlockers; instance.preferredContentMode = UserPreferredContentMode.fromValue(map["preferredContentMode"]); instance.useShouldInterceptAjaxRequest = - map["useShouldInterceptAjaxRequest"]; + map["useShouldInterceptAjaxRequest"]; instance.useShouldInterceptFetchRequest = - map["useShouldInterceptFetchRequest"]; + map["useShouldInterceptFetchRequest"]; instance.incognito = map["incognito"]; instance.cacheEnabled = map["cacheEnabled"]; instance.transparentBackground = map["transparentBackground"]; @@ -1264,7 +1264,7 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt instance.supportZoom = map["supportZoom"]; instance.allowFileAccessFromFileURLs = map["allowFileAccessFromFileURLs"]; instance.allowUniversalAccessFromFileURLs = - map["allowUniversalAccessFromFileURLs"]; + map["allowUniversalAccessFromFileURLs"]; instance.textZoom = map["textZoom"]; instance.clearSessionCache = map["clearSessionCache"]; instance.builtInZoomControls = map["builtInZoomControls"]; @@ -1307,20 +1307,17 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt instance.hardwareAcceleration = map["hardwareAcceleration"]; instance.supportMultipleWindows = map["supportMultipleWindows"]; instance.regexToCancelSubFramesLoading = - map["regexToCancelSubFramesLoading"]; + map["regexToCancelSubFramesLoading"]; instance.useHybridComposition = map["useHybridComposition"]; instance.useShouldInterceptRequest = map["useShouldInterceptRequest"]; instance.useOnRenderProcessGone = map["useOnRenderProcessGone"]; - instance.overScrollMode = - OverScrollMode.fromValue(map["overScrollMode"]); + instance.overScrollMode = OverScrollMode.fromValue(map["overScrollMode"]); instance.networkAvailable = map["networkAvailable"]; - instance.scrollBarStyle = - ScrollBarStyle.fromValue(map["scrollBarStyle"]); + instance.scrollBarStyle = ScrollBarStyle.fromValue(map["scrollBarStyle"]); instance.verticalScrollbarPosition = - VerticalScrollbarPosition.fromValue( - map["verticalScrollbarPosition"]); + VerticalScrollbarPosition.fromValue(map["verticalScrollbarPosition"]); instance.scrollBarDefaultDelayBeforeFade = - map["scrollBarDefaultDelayBeforeFade"]; + map["scrollBarDefaultDelayBeforeFade"]; instance.scrollbarFadingEnabled = map["scrollbarFadingEnabled"]; instance.scrollBarFadeDuration = map["scrollBarFadeDuration"]; instance.rendererPriorityPolicy = RendererPriorityPolicy.fromMap( @@ -1337,28 +1334,28 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt instance.disallowOverScroll = map["disallowOverScroll"]; instance.enableViewportScale = map["enableViewportScale"]; instance.suppressesIncrementalRendering = - map["suppressesIncrementalRendering"]; + map["suppressesIncrementalRendering"]; instance.allowsAirPlayForMediaPlayback = - map["allowsAirPlayForMediaPlayback"]; + map["allowsAirPlayForMediaPlayback"]; instance.allowsBackForwardNavigationGestures = - map["allowsBackForwardNavigationGestures"]; + map["allowsBackForwardNavigationGestures"]; instance.allowsLinkPreview = map["allowsLinkPreview"]; instance.ignoresViewportScaleLimits = map["ignoresViewportScaleLimits"]; instance.allowsInlineMediaPlayback = map["allowsInlineMediaPlayback"]; instance.allowsPictureInPictureMediaPlayback = - map["allowsPictureInPictureMediaPlayback"]; + map["allowsPictureInPictureMediaPlayback"]; instance.isFraudulentWebsiteWarningEnabled = - map["isFraudulentWebsiteWarningEnabled"]; + map["isFraudulentWebsiteWarningEnabled"]; instance.selectionGranularity = - SelectionGranularity.fromValue(map["selectionGranularity"])!; + SelectionGranularity.fromValue(map["selectionGranularity"])!; instance.dataDetectorTypes = dataDetectorTypes; instance.sharedCookiesEnabled = map["sharedCookiesEnabled"]; instance.automaticallyAdjustsScrollIndicatorInsets = - map["automaticallyAdjustsScrollIndicatorInsets"]; + map["automaticallyAdjustsScrollIndicatorInsets"]; instance.accessibilityIgnoresInvertColors = - map["accessibilityIgnoresInvertColors"]; + map["accessibilityIgnoresInvertColors"]; instance.decelerationRate = - ScrollViewDecelerationRate.fromValue(map["decelerationRate"])!; + ScrollViewDecelerationRate.fromValue(map["decelerationRate"])!; instance.alwaysBounceVertical = map["alwaysBounceVertical"]; instance.alwaysBounceHorizontal = map["alwaysBounceHorizontal"]; instance.scrollsToTop = map["scrollsToTop"]; @@ -1366,20 +1363,20 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt instance.maximumZoomScale = map["maximumZoomScale"]; instance.minimumZoomScale = map["minimumZoomScale"]; instance.contentInsetAdjustmentBehavior = - ScrollViewContentInsetAdjustmentBehavior.fromValue( - map["contentInsetAdjustmentBehavior"])!; + ScrollViewContentInsetAdjustmentBehavior.fromValue( + map["contentInsetAdjustmentBehavior"])!; instance.isDirectionalLockEnabled = map["isDirectionalLockEnabled"]; instance.mediaType = map["mediaType"]; instance.pageZoom = map["pageZoom"]; instance.limitsNavigationsToAppBoundDomains = - map["limitsNavigationsToAppBoundDomains"]; + map["limitsNavigationsToAppBoundDomains"]; instance.useOnNavigationResponse = map["useOnNavigationResponse"]; instance.applePayAPIEnabled = map["applePayAPIEnabled"]; instance.allowingReadAccessTo = map["allowingReadAccessTo"] != null ? Uri.parse(map["allowingReadAccessTo"]) : null; instance.disableLongPressContextMenuOnLinks = - map["disableLongPressContextMenuOnLinks"]; + map["disableLongPressContextMenuOnLinks"]; instance.disableInputAccessoryView = map["disableInputAccessoryView"]; return instance; } @@ -1393,7 +1390,7 @@ class InAppWebViewSettings implements WebViewOptions, BrowserOptions, AndroidOpt String toString() { return toMap().toString(); } - + @override InAppWebViewSettings copy() { return InAppWebViewSettings.fromMap(this.toMap()); @@ -1660,7 +1657,6 @@ class InAppWebViewOptions }); } - var instance = InAppWebViewOptions(); instance.useShouldOverrideUrlLoading = map["useShouldOverrideUrlLoading"]; instance.useOnLoadResource = map["useOnLoadResource"]; diff --git a/lib/src/in_app_webview/ios/in_app_webview_controller.dart b/lib/src/in_app_webview/ios/in_app_webview_controller.dart index 67f911c7..1f0903ea 100644 --- a/lib/src/in_app_webview/ios/in_app_webview_controller.dart +++ b/lib/src/in_app_webview/ios/in_app_webview_controller.dart @@ -29,12 +29,13 @@ abstract class IOSInAppWebViewControllerMixin { ///**Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebView.createPdf](https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf)) Future createPdf( - // ignore: deprecated_member_use_from_same_package - {@Deprecated("Use pdfConfiguration instead") IOSWKPDFConfiguration? iosWKPdfConfiguration, - PDFConfiguration? pdfConfiguration}) async { + {@Deprecated("Use pdfConfiguration instead") + // ignore: deprecated_member_use_from_same_package + IOSWKPDFConfiguration? iosWKPdfConfiguration, + PDFConfiguration? pdfConfiguration}) async { Map args = {}; - args.putIfAbsent( - 'pdfConfiguration', () => pdfConfiguration?.toMap() ?? iosWKPdfConfiguration?.toMap()); + args.putIfAbsent('pdfConfiguration', + () => pdfConfiguration?.toMap() ?? iosWKPdfConfiguration?.toMap()); return await _channel.invokeMethod('createPdf', args); } diff --git a/lib/src/in_app_webview/webview.dart b/lib/src/in_app_webview/webview.dart index 3b7e6331..e955af1c 100644 --- a/lib/src/in_app_webview/webview.dart +++ b/lib/src/in_app_webview/webview.dart @@ -530,8 +530,8 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsShowPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback))) final Future Function( - InAppWebViewController controller, String origin)? - onGeolocationPermissionsShowPrompt; + InAppWebViewController controller, String origin)? + onGeolocationPermissionsShowPrompt; ///Use [onGeolocationPermissionsHidePrompt] instead. @Deprecated("Use onGeolocationPermissionsHidePrompt instead") @@ -544,7 +544,7 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsHidePrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt())) final void Function(InAppWebViewController controller)? - onGeolocationPermissionsHidePrompt; + onGeolocationPermissionsHidePrompt; ///Use [shouldInterceptRequest] instead. @Deprecated("Use shouldInterceptRequest instead") @@ -569,8 +569,8 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.shouldInterceptRequest](https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest))) final Future Function( - InAppWebViewController controller, WebResourceRequest request)? - shouldInterceptRequest; + InAppWebViewController controller, WebResourceRequest request)? + shouldInterceptRequest; ///Use [onRenderProcessUnresponsive] instead. @Deprecated("Use onRenderProcessUnresponsive instead") @@ -598,8 +598,7 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessUnresponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess))) final Future Function( - InAppWebViewController controller, Uri? url)? - onRenderProcessUnresponsive; + InAppWebViewController controller, Uri? url)? onRenderProcessUnresponsive; ///Use [onRenderProcessResponsive] instead. @Deprecated("Use onRenderProcessResponsive instead") @@ -620,8 +619,7 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessResponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess))) final Future Function( - InAppWebViewController controller, Uri? url)? - onRenderProcessResponsive; + InAppWebViewController controller, Uri? url)? onRenderProcessResponsive; ///Use [onRenderProcessGone] instead. @Deprecated("Use onRenderProcessGone instead") @@ -640,8 +638,8 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onRenderProcessGone](https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail))) final void Function( - InAppWebViewController controller, RenderProcessGoneDetail detail)? - onRenderProcessGone; + InAppWebViewController controller, RenderProcessGoneDetail detail)? + onRenderProcessGone; ///Use [onFormResubmission] instead. @Deprecated('Use onFormResubmission instead') @@ -673,7 +671,7 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onReceivedIcon](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap))) final void Function(InAppWebViewController controller, Uint8List icon)? - onReceivedIcon; + onReceivedIcon; ///Use [onReceivedTouchIconUrl] instead. @Deprecated('Use onReceivedTouchIconUrl instead') @@ -690,8 +688,8 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebChromeClient.onReceivedTouchIconUrl](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean))) final void Function( - InAppWebViewController controller, Uri url, bool precomposed)? - onReceivedTouchIconUrl; + InAppWebViewController controller, Uri url, bool precomposed)? + onReceivedTouchIconUrl; ///Use [onJsBeforeUnload] instead. @Deprecated('Use onJsBeforeUnload instead') @@ -728,8 +726,8 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- Android native WebView ([Official API - WebViewClient.onReceivedLoginRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedLoginRequest(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String))) final void Function( - InAppWebViewController controller, LoginRequest loginRequest)? - onReceivedLoginRequest; + InAppWebViewController controller, LoginRequest loginRequest)? + onReceivedLoginRequest; ///Use [onWebContentProcessDidTerminate] instead. @Deprecated('Use onWebContentProcessDidTerminate instead') @@ -741,7 +739,7 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi)) final void Function(InAppWebViewController controller)? - onWebContentProcessDidTerminate; + onWebContentProcessDidTerminate; ///Use [onDidReceiveServerRedirectForProvisionalNavigation] instead. @Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead') @@ -753,7 +751,7 @@ abstract class WebView { ///**Supported Platforms/Implementations**: ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview)) final void Function(InAppWebViewController controller)? - onDidReceiveServerRedirectForProvisionalNavigation; + onDidReceiveServerRedirectForProvisionalNavigation; ///Use [onNavigationResponse] instead. @Deprecated('Use onNavigationResponse instead') @@ -870,45 +868,64 @@ abstract class WebView { this.onWindowBlur, this.onOverScrolled, this.onZoomScaleChanged, - @Deprecated('Use onSafeBrowsingHit instead') this.androidOnSafeBrowsingHit, + @Deprecated('Use onSafeBrowsingHit instead') + this.androidOnSafeBrowsingHit, this.onSafeBrowsingHit, - @Deprecated('Use onPermissionRequest instead') this.androidOnPermissionRequest, + @Deprecated('Use onPermissionRequest instead') + this.androidOnPermissionRequest, this.onPermissionRequest, - @Deprecated('Use onGeolocationPermissionsShowPrompt instead') this.androidOnGeolocationPermissionsShowPrompt, + @Deprecated('Use onGeolocationPermissionsShowPrompt instead') + this.androidOnGeolocationPermissionsShowPrompt, this.onGeolocationPermissionsShowPrompt, - @Deprecated('Use onGeolocationPermissionsHidePrompt instead') this.androidOnGeolocationPermissionsHidePrompt, + @Deprecated('Use onGeolocationPermissionsHidePrompt instead') + this.androidOnGeolocationPermissionsHidePrompt, this.onGeolocationPermissionsHidePrompt, - @Deprecated('Use shouldInterceptRequest instead') this.androidShouldInterceptRequest, + @Deprecated('Use shouldInterceptRequest instead') + this.androidShouldInterceptRequest, this.shouldInterceptRequest, - @Deprecated('Use onRenderProcessGone instead') this.androidOnRenderProcessGone, + @Deprecated('Use onRenderProcessGone instead') + this.androidOnRenderProcessGone, this.onRenderProcessGone, - @Deprecated('Use onRenderProcessResponsive instead') this.androidOnRenderProcessResponsive, + @Deprecated('Use onRenderProcessResponsive instead') + this.androidOnRenderProcessResponsive, this.onRenderProcessResponsive, - @Deprecated('Use onRenderProcessUnresponsive instead') this.androidOnRenderProcessUnresponsive, + @Deprecated('Use onRenderProcessUnresponsive instead') + this.androidOnRenderProcessUnresponsive, this.onRenderProcessUnresponsive, - @Deprecated('Use onFormResubmission instead') this.androidOnFormResubmission, + @Deprecated('Use onFormResubmission instead') + this.androidOnFormResubmission, this.onFormResubmission, - @Deprecated('Use onZoomScaleChanged instead') this.androidOnScaleChanged, - @Deprecated('Use onReceivedIcon instead') this.androidOnReceivedIcon, + @Deprecated('Use onZoomScaleChanged instead') + this.androidOnScaleChanged, + @Deprecated('Use onReceivedIcon instead') + this.androidOnReceivedIcon, this.onReceivedIcon, - @Deprecated('Use onReceivedTouchIconUrl instead') this.androidOnReceivedTouchIconUrl, + @Deprecated('Use onReceivedTouchIconUrl instead') + this.androidOnReceivedTouchIconUrl, this.onReceivedTouchIconUrl, - @Deprecated('Use onJsBeforeUnload instead') this.androidOnJsBeforeUnload, + @Deprecated('Use onJsBeforeUnload instead') + this.androidOnJsBeforeUnload, this.onJsBeforeUnload, - @Deprecated('Use onReceivedLoginRequest instead') this.androidOnReceivedLoginRequest, + @Deprecated('Use onReceivedLoginRequest instead') + this.androidOnReceivedLoginRequest, this.onReceivedLoginRequest, - @Deprecated('Use onWebContentProcessDidTerminate instead') this.iosOnWebContentProcessDidTerminate, + @Deprecated('Use onWebContentProcessDidTerminate instead') + this.iosOnWebContentProcessDidTerminate, this.onWebContentProcessDidTerminate, - @Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead') this.iosOnDidReceiveServerRedirectForProvisionalNavigation, + @Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead') + this.iosOnDidReceiveServerRedirectForProvisionalNavigation, this.onDidReceiveServerRedirectForProvisionalNavigation, - @Deprecated('Use onNavigationResponse instead') this.iosOnNavigationResponse, + @Deprecated('Use onNavigationResponse instead') + this.iosOnNavigationResponse, this.onNavigationResponse, - @Deprecated('Use shouldAllowDeprecatedTLS instead') this.iosShouldAllowDeprecatedTLS, + @Deprecated('Use shouldAllowDeprecatedTLS instead') + this.iosShouldAllowDeprecatedTLS, this.shouldAllowDeprecatedTLS, this.initialUrlRequest, this.initialFile, this.initialData, - @Deprecated('Use initialSettings instead') this.initialOptions, + @Deprecated('Use initialSettings instead') + this.initialOptions, this.initialSettings, this.contextMenu, this.initialUserScripts, diff --git a/lib/src/pull_to_refresh/main.dart b/lib/src/pull_to_refresh/main.dart index 2cae0d6d..cb30f265 100644 --- a/lib/src/pull_to_refresh/main.dart +++ b/lib/src/pull_to_refresh/main.dart @@ -1,2 +1,2 @@ export 'pull_to_refresh_controller.dart'; -export 'pull_to_refresh_options.dart'; +export 'pull_to_refresh_settings.dart'; diff --git a/lib/src/pull_to_refresh/pull_to_refresh_controller.dart b/lib/src/pull_to_refresh/pull_to_refresh_controller.dart index cce8bd77..a100855e 100644 --- a/lib/src/pull_to_refresh/pull_to_refresh_controller.dart +++ b/lib/src/pull_to_refresh/pull_to_refresh_controller.dart @@ -6,7 +6,7 @@ import '../in_app_browser/in_app_browser.dart'; import '../util.dart'; import '../types.dart'; import '../in_app_webview/in_app_webview_settings.dart'; -import 'pull_to_refresh_options.dart'; +import 'pull_to_refresh_settings.dart'; ///A standard controller that can initiate the refreshing of a scroll view’s contents. ///This should be used whenever the user can refresh the contents of a WebView via a vertical swipe gesture. @@ -16,14 +16,24 @@ import 'pull_to_refresh_options.dart'; /// ///**NOTE for Android**: to be able to use the "pull-to-refresh" feature, [InAppWebViewSettings.useHybridComposition] must be `true`. class PullToRefreshController { + @Deprecated("Use settings instead") + // ignore: deprecated_member_use_from_same_package late PullToRefreshOptions options; + late PullToRefreshSettings settings; MethodChannel? _channel; ///Event called when a swipe gesture triggers a refresh. final void Function()? onRefresh; - PullToRefreshController({PullToRefreshOptions? options, this.onRefresh}) { + PullToRefreshController( + { + // ignore: deprecated_member_use_from_same_package + @Deprecated("Use settings instead") PullToRefreshOptions? options, + PullToRefreshSettings? settings, + this.onRefresh}) { + // ignore: deprecated_member_use_from_same_package this.options = options ?? PullToRefreshOptions(); + this.settings = settings ?? PullToRefreshSettings(); } Future handleMethod(MethodCall call) async { diff --git a/lib/src/pull_to_refresh/pull_to_refresh_options.dart b/lib/src/pull_to_refresh/pull_to_refresh_options.dart deleted file mode 100644 index da86e682..00000000 --- a/lib/src/pull_to_refresh/pull_to_refresh_options.dart +++ /dev/null @@ -1,64 +0,0 @@ -import 'dart:ui'; -import '../util.dart'; -import '../types.dart'; - -class PullToRefreshOptions { - ///Sets whether the pull-to-refresh feature is enabled or not. - bool enabled; - - ///The color of the refresh control. - Color? color; - - ///The background color of the refresh control. - Color? backgroundColor; - - ///The distance to trigger a sync in dips. - /// - ///**NOTE**: Available only on Android. - int? distanceToTriggerSync; - - ///The distance in pixels that the refresh indicator can be pulled beyond its resting position. - /// - ///**NOTE**: Available only on Android. - int? slingshotDistance; - - ///The size of the refresh indicator. - /// - ///**NOTE**: Available only on Android. - AndroidPullToRefreshSize? size; - - ///The title text to display in the refresh control. - /// - ///**NOTE**: Available only on iOS. - IOSNSAttributedString? attributedTitle; - - PullToRefreshOptions( - {this.enabled = true, - this.color, - this.backgroundColor, - this.distanceToTriggerSync, - this.slingshotDistance, - this.size, - this.attributedTitle}); - - Map toMap() { - return { - "enabled": enabled, - "color": color?.toHex(), - "backgroundColor": backgroundColor?.toHex(), - "distanceToTriggerSync": distanceToTriggerSync, - "slingshotDistance": slingshotDistance, - "size": size?.toValue(), - "attributedTitle": attributedTitle?.toMap() ?? {} - }; - } - - Map toJson() { - return this.toMap(); - } - - @override - String toString() { - return toMap().toString(); - } -} diff --git a/lib/src/pull_to_refresh/pull_to_refresh_settings.dart b/lib/src/pull_to_refresh/pull_to_refresh_settings.dart new file mode 100644 index 00000000..6441be23 --- /dev/null +++ b/lib/src/pull_to_refresh/pull_to_refresh_settings.dart @@ -0,0 +1,128 @@ +import 'dart:ui'; +import '../util.dart'; +import '../types.dart'; + +///Pull-To-Refresh Settings +class PullToRefreshSettings { + ///Sets whether the pull-to-refresh feature is enabled or not. + bool enabled; + + ///The color of the refresh control. + Color? color; + + ///The background color of the refresh control. + Color? backgroundColor; + + ///The distance to trigger a sync in dips. + /// + ///**NOTE**: Available only on Android. + int? distanceToTriggerSync; + + ///The distance in pixels that the refresh indicator can be pulled beyond its resting position. + /// + ///**NOTE**: Available only on Android. + int? slingshotDistance; + + ///The size of the refresh indicator. + /// + ///**NOTE**: Available only on Android. + PullToRefreshSize? size; + + ///The title text to display in the refresh control. + /// + ///**NOTE**: Available only on iOS. + AttributedString? attributedTitle; + + PullToRefreshSettings( + {this.enabled = true, + this.color, + this.backgroundColor, + this.distanceToTriggerSync, + this.slingshotDistance, + this.size, + this.attributedTitle}); + + Map toMap() { + return { + "enabled": enabled, + "color": color?.toHex(), + "backgroundColor": backgroundColor?.toHex(), + "distanceToTriggerSync": distanceToTriggerSync, + "slingshotDistance": slingshotDistance, + "size": size?.toValue(), + "attributedTitle": attributedTitle?.toMap() ?? {} + }; + } + + Map toJson() { + return this.toMap(); + } + + @override + String toString() { + return toMap().toString(); + } +} + +///Use [PullToRefreshSettings] instead. +@Deprecated("Use PullToRefreshSettings instead") +class PullToRefreshOptions { + ///Sets whether the pull-to-refresh feature is enabled or not. + bool enabled; + + ///The color of the refresh control. + Color? color; + + ///The background color of the refresh control. + Color? backgroundColor; + + ///The distance to trigger a sync in dips. + /// + ///**NOTE**: Available only on Android. + int? distanceToTriggerSync; + + ///The distance in pixels that the refresh indicator can be pulled beyond its resting position. + /// + ///**NOTE**: Available only on Android. + int? slingshotDistance; + + ///The size of the refresh indicator. + /// + ///**NOTE**: Available only on Android. + AndroidPullToRefreshSize? size; + + ///The title text to display in the refresh control. + /// + ///**NOTE**: Available only on iOS. + IOSNSAttributedString? attributedTitle; + + PullToRefreshOptions( + {this.enabled = true, + this.color, + this.backgroundColor, + this.distanceToTriggerSync, + this.slingshotDistance, + this.size, + this.attributedTitle}); + + Map toMap() { + return { + "enabled": enabled, + "color": color?.toHex(), + "backgroundColor": backgroundColor?.toHex(), + "distanceToTriggerSync": distanceToTriggerSync, + "slingshotDistance": slingshotDistance, + "size": size?.toValue(), + "attributedTitle": attributedTitle?.toMap() ?? {} + }; + } + + Map toJson() { + return this.toMap(); + } + + @override + String toString() { + return toMap().toString(); + } +} diff --git a/lib/src/types.dart b/lib/src/types.dart index 479fb98b..9701c297 100755 --- a/lib/src/types.dart +++ b/lib/src/types.dart @@ -15,7 +15,7 @@ import 'http_auth_credentials_database.dart'; import 'cookie_manager.dart'; import 'web_storage/web_storage.dart'; import 'pull_to_refresh/pull_to_refresh_controller.dart'; -import 'pull_to_refresh/pull_to_refresh_options.dart'; +import 'pull_to_refresh/pull_to_refresh_settings.dart'; import 'util.dart'; import 'web_message/web_message_listener.dart'; import 'web_message/web_message_channel.dart'; @@ -173,12 +173,13 @@ class InAppWebViewInitialData { this.mimeType = "text/html", this.encoding = "utf8", Uri? baseUrl, - @Deprecated('Use historyUrl instead') - Uri? androidHistoryUrl, + @Deprecated('Use historyUrl instead') Uri? androidHistoryUrl, Uri? historyUrl}) { this.baseUrl = baseUrl == null ? Uri.parse("about:blank") : baseUrl; this.historyUrl = historyUrl == null - ? (androidHistoryUrl == null ? Uri.parse("about:blank") : androidHistoryUrl) + ? (androidHistoryUrl == null + ? Uri.parse("about:blank") + : androidHistoryUrl) : historyUrl; // ignore: deprecated_member_use_from_same_package this.androidHistoryUrl = this.historyUrl; @@ -552,8 +553,11 @@ class JsAlertRequest { ///**NOTE**: available only on iOS. bool? isMainFrame; - JsAlertRequest({this.url, this.message, - @Deprecated("Use isMainFrame instead") this.iosIsMainFrame, this.isMainFrame}) { + JsAlertRequest( + {this.url, + this.message, + @Deprecated("Use isMainFrame instead") this.iosIsMainFrame, + this.isMainFrame}) { // ignore: deprecated_member_use_from_same_package this.isMainFrame = this.isMainFrame ?? this.iosIsMainFrame; } @@ -574,11 +578,11 @@ class JsAlertRequest { return null; } return JsAlertRequest( - url: map["url"] != null ? Uri.parse(map["url"]) : null, - message: map["message"], - // ignore: deprecated_member_use_from_same_package - iosIsMainFrame: map["isMainFrame"], - isMainFrame: map["isMainFrame"], + url: map["url"] != null ? Uri.parse(map["url"]) : null, + message: map["message"], + // ignore: deprecated_member_use_from_same_package + iosIsMainFrame: map["isMainFrame"], + isMainFrame: map["isMainFrame"], ); } @@ -664,8 +668,11 @@ class JsConfirmRequest { ///**NOTE**: available only on iOS. bool? isMainFrame; - JsConfirmRequest({this.url, this.message, - @Deprecated("Use isMainFrame instead") this.iosIsMainFrame, this.isMainFrame}) { + JsConfirmRequest( + {this.url, + this.message, + @Deprecated("Use isMainFrame instead") this.iosIsMainFrame, + this.isMainFrame}) { // ignore: deprecated_member_use_from_same_package this.isMainFrame = this.isMainFrame ?? this.iosIsMainFrame; } @@ -785,8 +792,11 @@ class JsPromptRequest { bool? isMainFrame; JsPromptRequest( - {this.url, this.message, this.defaultValue, - @Deprecated("Use isMainFrame instead") this.iosIsMainFrame, this.isMainFrame}) { + {this.url, + this.message, + this.defaultValue, + @Deprecated("Use isMainFrame instead") this.iosIsMainFrame, + this.isMainFrame}) { // ignore: deprecated_member_use_from_same_package this.isMainFrame = this.isMainFrame ?? this.iosIsMainFrame; } @@ -1327,7 +1337,9 @@ class URLCredential { @Deprecated("Use persistence instead") this.iosCertificates, this.certificates}) { // ignore: deprecated_member_use_from_same_package - this.persistence = this.persistence ?? URLCredentialPersistence.fromValue(this.iosPersistence?.toValue()); + this.persistence = this.persistence ?? + // ignore: deprecated_member_use_from_same_package + URLCredentialPersistence.fromValue(this.iosPersistence?.toValue()); // ignore: deprecated_member_use_from_same_package this.certificates = this.certificates ?? this.iosCertificates; } @@ -1336,10 +1348,12 @@ class URLCredential { return { "username": username, "password": password, - // ignore: deprecated_member_use_from_same_package - "iosCertificates": (certificates ?? iosCertificates)?.map((e) => e.toMap()).toList(), - // ignore: deprecated_member_use_from_same_package - "certificates": (certificates ?? iosCertificates)?.map((e) => e.toMap()).toList(), + "iosCertificates": + // ignore: deprecated_member_use_from_same_package + (certificates ?? iosCertificates)?.map((e) => e.toMap()).toList(), + "certificates": + // ignore: deprecated_member_use_from_same_package + (certificates ?? iosCertificates)?.map((e) => e.toMap()).toList(), // ignore: deprecated_member_use_from_same_package "iosPersistence": persistence?.toValue() ?? iosPersistence?.toValue(), // ignore: deprecated_member_use_from_same_package @@ -1367,15 +1381,16 @@ class URLCredential { } return URLCredential( - username: map["user"], - password: map["password"], - // ignore: deprecated_member_use_from_same_package - iosCertificates: certificates, - certificates: certificates, - persistence: URLCredentialPersistence.fromValue(map["persistence"]), - // ignore: deprecated_member_use_from_same_package - iosPersistence: IOSURLCredentialPersistence.fromValue(map["persistence"]) - ); + username: map["user"], + password: map["password"], + // ignore: deprecated_member_use_from_same_package + iosCertificates: certificates, + certificates: certificates, + persistence: URLCredentialPersistence.fromValue(map["persistence"]), + // ignore: deprecated_member_use_from_same_package + iosPersistence: + // ignore: deprecated_member_use_from_same_package + IOSURLCredentialPersistence.fromValue(map["persistence"])); } Map toJson() { @@ -1458,17 +1473,18 @@ class HttpAuthenticationChallenge extends URLAuthenticationChallenge { ///**NOTE**: available only on iOS. String? error; - HttpAuthenticationChallenge({ - required this.previousFailureCount, - required URLProtectionSpace protectionSpace, - @Deprecated("Use failureResponse instead") this.iosFailureResponse, - this.failureResponse, - this.proposedCredential, - @Deprecated("Use error instead") this.iosError, - this.error - }) : super(protectionSpace: protectionSpace) { - // ignore: deprecated_member_use_from_same_package - this.failureResponse = this.failureResponse ?? URLResponse.fromMap(this.iosFailureResponse?.toMap()); + HttpAuthenticationChallenge( + {required this.previousFailureCount, + required URLProtectionSpace protectionSpace, + @Deprecated("Use failureResponse instead") this.iosFailureResponse, + this.failureResponse, + this.proposedCredential, + @Deprecated("Use error instead") this.iosError, + this.error}) + : super(protectionSpace: protectionSpace) { + this.failureResponse = this.failureResponse ?? + // ignore: deprecated_member_use_from_same_package + URLResponse.fromMap(this.iosFailureResponse?.toMap()); // ignore: deprecated_member_use_from_same_package this.error = this.error ?? this.iosError; } @@ -1479,10 +1495,12 @@ class HttpAuthenticationChallenge extends URLAuthenticationChallenge { "previousFailureCount": previousFailureCount, "protectionSpace": protectionSpace.toMap(), "proposedCredential": proposedCredential?.toMap(), - // ignore: deprecated_member_use_from_same_package - "iosFailureResponse": failureResponse?.toMap() ?? iosFailureResponse?.toMap(), - // ignore: deprecated_member_use_from_same_package - "failureResponse": failureResponse?.toMap() ?? iosFailureResponse?.toMap(), + "iosFailureResponse": + // ignore: deprecated_member_use_from_same_package + failureResponse?.toMap() ?? iosFailureResponse?.toMap(), + "failureResponse": + // ignore: deprecated_member_use_from_same_package + failureResponse?.toMap() ?? iosFailureResponse?.toMap(), // ignore: deprecated_member_use_from_same_package "iosError": error ?? iosError, // ignore: deprecated_member_use_from_same_package @@ -1504,8 +1522,8 @@ class HttpAuthenticationChallenge extends URLAuthenticationChallenge { // ignore: deprecated_member_use_from_same_package iosFailureResponse: IOSURLResponse.fromMap( map["failureResponse"]?.cast()), - failureResponse: URLResponse.fromMap( - map["failureResponse"]?.cast()), + failureResponse: + URLResponse.fromMap(map["failureResponse"]?.cast()), // ignore: deprecated_member_use_from_same_package iosError: map["error"], error: map["error"], @@ -1612,23 +1630,23 @@ class URLProtectionSpaceProxyType { ///The proxy type for HTTP proxies. static const NSUR_PROTECTION_SPACE_HTTP_PROXY = - const URLProtectionSpaceProxyType._internal( - "NSURLProtectionSpaceHTTPProxy"); + const URLProtectionSpaceProxyType._internal( + "NSURLProtectionSpaceHTTPProxy"); ///The proxy type for HTTPS proxies. static const NSURL_PROTECTION_SPACE_HTTPS_PROXY = - const URLProtectionSpaceProxyType._internal( - "NSURLProtectionSpaceHTTPSProxy"); + const URLProtectionSpaceProxyType._internal( + "NSURLProtectionSpaceHTTPSProxy"); ///The proxy type for FTP proxies. static const NSURL_PROTECTION_SPACE_FTP_PROXY = - const URLProtectionSpaceProxyType._internal( - "NSURLProtectionSpaceFTPProxy"); + const URLProtectionSpaceProxyType._internal( + "NSURLProtectionSpaceFTPProxy"); ///The proxy type for SOCKS proxies. static const NSURL_PROTECTION_SPACE_SOCKS_PROXY = - const URLProtectionSpaceProxyType._internal( - "NSURLProtectionSpaceSOCKSProxy"); + const URLProtectionSpaceProxyType._internal( + "NSURLProtectionSpaceSOCKSProxy"); bool operator ==(value) => value == _value; @@ -1705,8 +1723,7 @@ class URLProtectionSpaceAuthenticationMethod { .NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE, URLProtectionSpaceAuthenticationMethod .NSURL_AUTHENTICATION_METHOD_NEGOTIATE, - URLProtectionSpaceAuthenticationMethod - .NSURL_AUTHENTICATION_METHOD_NTLM, + URLProtectionSpaceAuthenticationMethod.NSURL_AUTHENTICATION_METHOD_NTLM, URLProtectionSpaceAuthenticationMethod .NSURL_AUTHENTICATION_METHOD_SERVER_TRUST, ].toSet(); @@ -1730,23 +1747,23 @@ class URLProtectionSpaceAuthenticationMethod { ///Use client certificate authentication for this protection space. static const NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE = - const URLProtectionSpaceAuthenticationMethod._internal( - "NSURLAuthenticationMethodClientCertificate"); + const URLProtectionSpaceAuthenticationMethod._internal( + "NSURLAuthenticationMethodClientCertificate"); ///Negotiate whether to use Kerberos or NTLM authentication for this protection space. static const NSURL_AUTHENTICATION_METHOD_NEGOTIATE = - const URLProtectionSpaceAuthenticationMethod._internal( - "NSURLAuthenticationMethodNegotiate"); + const URLProtectionSpaceAuthenticationMethod._internal( + "NSURLAuthenticationMethodNegotiate"); ///Use NTLM authentication for this protection space. static const NSURL_AUTHENTICATION_METHOD_NTLM = - const URLProtectionSpaceAuthenticationMethod._internal( - "NSURLAuthenticationMethodNTLM"); + const URLProtectionSpaceAuthenticationMethod._internal( + "NSURLAuthenticationMethodNTLM"); ///Perform server trust authentication (certificate validation) for this protection space. static const NSURL_AUTHENTICATION_METHOD_SERVER_TRUST = - const URLProtectionSpaceAuthenticationMethod._internal( - "NSURLAuthenticationMethodServerTrust"); + const URLProtectionSpaceAuthenticationMethod._internal( + "NSURLAuthenticationMethodServerTrust"); bool operator ==(value) => value == _value; @@ -1833,13 +1850,16 @@ class SslError { ///The message associated to the [code]. String? message; - SslError({@Deprecated('Use code instead') this.androidError, - @Deprecated('Use code instead') this.iosError, - this.code, this.message}) { - // ignore: deprecated_member_use_from_same_package - this.code = this.code ?? SslErrorType.fromValue(this.androidError?.toValue() ?? + SslError( + {@Deprecated('Use code instead') this.androidError, + @Deprecated('Use code instead') this.iosError, + this.code, + this.message}) { + this.code = this.code ?? // ignore: deprecated_member_use_from_same_package - this.iosError?.toValue()); + SslErrorType.fromValue(this.androidError?.toValue() ?? + // ignore: deprecated_member_use_from_same_package + this.iosError?.toValue()); } static SslError? fromMap(Map? map) { @@ -1847,7 +1867,7 @@ class SslError { return null; } return SslError( - // ignore: deprecated_member_use_from_same_package + // ignore: deprecated_member_use_from_same_package androidError: AndroidSslError.fromValue(map["code"]), // ignore: deprecated_member_use_from_same_package iosError: IOSSslError.fromValue(map["code"]), @@ -1956,26 +1976,36 @@ class URLProtectionSpace { this.port, this.sslCertificate, this.sslError, - @Deprecated("Use authenticationMethod instead") this.iosAuthenticationMethod, + @Deprecated("Use authenticationMethod instead") + this.iosAuthenticationMethod, this.authenticationMethod, - @Deprecated("Use distinguishedNames instead") this.iosDistinguishedNames, + @Deprecated("Use distinguishedNames instead") + this.iosDistinguishedNames, this.distinguishedNames, - @Deprecated("Use receivesCredentialSecurely instead") this.iosReceivesCredentialSecurely, + @Deprecated("Use receivesCredentialSecurely instead") + this.iosReceivesCredentialSecurely, this.receivesCredentialSecurely, - @Deprecated("Use isProxy instead") this.iosIsProxy, + @Deprecated("Use isProxy instead") + this.iosIsProxy, this.isProxy, - @Deprecated("Use proxyType instead") this.iosProxyType, + @Deprecated("Use proxyType instead") + this.iosProxyType, this.proxyType}) { - // ignore: deprecated_member_use_from_same_package - this.authenticationMethod = this.authenticationMethod ?? URLProtectionSpaceAuthenticationMethod.fromValue(this.iosAuthenticationMethod?.toValue()); - // ignore: deprecated_member_use_from_same_package - this.distinguishedNames = this.distinguishedNames ?? this.iosDistinguishedNames; - // ignore: deprecated_member_use_from_same_package - this.receivesCredentialSecurely = this.receivesCredentialSecurely ?? this.iosReceivesCredentialSecurely; + this.authenticationMethod = this.authenticationMethod ?? + URLProtectionSpaceAuthenticationMethod.fromValue( + // ignore: deprecated_member_use_from_same_package + this.iosAuthenticationMethod?.toValue()); + this.distinguishedNames = + // ignore: deprecated_member_use_from_same_package + this.distinguishedNames ?? this.iosDistinguishedNames; + this.receivesCredentialSecurely = + // ignore: deprecated_member_use_from_same_package + this.receivesCredentialSecurely ?? this.iosReceivesCredentialSecurely; // ignore: deprecated_member_use_from_same_package this.isProxy = this.isProxy ?? this.iosIsProxy; - // ignore: deprecated_member_use_from_same_package - this.proxyType = this.proxyType ?? URLProtectionSpaceProxyType.fromValue(this.iosProxyType?.toValue()); + this.proxyType = this.proxyType ?? + // ignore: deprecated_member_use_from_same_package + URLProtectionSpaceProxyType.fromValue(this.iosProxyType?.toValue()); } static URLProtectionSpace? fromMap(Map? map) { @@ -2006,7 +2036,7 @@ class URLProtectionSpace { sslError: SslError.fromMap(map["sslError"]?.cast()), // ignore: deprecated_member_use_from_same_package iosAuthenticationMethod: - // ignore: deprecated_member_use_from_same_package + // ignore: deprecated_member_use_from_same_package IOSNSURLProtectionSpaceAuthenticationMethod.fromValue( map["authenticationMethod"]), authenticationMethod: URLProtectionSpaceAuthenticationMethod.fromValue( @@ -2022,7 +2052,7 @@ class URLProtectionSpace { isProxy: map["isProxy"], // ignore: deprecated_member_use_from_same_package iosProxyType: - // ignore: deprecated_member_use_from_same_package + // ignore: deprecated_member_use_from_same_package IOSNSURLProtectionSpaceProxyType.fromValue(map["proxyType"]), proxyType: URLProtectionSpaceProxyType.fromValue(map["proxyType"]), ); @@ -2036,18 +2066,25 @@ class URLProtectionSpace { "port": port, "sslCertificate": sslCertificate?.toMap(), "sslError": sslError?.toMap(), - // ignore: deprecated_member_use_from_same_package - "iosAuthenticationMethod": authenticationMethod ?? iosAuthenticationMethod, + "iosAuthenticationMethod": + // ignore: deprecated_member_use_from_same_package + authenticationMethod ?? iosAuthenticationMethod, // ignore: deprecated_member_use_from_same_package "authenticationMethod": authenticationMethod ?? iosAuthenticationMethod, // ignore: deprecated_member_use_from_same_package - "iosDistinguishedNames": (distinguishedNames ?? iosDistinguishedNames)?.map((e) => e.toMap()).toList(), + "iosDistinguishedNames": (distinguishedNames ?? iosDistinguishedNames) + ?.map((e) => e.toMap()) + .toList(), // ignore: deprecated_member_use_from_same_package - "distinguishedNames": (distinguishedNames ?? iosDistinguishedNames)?.map((e) => e.toMap()).toList(), - // ignore: deprecated_member_use_from_same_package - "iosReceivesCredentialSecurely": receivesCredentialSecurely ?? iosReceivesCredentialSecurely, - // ignore: deprecated_member_use_from_same_package - "receivesCredentialSecurely": receivesCredentialSecurely ?? iosReceivesCredentialSecurely, + "distinguishedNames": (distinguishedNames ?? iosDistinguishedNames) + ?.map((e) => e.toMap()) + .toList(), + "iosReceivesCredentialSecurely": + // ignore: deprecated_member_use_from_same_package + receivesCredentialSecurely ?? iosReceivesCredentialSecurely, + "receivesCredentialSecurely": + // ignore: deprecated_member_use_from_same_package + receivesCredentialSecurely ?? iosReceivesCredentialSecurely, // ignore: deprecated_member_use_from_same_package "iosIsProxy": isProxy ?? iosIsProxy, // ignore: deprecated_member_use_from_same_package @@ -2213,7 +2250,8 @@ class ClientCertResponse { ClientCertResponse( {required this.certificatePath, this.certificatePassword = "", - @Deprecated('Use keyStoreType instead') this.androidKeyStoreType = "PKCS12", + @Deprecated('Use keyStoreType instead') + this.androidKeyStoreType = "PKCS12", this.keyStoreType = "PKCS12", this.action = ClientCertResponseAction.CANCEL}) { if (this.action == ClientCertResponseAction.PROCEED) @@ -2454,12 +2492,10 @@ class ActionModeMenuItem { static const MENU_ITEM_SHARE = const ActionModeMenuItem._internal(1); ///Disable menu item "Web Search". - static const MENU_ITEM_WEB_SEARCH = - const ActionModeMenuItem._internal(2); + static const MENU_ITEM_WEB_SEARCH = const ActionModeMenuItem._internal(2); ///Disable all the action mode menu items for text processing. - static const MENU_ITEM_PROCESS_TEXT = - const ActionModeMenuItem._internal(4); + static const MENU_ITEM_PROCESS_TEXT = const ActionModeMenuItem._internal(4); bool operator ==(value) => value == _value; @@ -2688,11 +2724,11 @@ class LayoutAlgorithm { /// ///**NOTE**: available on Android 19+. static const TEXT_AUTOSIZING = - const LayoutAlgorithm._internal("TEXT_AUTOSIZING"); + const LayoutAlgorithm._internal("TEXT_AUTOSIZING"); ///NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use this for API levels prior to `Build.VERSION_CODES.KITKAT`. static const NARROW_COLUMNS = - const LayoutAlgorithm._internal("NARROW_COLUMNS"); + const LayoutAlgorithm._internal("NARROW_COLUMNS"); bool operator ==(value) => value == _value; @@ -2794,13 +2830,11 @@ class MixedContentMode { ///In this mode, the WebView will allow a secure origin to load content from any other origin, even if that origin is insecure. ///This is the least secure mode of operation for the WebView, and where possible apps should not set this mode. - static const MIXED_CONTENT_ALWAYS_ALLOW = - const MixedContentMode._internal(0); + static const MIXED_CONTENT_ALWAYS_ALLOW = const MixedContentMode._internal(0); ///In this mode, the WebView will not allow a secure origin to load content from an insecure origin. ///This is the preferred and most secure mode of operation for the WebView and apps are strongly advised to use this mode. - static const MIXED_CONTENT_NEVER_ALLOW = - const MixedContentMode._internal(1); + static const MIXED_CONTENT_NEVER_ALLOW = const MixedContentMode._internal(1); ///In this mode, the WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content. ///Some insecure content may be allowed to be loaded by a secure origin and other types of content will be blocked. @@ -2808,7 +2842,7 @@ class MixedContentMode { ///This mode is intended to be used by apps that are not in control of the content that they render but desire to operate in a reasonably secure environment. ///For highest security, apps are recommended to use [MixedContentMode.MIXED_CONTENT_NEVER_ALLOW]. static const MIXED_CONTENT_COMPATIBILITY_MODE = - const MixedContentMode._internal(2); + const MixedContentMode._internal(2); bool operator ==(value) => value == _value; @@ -3024,8 +3058,7 @@ class DataDetectorTypes { static const NONE = const DataDetectorTypes._internal("NONE"); ///Phone numbers are detected and turned into links. - static const PHONE_NUMBER = - const DataDetectorTypes._internal("PHONE_NUMBER"); + static const PHONE_NUMBER = const DataDetectorTypes._internal("PHONE_NUMBER"); ///URLs in text are detected and turned into links. static const LINK = const DataDetectorTypes._internal("LINK"); @@ -3035,23 +3068,23 @@ class DataDetectorTypes { ///Dates and times that are in the future are detected and turned into links. static const CALENDAR_EVENT = - const DataDetectorTypes._internal("CALENDAR_EVENT"); + const DataDetectorTypes._internal("CALENDAR_EVENT"); ///Tracking numbers are detected and turned into links. static const TRACKING_NUMBER = - const DataDetectorTypes._internal("TRACKING_NUMBER"); + const DataDetectorTypes._internal("TRACKING_NUMBER"); ///Flight numbers are detected and turned into links. static const FLIGHT_NUMBER = - const DataDetectorTypes._internal("FLIGHT_NUMBER"); + const DataDetectorTypes._internal("FLIGHT_NUMBER"); ///Lookup suggestions are detected and turned into links. static const LOOKUP_SUGGESTION = - const DataDetectorTypes._internal("LOOKUP_SUGGESTION"); + const DataDetectorTypes._internal("LOOKUP_SUGGESTION"); ///Spotlight suggestions are detected and turned into links. static const SPOTLIGHT_SUGGESTION = - const DataDetectorTypes._internal("SPOTLIGHT_SUGGESTION"); + const DataDetectorTypes._internal("SPOTLIGHT_SUGGESTION"); ///All of the above data types are turned into links when detected. Choosing this value will automatically include any new detection type that is added. static const ALL = const DataDetectorTypes._internal("ALL"); @@ -3174,8 +3207,7 @@ class ScrollViewDecelerationRate { String toString() => _value; ///The default deceleration rate for a scroll view: `0.998`. - static const NORMAL = - const ScrollViewDecelerationRate._internal("NORMAL"); + static const NORMAL = const ScrollViewDecelerationRate._internal("NORMAL"); ///A fast deceleration rate for a scroll view: `0.99`. static const FAST = const ScrollViewDecelerationRate._internal("FAST"); @@ -3359,12 +3391,10 @@ class ModalPresentationStyle { static const CUSTOM = const ModalPresentationStyle._internal(4); ///A view presentation style in which the presented view covers the screen. - static const OVER_FULL_SCREEN = - const ModalPresentationStyle._internal(5); + static const OVER_FULL_SCREEN = const ModalPresentationStyle._internal(5); ///A presentation style where the content is displayed over another view controller’s content. - static const OVER_CURRENT_CONTEXT = - const ModalPresentationStyle._internal(6); + static const OVER_CURRENT_CONTEXT = const ModalPresentationStyle._internal(6); ///A presentation style where the content is displayed in a popover view. static const POPOVER = const ModalPresentationStyle._internal(7); @@ -4943,18 +4973,18 @@ class URLRequestCachePolicy { ///Use the caching logic defined in the protocol implementation, if any, for a particular URL load request. ///This is the default policy for URL load requests. static const USE_PROTOCOL_CACHE_POLICY = - const URLRequestCachePolicy._internal(0); + const URLRequestCachePolicy._internal(0); ///The URL load should be loaded only from the originating source. ///This policy specifies that no existing cache data should be used to satisfy a URL load request. /// ///**NOTE**: Always use this policy if you are making HTTP or HTTPS byte-range requests. static const RELOAD_IGNORING_LOCAL_CACHE_DATA = - const URLRequestCachePolicy._internal(1); + const URLRequestCachePolicy._internal(1); ///Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data. static const RETURN_CACHE_DATA_ELSE_LOAD = - const URLRequestCachePolicy._internal(2); + const URLRequestCachePolicy._internal(2); ///Use existing cache data, regardless or age or expiration date, and fail if no cached data is available. /// @@ -4962,19 +4992,19 @@ class URLRequestCachePolicy { ///no attempt is made to load the data from the originating source, and the load is considered to have failed. ///This constant specifies a behavior that is similar to an “offline” mode. static const RETURN_CACHE_DATA_DONT_LOAD = - const URLRequestCachePolicy._internal(3); + const URLRequestCachePolicy._internal(3); ///Ignore local cache data, and instruct proxies and other intermediates to disregard their caches so far as the protocol allows. /// ///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 don’t implement this constant. static const RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA = - const URLRequestCachePolicy._internal(4); + const URLRequestCachePolicy._internal(4); ///Use cache data if the origin source can validate it; otherwise, load from the origin. /// ///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 don’t implement this constant. static const RELOAD_REVALIDATING_CACHE_DATA = - const URLRequestCachePolicy._internal(5); + const URLRequestCachePolicy._internal(5); bool operator ==(value) => value == _value; @@ -5147,21 +5177,19 @@ class URLRequestNetworkServiceType { /// ///Use this service type for interactive situations where the user is anticipating a quick response, like instant messaging or completing a purchase. static const RESPONSIVE_DATA = - const URLRequestNetworkServiceType._internal(6); + const URLRequestNetworkServiceType._internal(6); ///A service type for streaming audio/video data. - static const AV_STREAMING = - const URLRequestNetworkServiceType._internal(8); + static const AV_STREAMING = const URLRequestNetworkServiceType._internal(8); ///A service type for responsive (time-sensitive) audio/video data. - static const RESPONSIVE_AV = - const URLRequestNetworkServiceType._internal(9); + static const RESPONSIVE_AV = const URLRequestNetworkServiceType._internal(9); ///A service type for call signaling. /// ///Use this service type with network traffic that establishes, maintains, or tears down a VoIP call. static const CALL_SIGNALING = - const URLRequestNetworkServiceType._internal(11); + const URLRequestNetworkServiceType._internal(11); bool operator ==(value) => value == _value; @@ -5521,12 +5549,15 @@ class NavigationAction { this.hasGesture = this.hasGesture ?? this.androidHasGesture; // ignore: deprecated_member_use_from_same_package this.isRedirect = this.isRedirect ?? this.androidIsRedirect; - // ignore: deprecated_member_use_from_same_package - this.navigationType = this.navigationType ?? NavigationType.fromValue(this.iosWKNavigationType?.toValue()); - // ignore: deprecated_member_use_from_same_package - this.sourceFrame = this.sourceFrame ?? FrameInfo.fromMap(this.iosSourceFrame?.toMap()); - // ignore: deprecated_member_use_from_same_package - this.targetFrame = this.targetFrame ?? FrameInfo.fromMap(this.iosTargetFrame?.toMap()); + this.navigationType = this.navigationType ?? + // ignore: deprecated_member_use_from_same_package + NavigationType.fromValue(this.iosWKNavigationType?.toValue()); + this.sourceFrame = + // ignore: deprecated_member_use_from_same_package + this.sourceFrame ?? FrameInfo.fromMap(this.iosSourceFrame?.toMap()); + this.targetFrame = + // ignore: deprecated_member_use_from_same_package + this.targetFrame ?? FrameInfo.fromMap(this.iosTargetFrame?.toMap()); } static NavigationAction? fromMap(Map? map) { @@ -5543,14 +5574,22 @@ class NavigationAction { androidIsRedirect: map["isRedirect"] ?? map["androidIsRedirect"], isRedirect: map["isRedirect"], // ignore: deprecated_member_use_from_same_package - iosWKNavigationType: IOSWKNavigationType.fromValue(map["navigationType"]), + iosWKNavigationType: + // ignore: deprecated_member_use_from_same_package + IOSWKNavigationType.fromValue(map["navigationType"]), navigationType: NavigationType.fromValue(map["navigationType"]), // ignore: deprecated_member_use_from_same_package - iosSourceFrame: IOSWKFrameInfo.fromMap(map["sourceFrame"]?.cast()), - sourceFrame: FrameInfo.fromMap(map["sourceFrame"]?.cast()), + iosSourceFrame: + // ignore: deprecated_member_use_from_same_package + IOSWKFrameInfo.fromMap(map["sourceFrame"]?.cast()), + sourceFrame: + FrameInfo.fromMap(map["sourceFrame"]?.cast()), // ignore: deprecated_member_use_from_same_package - iosTargetFrame: IOSWKFrameInfo.fromMap(map["targetFrame"]?.cast()), - targetFrame: FrameInfo.fromMap(map["targetFrame"]?.cast())); + iosTargetFrame: + // ignore: deprecated_member_use_from_same_package + IOSWKFrameInfo.fromMap(map["targetFrame"]?.cast()), + targetFrame: + FrameInfo.fromMap(map["targetFrame"]?.cast())); } Map toMap() { @@ -5565,10 +5604,12 @@ class NavigationAction { "isRedirect": isRedirect ?? androidIsRedirect, // ignore: deprecated_member_use_from_same_package "androidIsRedirect": isRedirect ?? androidIsRedirect, - // ignore: deprecated_member_use_from_same_package - "iosWKNavigationType": navigationType?.toValue() ?? iosWKNavigationType?.toValue(), - // ignore: deprecated_member_use_from_same_package - "navigationType": navigationType?.toValue() ?? iosWKNavigationType?.toValue(), + "iosWKNavigationType": + // ignore: deprecated_member_use_from_same_package + navigationType?.toValue() ?? iosWKNavigationType?.toValue(), + "navigationType": + // ignore: deprecated_member_use_from_same_package + navigationType?.toValue() ?? iosWKNavigationType?.toValue(), // ignore: deprecated_member_use_from_same_package "iosSourceFrame": sourceFrame?.toMap() ?? iosSourceFrame?.toMap(), // ignore: deprecated_member_use_from_same_package @@ -5615,24 +5656,31 @@ class CreateWindowAction extends NavigationAction { CreateWindowAction( {required this.windowId, - @Deprecated('Use isDialog instead') this.androidIsDialog, + @Deprecated('Use isDialog instead') + this.androidIsDialog, this.isDialog, - @Deprecated('Use windowFeatures instead') this.iosWindowFeatures, + @Deprecated('Use windowFeatures instead') + this.iosWindowFeatures, this.windowFeatures, required URLRequest request, required bool isForMainFrame, - @Deprecated('Use hasGesture instead') bool? androidHasGesture, - @Deprecated('Use isRedirect instead') bool? androidIsRedirect, + @Deprecated('Use hasGesture instead') + bool? androidHasGesture, + @Deprecated('Use isRedirect instead') + bool? androidIsRedirect, bool? hasGesture, bool? isRedirect, - // ignore: deprecated_member_use_from_same_package - @Deprecated('Use navigationType instead') IOSWKNavigationType? iosWKNavigationType, + @Deprecated('Use navigationType instead') + // ignore: deprecated_member_use_from_same_package + IOSWKNavigationType? iosWKNavigationType, NavigationType? navigationType, - // ignore: deprecated_member_use_from_same_package - @Deprecated('Use sourceFrame instead') IOSWKFrameInfo? iosSourceFrame, + @Deprecated('Use sourceFrame instead') + // ignore: deprecated_member_use_from_same_package + IOSWKFrameInfo? iosSourceFrame, FrameInfo? sourceFrame, - // ignore: deprecated_member_use_from_same_package - @Deprecated('Use targetFrame instead') IOSWKFrameInfo? iosTargetFrame, + @Deprecated('Use targetFrame instead') + // ignore: deprecated_member_use_from_same_package + IOSWKFrameInfo? iosTargetFrame, FrameInfo? targetFrame}) : super( request: request, @@ -5644,18 +5692,29 @@ class CreateWindowAction extends NavigationAction { androidIsRedirect: isRedirect ?? androidIsRedirect, isRedirect: isRedirect ?? androidIsRedirect, // ignore: deprecated_member_use_from_same_package - iosWKNavigationType: IOSWKNavigationType.fromValue(navigationType?.toValue()) ?? iosWKNavigationType, - navigationType: navigationType ?? NavigationType.fromValue(iosWKNavigationType?.toValue()), + iosWKNavigationType: + // ignore: deprecated_member_use_from_same_package + IOSWKNavigationType.fromValue(navigationType?.toValue()) ?? + iosWKNavigationType, + navigationType: navigationType ?? + NavigationType.fromValue(iosWKNavigationType?.toValue()), // ignore: deprecated_member_use_from_same_package - iosSourceFrame: IOSWKFrameInfo.fromMap(sourceFrame?.toMap()) ?? iosSourceFrame, - sourceFrame: sourceFrame ?? FrameInfo.fromMap(iosSourceFrame?.toMap()), + iosSourceFrame: + // ignore: deprecated_member_use_from_same_package + IOSWKFrameInfo.fromMap(sourceFrame?.toMap()) ?? iosSourceFrame, + sourceFrame: + sourceFrame ?? FrameInfo.fromMap(iosSourceFrame?.toMap()), // ignore: deprecated_member_use_from_same_package - iosTargetFrame: IOSWKFrameInfo.fromMap(targetFrame?.toMap()) ?? iosTargetFrame, - targetFrame: targetFrame ?? FrameInfo.fromMap(iosTargetFrame?.toMap())) { + iosTargetFrame: + // ignore: deprecated_member_use_from_same_package + IOSWKFrameInfo.fromMap(targetFrame?.toMap()) ?? iosTargetFrame, + targetFrame: + targetFrame ?? FrameInfo.fromMap(iosTargetFrame?.toMap())) { // ignore: deprecated_member_use_from_same_package this.isDialog = this.isDialog ?? this.androidIsDialog; - // ignore: deprecated_member_use_from_same_package - this.windowFeatures = this.windowFeatures ?? WindowFeatures.fromMap(this.iosWindowFeatures?.toMap()); + this.windowFeatures = this.windowFeatures ?? + // ignore: deprecated_member_use_from_same_package + WindowFeatures.fromMap(this.iosWindowFeatures?.toMap()); } static CreateWindowAction? fromMap(Map? map) { @@ -5682,20 +5741,21 @@ class CreateWindowAction extends NavigationAction { isRedirect: map["isRedirect"], // ignore: deprecated_member_use_from_same_package iosWKNavigationType: - // ignore: deprecated_member_use_from_same_package + // ignore: deprecated_member_use_from_same_package IOSWKNavigationType.fromValue(map["navigationType"]), - navigationType: - NavigationType.fromValue(map["navigationType"]), + navigationType: NavigationType.fromValue(map["navigationType"]), // ignore: deprecated_member_use_from_same_package - iosSourceFrame: IOSWKFrameInfo.fromMap( - map["sourceFrame"]?.cast()), - sourceFrame: FrameInfo.fromMap( - map["sourceFrame"]?.cast()), + iosSourceFrame: + // ignore: deprecated_member_use_from_same_package + IOSWKFrameInfo.fromMap(map["sourceFrame"]?.cast()), + sourceFrame: + FrameInfo.fromMap(map["sourceFrame"]?.cast()), // ignore: deprecated_member_use_from_same_package - iosTargetFrame: IOSWKFrameInfo.fromMap( - map["targetFrame"]?.cast()), - targetFrame: FrameInfo.fromMap( - map["targetFrame"]?.cast())); + iosTargetFrame: + // ignore: deprecated_member_use_from_same_package + IOSWKFrameInfo.fromMap(map["targetFrame"]?.cast()), + targetFrame: + FrameInfo.fromMap(map["targetFrame"]?.cast())); } @override @@ -5707,8 +5767,9 @@ class CreateWindowAction extends NavigationAction { "androidIsDialog": isDialog ?? androidIsDialog, // ignore: deprecated_member_use_from_same_package "isDialog": isDialog ?? androidIsDialog, - // ignore: deprecated_member_use_from_same_package - "iosWindowFeatures": windowFeatures?.toMap() ?? iosWindowFeatures?.toMap(), + "iosWindowFeatures": + // ignore: deprecated_member_use_from_same_package + windowFeatures?.toMap() ?? iosWindowFeatures?.toMap(), // ignore: deprecated_member_use_from_same_package "windowFeatures": windowFeatures?.toMap() ?? iosWindowFeatures?.toMap(), }); @@ -5821,48 +5882,47 @@ class WebsiteDataType { /// ///**NOTE**: available on iOS 11.3+. static const WKWebsiteDataTypeFetchCache = - const WebsiteDataType._internal("WKWebsiteDataTypeFetchCache"); + const WebsiteDataType._internal("WKWebsiteDataTypeFetchCache"); ///On-disk caches. static const WKWebsiteDataTypeDiskCache = - const WebsiteDataType._internal("WKWebsiteDataTypeDiskCache"); + const WebsiteDataType._internal("WKWebsiteDataTypeDiskCache"); ///In-memory caches. static const WKWebsiteDataTypeMemoryCache = - const WebsiteDataType._internal("WKWebsiteDataTypeMemoryCache"); + const WebsiteDataType._internal("WKWebsiteDataTypeMemoryCache"); ///HTML offline web application caches. static const WKWebsiteDataTypeOfflineWebApplicationCache = - const WebsiteDataType._internal( - "WKWebsiteDataTypeOfflineWebApplicationCache"); + const WebsiteDataType._internal( + "WKWebsiteDataTypeOfflineWebApplicationCache"); ///Cookies. static const WKWebsiteDataTypeCookies = - const WebsiteDataType._internal("WKWebsiteDataTypeCookies"); + const WebsiteDataType._internal("WKWebsiteDataTypeCookies"); ///HTML session storage. static const WKWebsiteDataTypeSessionStorage = - const WebsiteDataType._internal("WKWebsiteDataTypeSessionStorage"); + const WebsiteDataType._internal("WKWebsiteDataTypeSessionStorage"); ///HTML local storage. static const WKWebsiteDataTypeLocalStorage = - const WebsiteDataType._internal("WKWebsiteDataTypeLocalStorage"); + const WebsiteDataType._internal("WKWebsiteDataTypeLocalStorage"); ///WebSQL databases. static const WKWebsiteDataTypeWebSQLDatabases = - const WebsiteDataType._internal("WKWebsiteDataTypeWebSQLDatabases"); + const WebsiteDataType._internal("WKWebsiteDataTypeWebSQLDatabases"); ///IndexedDB databases. static const WKWebsiteDataTypeIndexedDBDatabases = - const WebsiteDataType._internal( - "WKWebsiteDataTypeIndexedDBDatabases"); + const WebsiteDataType._internal("WKWebsiteDataTypeIndexedDBDatabases"); ///Service worker registrations. /// ///**NOTE**: available on iOS 11.3+. static const WKWebsiteDataTypeServiceWorkerRegistrations = - const WebsiteDataType._internal( - "WKWebsiteDataTypeServiceWorkerRegistrations"); + const WebsiteDataType._internal( + "WKWebsiteDataTypeServiceWorkerRegistrations"); ///Returns a set of all available website data types. // ignore: non_constant_identifier_names @@ -6426,7 +6486,7 @@ class OverScrollMode { ///Allow a user to over-scroll this view only if the content is large enough to meaningfully scroll, provided it is a view that can scroll. static const OVER_SCROLL_IF_CONTENT_SCROLLS = - const OverScrollMode._internal(1); + const OverScrollMode._internal(1); ///Never allow a user to over-scroll this view. static const OVER_SCROLL_NEVER = const OverScrollMode._internal(2); @@ -6545,23 +6605,22 @@ class ScrollBarStyle { ///The scrollbar style to display the scrollbars inside the content area, without increasing the padding. ///The scrollbars will be overlaid with translucency on the view's content. - static const SCROLLBARS_INSIDE_OVERLAY = - const ScrollBarStyle._internal(0); + static const SCROLLBARS_INSIDE_OVERLAY = const ScrollBarStyle._internal(0); ///The scrollbar style to display the scrollbars inside the padded area, increasing the padding of the view. ///The scrollbars will not overlap the content area of the view. static const SCROLLBARS_INSIDE_INSET = - const ScrollBarStyle._internal(16777216); + const ScrollBarStyle._internal(16777216); ///The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding. ///The scrollbars will be overlaid with translucency. static const SCROLLBARS_OUTSIDE_OVERLAY = - const ScrollBarStyle._internal(33554432); + const ScrollBarStyle._internal(33554432); ///The scrollbar style to display the scrollbars at the edge of the view, increasing the padding of the view. ///The scrollbars will only overlap the background, if any. static const SCROLLBARS_OUTSIDE_INSET = - const ScrollBarStyle._internal(50331648); + const ScrollBarStyle._internal(50331648); bool operator ==(value) => value == _value; @@ -6687,15 +6746,15 @@ class VerticalScrollbarPosition { ///Position the scroll bar at the default position as determined by the system. static const SCROLLBAR_POSITION_DEFAULT = - const VerticalScrollbarPosition._internal(0); + const VerticalScrollbarPosition._internal(0); ///Position the scroll bar along the left edge. static const SCROLLBAR_POSITION_LEFT = - const VerticalScrollbarPosition._internal(1); + const VerticalScrollbarPosition._internal(1); ///Position the scroll bar along the right edge. static const SCROLLBAR_POSITION_RIGHT = - const VerticalScrollbarPosition._internal(2); + const VerticalScrollbarPosition._internal(2); bool operator ==(value) => value == _value; @@ -6775,7 +6834,7 @@ class WebViewPackageInfo { static WebViewPackageInfo? fromMap(Map? map) { return map != null ? WebViewPackageInfo( - versionName: map["versionName"], packageName: map["packageName"]) + versionName: map["versionName"], packageName: map["packageName"]) : null; } @@ -7360,19 +7419,19 @@ class ScrollViewContentInsetAdjustmentBehavior { ///Automatically adjust the scroll view insets. static const AUTOMATIC = - const ScrollViewContentInsetAdjustmentBehavior._internal(0); + const ScrollViewContentInsetAdjustmentBehavior._internal(0); ///Adjust the insets only in the scrollable directions. static const SCROLLABLE_AXES = - const ScrollViewContentInsetAdjustmentBehavior._internal(1); + const ScrollViewContentInsetAdjustmentBehavior._internal(1); ///Do not adjust the scroll view insets. static const NEVER = - const ScrollViewContentInsetAdjustmentBehavior._internal(2); + const ScrollViewContentInsetAdjustmentBehavior._internal(2); ///Always include the safe area insets in the content adjustment. static const ALWAYS = - const ScrollViewContentInsetAdjustmentBehavior._internal(3); + const ScrollViewContentInsetAdjustmentBehavior._internal(3); bool operator ==(value) => value == _value; @@ -7736,7 +7795,10 @@ class UserScript { ContentWorld? contentWorld}) { this.contentWorld = contentWorld ?? ContentWorld.PAGE; // ignore: deprecated_member_use_from_same_package - this.forMainFrameOnly = this.iosForMainFrameOnly != null ? this.iosForMainFrameOnly! : this.forMainFrameOnly; + this.forMainFrameOnly = this.iosForMainFrameOnly != null + // ignore: deprecated_member_use_from_same_package + ? this.iosForMainFrameOnly! + : this.forMainFrameOnly; } Map toMap() { @@ -7989,7 +8051,10 @@ class ScreenshotConfiguration { this.afterScreenUpdates = true}) { assert(this.quality >= 0); // ignore: deprecated_member_use_from_same_package - this.afterScreenUpdates = this.iosAfterScreenUpdates != null ? this.iosAfterScreenUpdates! : this.afterScreenUpdates; + this.afterScreenUpdates = this.iosAfterScreenUpdates != null + // ignore: deprecated_member_use_from_same_package + ? this.iosAfterScreenUpdates! + : this.afterScreenUpdates; } Map toMap() { @@ -8415,12 +8480,12 @@ class URLResponse { URLResponse( {this.url, - required this.expectedContentLength, - this.mimeType, - this.suggestedFilename, - this.textEncodingName, - this.headers, - this.statusCode}); + required this.expectedContentLength, + this.mimeType, + this.suggestedFilename, + this.textEncodingName, + this.headers, + this.statusCode}); static URLResponse? fromMap(Map? map) { if (map == null) { @@ -8540,16 +8605,15 @@ class NavigationResponse { NavigationResponse( {this.response, - required this.isForMainFrame, - required this.canShowMIMEType}); + required this.isForMainFrame, + required this.canShowMIMEType}); static NavigationResponse? fromMap(Map? map) { if (map == null) { return null; } return NavigationResponse( - response: - URLResponse.fromMap(map["response"]?.cast()), + response: URLResponse.fromMap(map["response"]?.cast()), isForMainFrame: map["isForMainFrame"], canShowMIMEType: map["canShowMIMEType"], ); @@ -8831,43 +8895,57 @@ class URLRequest { ///**NOTE**: available only on iOS. Uri? mainDocumentURL; - URLRequest( - {required this.url, - this.method, - this.headers, - this.body, - @Deprecated("Use allowsCellularAccess instead") this.iosAllowsCellularAccess, - this.allowsCellularAccess, - @Deprecated("Use allowsConstrainedNetworkAccess instead") this.iosAllowsConstrainedNetworkAccess, - this.allowsConstrainedNetworkAccess, - @Deprecated("Use allowsExpensiveNetworkAccess instead") this.iosAllowsExpensiveNetworkAccess, - this.allowsExpensiveNetworkAccess, - @Deprecated("Use cachePolicy instead") this.iosCachePolicy, - this.cachePolicy, - @Deprecated("Use httpShouldHandleCookies instead") this.iosHttpShouldHandleCookies, - this.httpShouldHandleCookies, - @Deprecated("Use httpShouldUsePipelining instead") this.iosHttpShouldUsePipelining, - this.httpShouldUsePipelining, - @Deprecated("Use networkServiceType instead") this.iosNetworkServiceType, - this.networkServiceType, - @Deprecated("Use timeoutInterval instead") this.iosTimeoutInterval, - this.timeoutInterval, - @Deprecated("Use mainDocumentURL instead") this.iosMainDocumentURL, - this.mainDocumentURL,}) { - // ignore: deprecated_member_use_from_same_package - this.allowsCellularAccess = this.allowsCellularAccess ?? this.iosAllowsCellularAccess; - // ignore: deprecated_member_use_from_same_package - this.allowsConstrainedNetworkAccess = this.allowsConstrainedNetworkAccess ?? this.iosAllowsConstrainedNetworkAccess; - // ignore: deprecated_member_use_from_same_package - this.allowsExpensiveNetworkAccess = this.allowsExpensiveNetworkAccess ?? this.iosAllowsExpensiveNetworkAccess; - // ignore: deprecated_member_use_from_same_package - this.cachePolicy = this.cachePolicy ?? URLRequestCachePolicy.fromValue(this.iosCachePolicy?.toValue()); - // ignore: deprecated_member_use_from_same_package - this.httpShouldHandleCookies = this.httpShouldHandleCookies ?? this.iosHttpShouldHandleCookies; - // ignore: deprecated_member_use_from_same_package - this.httpShouldUsePipelining = this.httpShouldUsePipelining ?? this.iosHttpShouldUsePipelining; - // ignore: deprecated_member_use_from_same_package - this.networkServiceType = this.networkServiceType ?? URLRequestNetworkServiceType.fromValue(this.iosNetworkServiceType?.toValue()); + URLRequest({ + required this.url, + this.method, + this.headers, + this.body, + @Deprecated("Use allowsCellularAccess instead") + this.iosAllowsCellularAccess, + this.allowsCellularAccess, + @Deprecated("Use allowsConstrainedNetworkAccess instead") + this.iosAllowsConstrainedNetworkAccess, + this.allowsConstrainedNetworkAccess, + @Deprecated("Use allowsExpensiveNetworkAccess instead") + this.iosAllowsExpensiveNetworkAccess, + this.allowsExpensiveNetworkAccess, + @Deprecated("Use cachePolicy instead") this.iosCachePolicy, + this.cachePolicy, + @Deprecated("Use httpShouldHandleCookies instead") + this.iosHttpShouldHandleCookies, + this.httpShouldHandleCookies, + @Deprecated("Use httpShouldUsePipelining instead") + this.iosHttpShouldUsePipelining, + this.httpShouldUsePipelining, + @Deprecated("Use networkServiceType instead") this.iosNetworkServiceType, + this.networkServiceType, + @Deprecated("Use timeoutInterval instead") this.iosTimeoutInterval, + this.timeoutInterval, + @Deprecated("Use mainDocumentURL instead") this.iosMainDocumentURL, + this.mainDocumentURL, + }) { + this.allowsCellularAccess = + // ignore: deprecated_member_use_from_same_package + this.allowsCellularAccess ?? this.iosAllowsCellularAccess; + this.allowsConstrainedNetworkAccess = this.allowsConstrainedNetworkAccess ?? + // ignore: deprecated_member_use_from_same_package + this.iosAllowsConstrainedNetworkAccess; + this.allowsExpensiveNetworkAccess = this.allowsExpensiveNetworkAccess ?? + // ignore: deprecated_member_use_from_same_package + this.iosAllowsExpensiveNetworkAccess; + this.cachePolicy = this.cachePolicy ?? + // ignore: deprecated_member_use_from_same_package + URLRequestCachePolicy.fromValue(this.iosCachePolicy?.toValue()); + this.httpShouldHandleCookies = + // ignore: deprecated_member_use_from_same_package + this.httpShouldHandleCookies ?? this.iosHttpShouldHandleCookies; + this.httpShouldUsePipelining = + // ignore: deprecated_member_use_from_same_package + this.httpShouldUsePipelining ?? this.iosHttpShouldUsePipelining; + this.networkServiceType = + this.networkServiceType ?? URLRequestNetworkServiceType.fromValue( + // ignore: deprecated_member_use_from_same_package + this.iosNetworkServiceType?.toValue()); // ignore: deprecated_member_use_from_same_package this.timeoutInterval = this.timeoutInterval ?? this.iosTimeoutInterval; // ignore: deprecated_member_use_from_same_package @@ -8902,8 +8980,11 @@ class URLRequest { iosHttpShouldUsePipelining: map["httpShouldUsePipelining"], httpShouldUsePipelining: map["httpShouldUsePipelining"], // ignore: deprecated_member_use_from_same_package - iosNetworkServiceType: IOSURLRequestNetworkServiceType.fromValue(map["networkServiceType"]), - networkServiceType: URLRequestNetworkServiceType.fromValue(map["networkServiceType"]), + iosNetworkServiceType: + // ignore: deprecated_member_use_from_same_package + IOSURLRequestNetworkServiceType.fromValue(map["networkServiceType"]), + networkServiceType: + URLRequestNetworkServiceType.fromValue(map["networkServiceType"]), // ignore: deprecated_member_use_from_same_package iosTimeoutInterval: map["timeoutInterval"], timeoutInterval: map["timeoutInterval"], @@ -8923,34 +9004,45 @@ class URLRequest { "headers": headers, "method": method, "body": body, - // ignore: deprecated_member_use_from_same_package - "iosAllowsCellularAccess": allowsCellularAccess ?? iosAllowsCellularAccess, + "iosAllowsCellularAccess": + // ignore: deprecated_member_use_from_same_package + allowsCellularAccess ?? iosAllowsCellularAccess, // ignore: deprecated_member_use_from_same_package "allowsCellularAccess": allowsCellularAccess ?? iosAllowsCellularAccess, - // ignore: deprecated_member_use_from_same_package - "iosAllowsConstrainedNetworkAccess": allowsConstrainedNetworkAccess ?? iosAllowsConstrainedNetworkAccess, - // ignore: deprecated_member_use_from_same_package - "allowsConstrainedNetworkAccess": allowsConstrainedNetworkAccess ?? iosAllowsConstrainedNetworkAccess, - // ignore: deprecated_member_use_from_same_package - "iosAllowsExpensiveNetworkAccess": allowsExpensiveNetworkAccess ?? iosAllowsExpensiveNetworkAccess, - // ignore: deprecated_member_use_from_same_package - "allowsExpensiveNetworkAccess": allowsExpensiveNetworkAccess ?? iosAllowsExpensiveNetworkAccess, + "iosAllowsConstrainedNetworkAccess": + // ignore: deprecated_member_use_from_same_package + allowsConstrainedNetworkAccess ?? iosAllowsConstrainedNetworkAccess, + "allowsConstrainedNetworkAccess": + // ignore: deprecated_member_use_from_same_package + allowsConstrainedNetworkAccess ?? iosAllowsConstrainedNetworkAccess, + "iosAllowsExpensiveNetworkAccess": + // ignore: deprecated_member_use_from_same_package + allowsExpensiveNetworkAccess ?? iosAllowsExpensiveNetworkAccess, + "allowsExpensiveNetworkAccess": + // ignore: deprecated_member_use_from_same_package + allowsExpensiveNetworkAccess ?? iosAllowsExpensiveNetworkAccess, // ignore: deprecated_member_use_from_same_package "iosCachePolicy": cachePolicy?.toValue() ?? iosCachePolicy?.toValue(), // ignore: deprecated_member_use_from_same_package "cachePolicy": cachePolicy?.toValue() ?? iosCachePolicy?.toValue(), - // ignore: deprecated_member_use_from_same_package - "iosHttpShouldHandleCookies": httpShouldHandleCookies ?? iosHttpShouldHandleCookies, - // ignore: deprecated_member_use_from_same_package - "httpShouldHandleCookies": httpShouldHandleCookies ?? iosHttpShouldHandleCookies, - // ignore: deprecated_member_use_from_same_package - "iosHttpShouldUsePipelining": httpShouldUsePipelining ?? iosHttpShouldUsePipelining, - // ignore: deprecated_member_use_from_same_package - "httpShouldUsePipelining": httpShouldUsePipelining ?? iosHttpShouldUsePipelining, - // ignore: deprecated_member_use_from_same_package - "iosNetworkServiceType": networkServiceType?.toValue() ?? iosNetworkServiceType?.toValue(), - // ignore: deprecated_member_use_from_same_package - "networkServiceType": networkServiceType?.toValue() ?? iosNetworkServiceType?.toValue(), + "iosHttpShouldHandleCookies": + // ignore: deprecated_member_use_from_same_package + httpShouldHandleCookies ?? iosHttpShouldHandleCookies, + "httpShouldHandleCookies": + // ignore: deprecated_member_use_from_same_package + httpShouldHandleCookies ?? iosHttpShouldHandleCookies, + "iosHttpShouldUsePipelining": + // ignore: deprecated_member_use_from_same_package + httpShouldUsePipelining ?? iosHttpShouldUsePipelining, + "httpShouldUsePipelining": + // ignore: deprecated_member_use_from_same_package + httpShouldUsePipelining ?? iosHttpShouldUsePipelining, + "iosNetworkServiceType": + // ignore: deprecated_member_use_from_same_package + networkServiceType?.toValue() ?? iosNetworkServiceType?.toValue(), + "networkServiceType": + // ignore: deprecated_member_use_from_same_package + networkServiceType?.toValue() ?? iosNetworkServiceType?.toValue(), // ignore: deprecated_member_use_from_same_package "iosTimeoutInterval": timeoutInterval ?? iosTimeoutInterval, // ignore: deprecated_member_use_from_same_package @@ -9000,13 +9092,13 @@ class WindowFeatures { WindowFeatures( {this.allowsResizing, - this.height, - this.menuBarVisibility, - this.statusBarVisibility, - this.toolbarsVisibility, - this.width, - this.x, - this.y}); + this.height, + this.menuBarVisibility, + this.statusBarVisibility, + this.toolbarsVisibility, + this.width, + this.x, + this.y}); static WindowFeatures? fromMap(Map? map) { if (map == null) { @@ -9123,7 +9215,7 @@ class IOSWKWindowFeatures { } ///Class that represents a string with associated attributes -///used by the [PullToRefreshController] and [PullToRefreshOptions] classes. +///used by the [PullToRefreshController] and [PullToRefreshSettings] classes. class AttributedString { ///The characters for the new object. String string; @@ -9633,7 +9725,7 @@ class AttributedStringTextEffectStyle { ///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper. static const LETTERPRESS_STYLE = - const AttributedStringTextEffectStyle._internal("letterpressStyle"); + const AttributedStringTextEffectStyle._internal("letterpressStyle"); bool operator ==(value) => value == _value; @@ -9996,13 +10088,14 @@ class TrustedWebActivityImmersiveDisplayMode TrustedWebActivityImmersiveDisplayMode( {required this.isSticky, - this.displayCutoutMode = LayoutInDisplayCutoutMode.DEFAULT, - this.layoutInDisplayCutoutMode}) { + this.displayCutoutMode = LayoutInDisplayCutoutMode.DEFAULT, + this.layoutInDisplayCutoutMode}) { // ignore: deprecated_member_use_from_same_package - this.displayCutoutMode = this.layoutInDisplayCutoutMode != null ? - // ignore: deprecated_member_use_from_same_package - LayoutInDisplayCutoutMode.fromValue(this.layoutInDisplayCutoutMode!.toValue())! : - this.displayCutoutMode; + this.displayCutoutMode = this.layoutInDisplayCutoutMode != null + ? LayoutInDisplayCutoutMode.fromValue( + // ignore: deprecated_member_use_from_same_package + this.layoutInDisplayCutoutMode!.toValue())! + : this.displayCutoutMode; } static TrustedWebActivityImmersiveDisplayMode? fromMap( @@ -10088,8 +10181,7 @@ class LayoutInDisplayCutoutMode { ///Content renders into the cutout area in both portrait and landscape modes. /// ///**NOTE**: available on Android 28+. - static const SHORT_EDGES = - const LayoutInDisplayCutoutMode._internal(1); + static const SHORT_EDGES = const LayoutInDisplayCutoutMode._internal(1); ///Content never renders into the cutout area. /// diff --git a/lib/src/web_storage/web_storage_manager.dart b/lib/src/web_storage/web_storage_manager.dart index 5017db26..21ec315c 100755 --- a/lib/src/web_storage/web_storage_manager.dart +++ b/lib/src/web_storage/web_storage_manager.dart @@ -6,7 +6,6 @@ import '_static_channel.dart'; import 'android/web_storage_manager.dart'; import 'ios/web_storage_manager.dart'; - import '../types.dart'; ///Class that implements a singleton object (shared instance) which manages the web storage used by WebView instances. @@ -48,8 +47,8 @@ class WebStorageManager { Map args = {}; List> origins = - (await _staticChannel.invokeMethod('getOrigins', args)) - .cast>(); + (await _staticChannel.invokeMethod('getOrigins', args)) + .cast>(); for (var origin in origins) { originsList.add(WebStorageOrigin( @@ -121,8 +120,8 @@ class WebStorageManager { Map args = {}; args.putIfAbsent("dataTypes", () => dataTypesList); List> records = - (await _staticChannel.invokeMethod('fetchDataRecords', args)) - .cast>(); + (await _staticChannel.invokeMethod('fetchDataRecords', args)) + .cast>(); for (var record in records) { List dataTypesString = record["dataTypes"].cast(); Set dataTypes = Set(); @@ -148,7 +147,7 @@ class WebStorageManager { ///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532936-removedata)) Future removeDataFor( {required Set dataTypes, - required List dataRecords}) async { + required List dataRecords}) async { List dataTypesList = []; for (var dataType in dataTypes) { dataTypesList.add(dataType.toValue()); @@ -174,8 +173,7 @@ class WebStorageManager { ///**Supported Platforms/Implementations**: ///- iOS ([Official API - WKWebsiteDataStore.removeData](https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata)) Future removeDataModifiedSince( - {required Set dataTypes, - required DateTime date}) async { + {required Set dataTypes, required DateTime date}) async { List dataTypesList = []; for (var dataType in dataTypes) { dataTypesList.add(dataType.toValue());