updated ChromeSafariBrowser class, Renamed Chrome Custom Tab addShareButton option to addDefaultShareMenuItem, Renamed ChromeSafariBrowser onLoaded to onCompletedInitialLoad, Renamed all iOS and Android webview options class, fix #229, Added packageName and keepAliveEnabled ChromeCustomTab options for Android

This commit is contained in:
Lorenzo Pichilli 2019-12-18 01:56:21 +01:00
parent 9c7ac0da8f
commit 4d752ee9d9
19 changed files with 330 additions and 278 deletions

View File

@ -11,6 +11,7 @@
- Added `reloadFromOrigin` webview method for iOS
- Added `automaticallyAdjustsScrollIndicatorInsets` webview options for iOS
- Added `WebStorageManager` class which manages the web storage used by WebView instances
- Added `packageName` [#229](https://github.com/pichillilorenzo/flutter_inappwebview/issues/229) and `keepAliveEnabled` ChromeCustomTab options for Android
- Updated for Flutter 1.12 new Java Embedding API (Android)
- Updated `clearCache` for Android
- Updated default value for `domStorageEnabled` and `databaseEnabled` options to `true` for Android
@ -34,7 +35,9 @@
- Renamed `onPermissionRequest` to `androidOnPermissionRequest`
- Updated attribute names for `InAppWebViewWidgetOptions`, `InAppBrowserClassOptions` and `ChromeSafariBrowserClassOptions` classes
- Renamed and updated `onNavigationStateChange` to `onUpdateVisitedHistory`
- Renamed all iOS options prefix from `Ios` to `IOS`
- Renamed all iOS and Android webview options class
- Renamed Chrome Custom Tab `addShareButton` option to `addDefaultShareMenuItem`
- Renamed ChromeSafariBrowser `onLoaded` to `onCompletedInitialLoad`
## 2.1.0+1

View File

@ -641,8 +641,8 @@ Specific options of the `InAppBrowser` class are:
* `toolbarBottomTranslucent`: Set to `true` to set the toolbar at the bottom translucent. The default value is `true`.
* `closeButtonCaption`: Set the custom text for the close button.
* `closeButtonColor`: Set the custom color for the close button.
* `presentationStyle`: Set the custom modal presentation style when presenting the WebView. The default value is `IosWebViewOptionsPresentationStyle.FULL_SCREEN`.
* `transitionStyle`: Set to the custom transition style when presenting the WebView. The default value is `IosWebViewOptionsTransitionStyle.COVER_VERTICAL`.
* `presentationStyle`: Set the custom modal presentation style when presenting the WebView. The default value is `IOSUIModalPresentationStyle.FULL_SCREEN`.
* `transitionStyle`: Set to the custom transition style when presenting the WebView. The default value is `IOSUIModalTransitionStyle.COVER_VERTICAL`.
* `spinner`: Set to `false` to hide the spinner when the WebView is loading a page. The default value is `true`.
#### `InAppBrowser` Events
@ -698,8 +698,8 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser {
}
@override
void onLoaded() {
print("ChromeSafari browser loaded");
void onCompletedInitialLoad() {
print("ChromeSafari browser initial load completed");
}
@override
@ -737,7 +737,7 @@ class _MyAppState extends State<MyApp> {
await widget.browser.open(
url: "https://flutter.dev/",
options: ChromeSafariBrowserClassOptions(
android: AndroidChromeCustomTabsOptions(addShareButton: false),
android: AndroidChromeCustomTabsOptions(addDefaultShareMenuItem: false),
ios: IosSafariOptions(barCollapsingEnabled: true)));
},
child: Text("Open Chrome Safari Browser")),
@ -767,26 +767,28 @@ Screenshots:
##### `ChromeSafariBrowser` Android-specific options
* `addShareButton`: Set to `false` if you don't want the default share button. The default value is `true`.
* `addDefaultShareMenuItem`: Set to `false` if you don't want the default share item to the menu. The default value is `true`.
* `showTitle`: Set to `false` if the title shouldn't be shown in the custom tab. The default value is `true`.
* `toolbarBackgroundColor`: Set the custom background color of the toolbar.
* `enableUrlBarHiding`: Set to `true` to enable the url bar to hide as the user scrolls down on the page. The default value is `false`.
* `instantAppsEnabled`: Set to `true` to enable Instant Apps. The default value is `false`.
* `packageName`: Set the name of the application package to handle the intent (for example `com.android.chrome`), or null to allow any application package.
* `keepAliveEnabled`: Set to `true` to enable Keep Alive. The default value is `false`.
##### `ChromeSafariBrowser` iOS-specific options
* `entersReaderIfAvailable`: Set to `true` if Reader mode should be entered automatically when it is available for the webpage. The default value is `false`.
* `barCollapsingEnabled`: Set to `true` to enable bar collapsing. The default value is `false`.
* `dismissButtonStyle`: Set the custom style for the dismiss button. The default value is `IosSafariOptionsDismissButtonStyle.DONE`.
* `dismissButtonStyle`: Set the custom style for the dismiss button. The default value is `IOSSafariDismissButtonStyle.DONE`.
* `preferredBarTintColor`: Set the custom background color of the navigation bar and the toolbar.
* `preferredControlTintColor`: Set the custom color of the control buttons on the navigation bar and the toolbar.
* `presentationStyle`: Set the custom modal presentation style when presenting the WebView. The default value is `IosWebViewOptionsPresentationStyle.FULL_SCREEN`.
* `transitionStyle`: Set to the custom transition style when presenting the WebView. The default value is `IosWebViewOptionsTransitionStyle.COVER_VERTICAL`.
* `presentationStyle`: Set the custom modal presentation style when presenting the WebView. The default value is `IOSUIModalPresentationStyle.FULL_SCREEN`.
* `transitionStyle`: Set to the custom transition style when presenting the WebView. The default value is `IOSUIModalTransitionStyle.COVER_VERTICAL`.
#### `ChromeSafariBrowser` Events
* `onOpened`: Event fires when the `ChromeSafariBrowser` is opened.
* `onLoaded`: Event fires when the `ChromeSafariBrowser` is loaded.
* `onCompletedInitialLoad`: Event fires when the initial URL load is complete.
* `onClosed`: Event fires when the `ChromeSafariBrowser` is closed.
### `InAppLocalhostServer` class

View File

@ -5,7 +5,12 @@ import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import androidx.browser.customtabs.CustomTabsCallback;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.CustomTabsService;
import androidx.browser.customtabs.CustomTabsSession;
import com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin;
import com.pichillilorenzo.flutter_inappwebview.R;
@ -20,7 +25,10 @@ public class ChromeCustomTabsActivity extends Activity {
CustomTabsIntent.Builder builder;
ChromeCustomTabsOptions options;
private CustomTabActivityHelper customTabActivityHelper;
private CustomTabsSession customTabsSession;
private final int CHROME_CUSTOM_TAB_REQUEST_CODE = 100;
private boolean onChromeSafariBrowserOpened = false;
private boolean onChromeSafariBrowserCompletedInitialLoad = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -31,30 +39,82 @@ public class ChromeCustomTabsActivity extends Activity {
Bundle b = getIntent().getExtras();
assert b != null;
uuid = b.getString("uuid");
String url = b.getString("url");
final String url = b.getString("url");
options = new ChromeCustomTabsOptions();
options.parse((HashMap<String, Object>) b.getSerializable("options"));
InAppWebViewFlutterPlugin.inAppBrowser.chromeCustomTabsActivities.put(uuid, this);
final ChromeCustomTabsActivity chromeCustomTabsActivity = this;
customTabActivityHelper = new CustomTabActivityHelper();
builder = new CustomTabsIntent.Builder();
customTabActivityHelper.setConnectionCallback(new CustomTabActivityHelper.ConnectionCallback() {
@Override
public void onCustomTabsConnected() {
customTabsSession = customTabActivityHelper.getSession();
Uri uri = Uri.parse(url);
customTabActivityHelper.mayLaunchUrl(uri, null, null);
prepareCustomTabs();
builder = new CustomTabsIntent.Builder(customTabsSession);
CustomTabsIntent customTabsIntent = builder.build();
prepareCustomTabs(customTabsIntent);
CustomTabActivityHelper.openCustomTab(chromeCustomTabsActivity, customTabsIntent, uri, CHROME_CUSTOM_TAB_REQUEST_CODE);
}
CustomTabsIntent customTabsIntent = builder.build();
@Override
public void onCustomTabsDisconnected() {
customTabsSession = null;
finish();
Map<String, Object> obj = new HashMap<>();
obj.put("uuid", uuid);
InAppWebViewFlutterPlugin.inAppBrowser.channel.invokeMethod("onChromeSafariBrowserClosed", obj);
}
});
CustomTabActivityHelper.openCustomTab(this, customTabsIntent, Uri.parse(url), CHROME_CUSTOM_TAB_REQUEST_CODE);
customTabActivityHelper.setCustomTabsCallback(new CustomTabsCallback() {
@Override
public void onNavigationEvent(int navigationEvent, Bundle extras) {
if (navigationEvent == TAB_SHOWN && !onChromeSafariBrowserOpened) {
onChromeSafariBrowserOpened = true;
Map<String, Object> obj = new HashMap<>();
obj.put("uuid", uuid);
InAppWebViewFlutterPlugin.inAppBrowser.channel.invokeMethod("onChromeSafariBrowserOpened", obj);
}
Map<String, Object> obj = new HashMap<>();
obj.put("uuid", uuid);
InAppWebViewFlutterPlugin.inAppBrowser.channel.invokeMethod("onChromeSafariBrowserOpened", obj);
InAppWebViewFlutterPlugin.inAppBrowser.channel.invokeMethod("onChromeSafariBrowserLoaded", obj);
if (navigationEvent == NAVIGATION_FINISHED && !onChromeSafariBrowserCompletedInitialLoad) {
onChromeSafariBrowserCompletedInitialLoad = true;
Map<String, Object> obj = new HashMap<>();
obj.put("uuid", uuid);
InAppWebViewFlutterPlugin.inAppBrowser.channel.invokeMethod("onChromeSafariBrowserCompletedInitialLoad", obj);
}
}
@Override
public void extraCallback(String callbackName, Bundle args) {
}
@Override
public void onMessageChannelReady(Bundle extras) {
}
@Override
public void onPostMessage(String message, Bundle extras) {
}
@Override
public void onRelationshipValidationResult(@CustomTabsService.Relation int relation, Uri requestedOrigin,
boolean result, Bundle extras) {
}
});
}
private void prepareCustomTabs() {
if (options.addShareButton)
private void prepareCustomTabs(CustomTabsIntent customTabsIntent) {
if (options.addDefaultShareMenuItem)
builder.addDefaultShareMenuItem();
if (!options.toolbarBackgroundColor.isEmpty())
@ -66,6 +126,14 @@ public class ChromeCustomTabsActivity extends Activity {
builder.enableUrlBarHiding();
builder.setInstantAppsEnabled(options.instantAppsEnabled);
if (options.packageName != null)
customTabsIntent.intent.setPackage(options.packageName);
else
customTabsIntent.intent.setPackage(CustomTabsHelper.getPackageNameToUse(this));
if (options.keepAliveEnabled)
CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent);
}
@Override
@ -83,6 +151,7 @@ public class ChromeCustomTabsActivity extends Activity {
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CHROME_CUSTOM_TAB_REQUEST_CODE) {
customTabsSession = null;
finish();
Map<String, Object> obj = new HashMap<>();
obj.put("uuid", uuid);

View File

@ -6,10 +6,12 @@ public class ChromeCustomTabsOptions extends Options {
final static String LOG_TAG = "ChromeCustomTabsOptions";
public boolean addShareButton = true;
public boolean showTitle = true;
public Boolean addDefaultShareMenuItem = true;
public Boolean showTitle = true;
public String toolbarBackgroundColor = "";
public boolean enableUrlBarHiding = false;
public boolean instantAppsEnabled = false;
public Boolean enableUrlBarHiding = false;
public Boolean instantAppsEnabled = false;
public String packageName;
public Boolean keepAliveEnabled = false;
}

View File

@ -3,6 +3,8 @@ package com.pichillilorenzo.flutter_inappwebview.ChromeCustomTabs;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import androidx.browser.customtabs.CustomTabsCallback;
import androidx.browser.customtabs.CustomTabsClient;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.CustomTabsServiceConnection;
@ -18,6 +20,7 @@ public class CustomTabActivityHelper implements ServiceConnectionCallback {
private CustomTabsClient mClient;
private CustomTabsServiceConnection mConnection;
private ConnectionCallback mConnectionCallback;
private CustomTabsCallback mCustomTabsCallback;
/**
* Opens the URL on a Custom Tab if possible. Otherwise fallsback to opening it on a WebView.
@ -59,7 +62,7 @@ public class CustomTabActivityHelper implements ServiceConnectionCallback {
if (mClient == null) {
mCustomTabsSession = null;
} else if (mCustomTabsSession == null) {
mCustomTabsSession = mClient.newSession(null);
mCustomTabsSession = mClient.newSession(mCustomTabsCallback);
}
return mCustomTabsSession;
}
@ -72,6 +75,10 @@ public class CustomTabActivityHelper implements ServiceConnectionCallback {
this.mConnectionCallback = connectionCallback;
}
public void setCustomTabsCallback(CustomTabsCallback customTabsCallback) {
this.mCustomTabsCallback = customTabsCallback;
}
/**
* Binds the Activity to the Custom Tabs Service.
* @param activity the activity to be binded to the service.

View File

@ -9,6 +9,8 @@ import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import androidx.browser.customtabs.CustomTabsService;
import java.util.ArrayList;
import java.util.List;
@ -23,8 +25,6 @@ public class CustomTabsHelper {
static final String LOCAL_PACKAGE = "com.google.android.apps.chrome";
private static final String EXTRA_CUSTOM_TABS_KEEP_ALIVE =
"android.support.customtabs.extra.KEEP_ALIVE";
private static final String ACTION_CUSTOM_TABS_CONNECTION =
"android.support.customtabs.action.CustomTabsService";
private static String sPackageNameToUse;
@ -63,7 +63,7 @@ public class CustomTabsHelper {
List<String> packagesSupportingCustomTabs = new ArrayList<>();
for (ResolveInfo info : resolvedActivityList) {
Intent serviceIntent = new Intent();
serviceIntent.setAction(ACTION_CUSTOM_TABS_CONNECTION);
serviceIntent.setAction(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
serviceIntent.setPackage(info.activityInfo.packageName);
if (pm.resolveService(serviceIntent, 0) != null) {
packagesSupportingCustomTabs.add(info.activityInfo.packageName);

View File

@ -4,13 +4,13 @@ public class InAppBrowserOptions extends Options {
public static final String LOG_TAG = "InAppBrowserOptions";
public boolean hidden = false;
public boolean toolbarTop = true;
public Boolean hidden = false;
public Boolean toolbarTop = true;
public String toolbarTopBackgroundColor = "";
public String toolbarTopFixedTitle = "";
public boolean hideUrlBar = false;
public Boolean hideUrlBar = false;
public boolean hideTitleBar = false;
public boolean closeOnCannotGoBack = true;
public boolean progressBar = true;
public Boolean hideTitleBar = false;
public Boolean closeOnCannotGoBack = true;
public Boolean progressBar = true;
}

View File

@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

View File

@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

View File

@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

View File

@ -12,8 +12,8 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser {
}
@override
void onLoaded() {
print("ChromeSafari browser loaded");
void onCompletedInitialLoad() {
print("ChromeSafari browser initial load completed");
}
@override
@ -52,7 +52,7 @@ class _ChromeSafariBrowserExampleScreenState
await widget.browser.open(
url: "https://flutter.dev/",
options: ChromeSafariBrowserClassOptions(
android: AndroidChromeCustomTabsOptions(addShareButton: false),
android: AndroidChromeCustomTabsOptions(addDefaultShareMenuItem: false, keepAliveEnabled: true),
ios: IOSSafariOptions(barCollapsingEnabled: true)));
},
child: Text("Open Chrome Safari Browser")),

View File

@ -71,29 +71,6 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
setState(() {
this.url = url;
});
/*var origins = await WebStorageManager.instance().android.getOrigins();
for (var origin in origins) {
print(origin);
print(await WebStorageManager.instance().android.getQuotaForOrigin(origin: origin.origin));
print(await WebStorageManager.instance().android.getUsageForOrigin(origin: origin.origin));
}
await WebStorageManager.instance().android.deleteAllData();
print("\n\nDELETED\n\n");
origins = await WebStorageManager.instance().android.getOrigins();
for (var origin in origins) {
print(origin);
await WebStorageManager.instance().android.deleteOrigin(origin: origin.origin);
}*/
/*var records = await WebStorageManager.instance().ios.fetchDataRecords(dataTypes: IOSWKWebsiteDataType.ALL);
for(var record in records) {
print(record);
}
await WebStorageManager.instance().ios.removeDataModifiedSince(dataTypes: IOSWKWebsiteDataType.ALL, date: DateTime(0));
print("\n\nDELETED\n\n");
records = await WebStorageManager.instance().ios.fetchDataRecords(dataTypes: IOSWKWebsiteDataType.ALL);
for(var record in records) {
print(record);
}*/
},
onProgressChanged: (InAppWebViewController controller, int progress) {
setState(() {

View File

@ -1036,8 +1036,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
dataDetectorTypes = WKDataDetectorTypes(rawValue: dataDetectorTypes.rawValue | dataDetectorType.rawValue)
}
configuration.dataDetectorTypes = dataDetectorTypes
} else {
// Fallback on earlier versions
}
if #available(iOS 13.0, *) {
@ -1046,8 +1044,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
configuration.defaultWebpagePreferences.preferredContentMode = WKWebpagePreferences.ContentMode(rawValue: (options?.preferredContentMode)!)!
}
scrollView.automaticallyAdjustsScrollIndicatorInsets = (options?.automaticallyAdjustsScrollIndicatorInsets)!
} else {
// Fallback on earlier versions
}
scrollView.showsVerticalScrollIndicator = (options?.verticalScrollBarEnabled)!
@ -1110,8 +1106,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
configuration.setURLSchemeHandler(CustomeSchemeHandler(), forURLScheme: scheme)
}
}
} else {
// Fallback on earlier versions
}
return configuration
@ -1335,12 +1329,8 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
}
configuration.dataDetectorTypes = dataDetectorTypes
}
} else {
// Fallback on earlier versions
}
scrollView
if #available(iOS 13.0, *) {
if newOptionsMap["isFraudulentWebsiteWarningEnabled"] != nil && options?.isFraudulentWebsiteWarningEnabled != newOptions.isFraudulentWebsiteWarningEnabled {
configuration.preferences.isFraudulentWebsiteWarningEnabled = newOptions.isFraudulentWebsiteWarningEnabled
@ -1351,8 +1341,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
if newOptionsMap["automaticallyAdjustsScrollIndicatorInsets"] != nil && options?.automaticallyAdjustsScrollIndicatorInsets != newOptions.automaticallyAdjustsScrollIndicatorInsets {
scrollView.automaticallyAdjustsScrollIndicatorInsets = newOptions.automaticallyAdjustsScrollIndicatorInsets
}
} else {
// Fallback on earlier versions
}
if newOptionsMap["verticalScrollBarEnabled"] != nil && options?.verticalScrollBarEnabled != newOptions.verticalScrollBarEnabled {

View File

@ -59,13 +59,32 @@ class SafariViewController: SFSafariViewController, SFSafariViewControllerDelega
func safariViewController(_ controller: SFSafariViewController,
didCompleteInitialLoad didLoadSuccessfully: Bool) {
if didLoadSuccessfully {
statusDelegate?.onChromeSafariBrowserLoaded(uuid: self.uuid)
statusDelegate?.onChromeSafariBrowserCompletedInitialLoad(uuid: self.uuid)
}
else {
print("Cant load successfully the 'SafariViewController'.")
}
}
func safariViewController(_ controller: SFSafariViewController, activityItemsFor URL: URL, title: String?) -> [UIActivity] {
// print("activityItemsFor")
// print(URL)
// print(title)
return []
}
func safariViewController(_ controller: SFSafariViewController, excludedActivityTypesFor URL: URL, title: String?) -> [UIActivity.ActivityType] {
// print("excludedActivityTypesFor")
// print(URL)
// print(title)
return []
}
func safariViewController(_ controller: SFSafariViewController, initialLoadDidRedirectTo URL: URL) {
// print("initialLoadDidRedirectTo")
// print(URL)
}
// Helper function to convert hex color string to UIColor
// Assumes input like "#00FF00" (#RRGGBB).
// Taken from https://stackoverflow.com/questions/1560081/how-can-i-create-a-uicolor-from-a-hex-string

View File

@ -432,11 +432,10 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
safari.safariOptions = safariOptions
self.safariViewControllers[uuid] = safari
tmpController.present(self.safariViewControllers[uuid]! as! SFSafariViewController, animated: true)
onChromeSafariBrowserOpened(uuid: uuid)
result(true)
tmpController.present(self.safariViewControllers[uuid]! as! SFSafariViewController, animated: true) {
self.onChromeSafariBrowserOpened(uuid: uuid)
result(true)
}
return
}
else {
@ -742,9 +741,9 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
}
}
public func onChromeSafariBrowserLoaded(uuid: String) {
public func onChromeSafariBrowserCompletedInitialLoad(uuid: String) {
if self.safariViewControllers[uuid] != nil {
self.channel!.invokeMethod("onChromeSafariBrowserLoaded", arguments: ["uuid": uuid])
self.channel!.invokeMethod("onChromeSafariBrowserCompletedInitialLoad", arguments: ["uuid": uuid])
}
}

View File

@ -1,30 +0,0 @@
//
// TestWebView.swift
// flutter_inappwebview
//
// Created by Lorenzo Pichilli on 14/12/2019.
//
import Flutter
import Foundation
import WebKit
public class TestWebView: WKWebView {
override init(frame: CGRect, configuration: WKWebViewConfiguration) {
super.init(frame: frame, configuration: configuration)
}
required public init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)!
}
public override func removeFromSuperview() {
configuration.userContentController.removeAllUserScripts()
super.removeFromSuperview()
print("\n\n DISPOSE \n\n")
}
deinit {
print("dealloc") // never called
}
}

View File

@ -32,8 +32,8 @@ class ChromeSafariBrowser {
case "onChromeSafariBrowserOpened":
onOpened();
break;
case "onChromeSafariBrowserLoaded":
onLoaded();
case "onChromeSafariBrowserCompletedInitialLoad":
onCompletedInitialLoad();
break;
case "onChromeSafariBrowserClosed":
onClosed();
@ -109,8 +109,8 @@ class ChromeSafariBrowser {
///Event fires when the [ChromeSafariBrowser] is opened.
void onOpened() {}
///Event fires when the [ChromeSafariBrowser] is loaded.
void onLoaded() {}
///Event fires when the initial URL load is complete.
void onCompletedInitialLoad() {}
///Event fires when the [ChromeSafariBrowser] is closed.
void onClosed() {}

View File

@ -723,13 +723,13 @@ class Favicon {
}
}
///AndroidInAppWebViewCacheMode class represents an Android-specific class used to override the way the cache is used.
class AndroidInAppWebViewCacheMode {
///AndroidCacheMode class represents an Android-specific class used to override the way the cache is used.
class AndroidCacheMode {
final int _value;
const AndroidInAppWebViewCacheMode._internal(this._value);
static AndroidInAppWebViewCacheMode fromValue(int value) {
const AndroidCacheMode._internal(this._value);
static AndroidCacheMode fromValue(int value) {
if (value != null && value >= 0 && value <= 3)
return AndroidInAppWebViewCacheMode._internal(value);
return AndroidCacheMode._internal(value);
return null;
}
@ -751,18 +751,18 @@ class AndroidInAppWebViewCacheMode {
///Default cache usage mode. If the navigation type doesn't impose any specific behavior,
///use cached resources when they are available and not expired, otherwise load resources from the network.
static const LOAD_DEFAULT = const AndroidInAppWebViewCacheMode._internal(-1);
static const LOAD_DEFAULT = const AndroidCacheMode._internal(-1);
///Use cached resources when they are available, even if they have expired. Otherwise load resources from the network.
static const LOAD_CACHE_ELSE_NETWORK =
const AndroidInAppWebViewCacheMode._internal(1);
const AndroidCacheMode._internal(1);
///Don't use the cache, load from the network.
static const LOAD_NO_CACHE = const AndroidInAppWebViewCacheMode._internal(2);
static const LOAD_NO_CACHE = const AndroidCacheMode._internal(2);
///Don't use the network, load from the cache.
static const LOAD_CACHE_ONLY =
const AndroidInAppWebViewCacheMode._internal(3);
const AndroidCacheMode._internal(3);
bool operator ==(value) => value == _value;
@ -770,15 +770,15 @@ class AndroidInAppWebViewCacheMode {
int get hashCode => _value.hashCode;
}
///AndroidInAppWebViewModeMenuItem class represents an Android-specific class used to disable the action mode menu items.
///AndroidActionModeMenuItem class represents an Android-specific class used to disable the action mode menu items.
///
///**NOTE**: available on Android 24+.
class AndroidInAppWebViewModeMenuItem {
class AndroidActionModeMenuItem {
final int _value;
const AndroidInAppWebViewModeMenuItem._internal(this._value);
static AndroidInAppWebViewModeMenuItem fromValue(int value) {
const AndroidActionModeMenuItem._internal(this._value);
static AndroidActionModeMenuItem fromValue(int value) {
if (value != null && value != 3 && value >= 0 && value <= 4)
return AndroidInAppWebViewModeMenuItem._internal(value);
return AndroidActionModeMenuItem._internal(value);
return null;
}
@ -800,19 +800,19 @@ class AndroidInAppWebViewModeMenuItem {
///No menu items should be disabled.
static const MENU_ITEM_NONE =
const AndroidInAppWebViewModeMenuItem._internal(0);
const AndroidActionModeMenuItem._internal(0);
///Disable menu item "Share".
static const MENU_ITEM_SHARE =
const AndroidInAppWebViewModeMenuItem._internal(1);
const AndroidActionModeMenuItem._internal(1);
///Disable menu item "Web Search".
static const MENU_ITEM_WEB_SEARCH =
const AndroidInAppWebViewModeMenuItem._internal(2);
const AndroidActionModeMenuItem._internal(2);
///Disable all the action mode menu items for text processing.
static const MENU_ITEM_PROCESS_TEXT =
const AndroidInAppWebViewModeMenuItem._internal(4);
const AndroidActionModeMenuItem._internal(4);
bool operator ==(value) => value == _value;
@ -820,15 +820,15 @@ class AndroidInAppWebViewModeMenuItem {
int get hashCode => _value.hashCode;
}
///AndroidInAppWebViewForceDark class represents an Android-specific class used to indicate the force dark mode.
///AndroidForceDark class represents an Android-specific class used to indicate the force dark mode.
///
///**NOTE**: available on Android 29+.
class AndroidInAppWebViewForceDark {
class AndroidForceDark {
final int _value;
const AndroidInAppWebViewForceDark._internal(this._value);
static AndroidInAppWebViewForceDark fromValue(int value) {
const AndroidForceDark._internal(this._value);
static AndroidForceDark fromValue(int value) {
if (value != null && value >= 0 && value <= 2)
return AndroidInAppWebViewForceDark._internal(value);
return AndroidForceDark._internal(value);
return null;
}
@ -848,14 +848,14 @@ class AndroidInAppWebViewForceDark {
///Disable force dark, irrespective of the force dark mode of the WebView parent.
///In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened.
static const FORCE_DARK_OFF = const AndroidInAppWebViewForceDark._internal(0);
static const FORCE_DARK_OFF = const AndroidForceDark._internal(0);
///Enable force dark dependent on the state of the WebView parent view.
static const FORCE_DARK_AUTO =
const AndroidInAppWebViewForceDark._internal(1);
const AndroidForceDark._internal(1);
///Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.
static const FORCE_DARK_ON = const AndroidInAppWebViewForceDark._internal(2);
static const FORCE_DARK_ON = const AndroidForceDark._internal(2);
bool operator ==(value) => value == _value;
@ -863,13 +863,13 @@ class AndroidInAppWebViewForceDark {
int get hashCode => _value.hashCode;
}
///AndroidInAppWebViewLayoutAlgorithm class represents an Android-specific class used to set the underlying layout algorithm.
class AndroidInAppWebViewLayoutAlgorithm {
///AndroidLayoutAlgorithm class represents an Android-specific class used to set the underlying layout algorithm.
class AndroidLayoutAlgorithm {
final String _value;
const AndroidInAppWebViewLayoutAlgorithm._internal(this._value);
static AndroidInAppWebViewLayoutAlgorithm fromValue(String value) {
const AndroidLayoutAlgorithm._internal(this._value);
static AndroidLayoutAlgorithm fromValue(String value) {
return (["NORMAL", "TEXT_AUTOSIZING"].contains(value))
? AndroidInAppWebViewLayoutAlgorithm._internal(value)
? AndroidLayoutAlgorithm._internal(value)
: null;
}
@ -879,14 +879,14 @@ class AndroidInAppWebViewLayoutAlgorithm {
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
static const NORMAL =
const AndroidInAppWebViewLayoutAlgorithm._internal("NORMAL");
const AndroidLayoutAlgorithm._internal("NORMAL");
///TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make the text readable when viewing a wide-viewport layout in the overview mode.
///It is recommended to enable zoom support [AndroidInAppWebViewOptions.supportZoom] when using this mode.
///
///**NOTE**: available on Android 19+.
static const TEXT_AUTOSIZING =
const AndroidInAppWebViewLayoutAlgorithm._internal("TEXT_AUTOSIZING");
const AndroidLayoutAlgorithm._internal("TEXT_AUTOSIZING");
bool operator ==(value) => value == _value;
@ -894,15 +894,15 @@ class AndroidInAppWebViewLayoutAlgorithm {
int get hashCode => _value.hashCode;
}
///AndroidInAppWebViewMixedContentMode class represents an Android-specific class used to configure the WebView's behavior when a secure origin attempts to load a resource from an insecure origin.
///AndroidMixedContentMode class represents an Android-specific class used to configure the WebView's behavior when a secure origin attempts to load a resource from an insecure origin.
///
///**NOTE**: available on Android 21+.
class AndroidInAppWebViewMixedContentMode {
class AndroidMixedContentMode {
final int _value;
const AndroidInAppWebViewMixedContentMode._internal(this._value);
static AndroidInAppWebViewMixedContentMode fromValue(int value) {
const AndroidMixedContentMode._internal(this._value);
static AndroidMixedContentMode fromValue(int value) {
if (value != null && value >= 0 && value <= 2)
return AndroidInAppWebViewMixedContentMode._internal(value);
return AndroidMixedContentMode._internal(value);
return null;
}
@ -923,20 +923,20 @@ class AndroidInAppWebViewMixedContentMode {
///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 AndroidInAppWebViewMixedContentMode._internal(0);
const AndroidMixedContentMode._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 AndroidInAppWebViewMixedContentMode._internal(1);
const AndroidMixedContentMode._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.
///The types of content are allowed or blocked may change release to release and are not explicitly defined.
///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 [AndroidInAppWebViewMixedContentMode.MIXED_CONTENT_NEVER_ALLOW].
///For highest security, apps are recommended to use [AndroidMixedContentMode.MIXED_CONTENT_NEVER_ALLOW].
static const MIXED_CONTENT_COMPATIBILITY_MODE =
const AndroidInAppWebViewMixedContentMode._internal(2);
const AndroidMixedContentMode._internal(2);
bool operator ==(value) => value == _value;
@ -944,13 +944,13 @@ class AndroidInAppWebViewMixedContentMode {
int get hashCode => _value.hashCode;
}
///IOSInAppWebViewSelectionGranularity class represents an iOS-specific class used to set the level of granularity with which the user can interactively select content in the web view.
class IOSInAppWebViewSelectionGranularity {
///IOSWKSelectionGranularity class represents an iOS-specific class used to set the level of granularity with which the user can interactively select content in the web view.
class IOSWKSelectionGranularity {
final int _value;
const IOSInAppWebViewSelectionGranularity._internal(this._value);
static IOSInAppWebViewSelectionGranularity fromValue(int value) {
const IOSWKSelectionGranularity._internal(this._value);
static IOSWKSelectionGranularity fromValue(int value) {
if (value != null && value >= 0 && value <= 1)
return IOSInAppWebViewSelectionGranularity._internal(value);
return IOSWKSelectionGranularity._internal(value);
return null;
}
@ -967,11 +967,11 @@ class IOSInAppWebViewSelectionGranularity {
}
///Selection granularity varies automatically based on the selection.
static const DYNAMIC = const IOSInAppWebViewSelectionGranularity._internal(0);
static const DYNAMIC = const IOSWKSelectionGranularity._internal(0);
///Selection endpoints can be placed at any character boundary.
static const CHARACTER =
const IOSInAppWebViewSelectionGranularity._internal(1);
const IOSWKSelectionGranularity._internal(1);
bool operator ==(value) => value == _value;
@ -979,13 +979,13 @@ class IOSInAppWebViewSelectionGranularity {
int get hashCode => _value.hashCode;
}
///IOSInAppWebViewDataDetectorTypes class represents an iOS-specific class used to specify a dataDetectoryTypes value that adds interactivity to web content that matches the value.
///IOSWKDataDetectorTypes class represents an iOS-specific class used to specify a dataDetectoryTypes value that adds interactivity to web content that matches the value.
///
///**NOTE**: available on iOS 10.0+.
class IOSInAppWebViewDataDetectorTypes {
class IOSWKDataDetectorTypes {
final String _value;
const IOSInAppWebViewDataDetectorTypes._internal(this._value);
static IOSInAppWebViewDataDetectorTypes fromValue(String value) {
const IOSWKDataDetectorTypes._internal(this._value);
static IOSWKDataDetectorTypes fromValue(String value) {
return ([
"NONE",
"PHONE_NUMBER",
@ -999,7 +999,7 @@ class IOSInAppWebViewDataDetectorTypes {
"SPOTLIGHT_SUGGESTION",
"ALL"
].contains(value))
? IOSInAppWebViewDataDetectorTypes._internal(value)
? IOSWKDataDetectorTypes._internal(value)
: null;
}
@ -1008,41 +1008,41 @@ class IOSInAppWebViewDataDetectorTypes {
String toString() => _value;
///No detection is performed.
static const NONE = const IOSInAppWebViewDataDetectorTypes._internal("NONE");
static const NONE = const IOSWKDataDetectorTypes._internal("NONE");
///Phone numbers are detected and turned into links.
static const PHONE_NUMBER =
const IOSInAppWebViewDataDetectorTypes._internal("PHONE_NUMBER");
const IOSWKDataDetectorTypes._internal("PHONE_NUMBER");
///URLs in text are detected and turned into links.
static const LINK = const IOSInAppWebViewDataDetectorTypes._internal("LINK");
static const LINK = const IOSWKDataDetectorTypes._internal("LINK");
///Addresses are detected and turned into links.
static const ADDRESS =
const IOSInAppWebViewDataDetectorTypes._internal("ADDRESS");
const IOSWKDataDetectorTypes._internal("ADDRESS");
///Dates and times that are in the future are detected and turned into links.
static const CALENDAR_EVENT =
const IOSInAppWebViewDataDetectorTypes._internal("CALENDAR_EVENT");
const IOSWKDataDetectorTypes._internal("CALENDAR_EVENT");
///Tracking numbers are detected and turned into links.
static const TRACKING_NUMBER =
const IOSInAppWebViewDataDetectorTypes._internal("TRACKING_NUMBER");
const IOSWKDataDetectorTypes._internal("TRACKING_NUMBER");
///Flight numbers are detected and turned into links.
static const FLIGHT_NUMBER =
const IOSInAppWebViewDataDetectorTypes._internal("FLIGHT_NUMBER");
const IOSWKDataDetectorTypes._internal("FLIGHT_NUMBER");
///Lookup suggestions are detected and turned into links.
static const LOOKUP_SUGGESTION =
const IOSInAppWebViewDataDetectorTypes._internal("LOOKUP_SUGGESTION");
const IOSWKDataDetectorTypes._internal("LOOKUP_SUGGESTION");
///Spotlight suggestions are detected and turned into links.
static const SPOTLIGHT_SUGGESTION =
const IOSInAppWebViewDataDetectorTypes._internal("SPOTLIGHT_SUGGESTION");
const IOSWKDataDetectorTypes._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 IOSInAppWebViewDataDetectorTypes._internal("ALL");
static const ALL = const IOSWKDataDetectorTypes._internal("ALL");
bool operator ==(value) => value == _value;
@ -1050,13 +1050,13 @@ class IOSInAppWebViewDataDetectorTypes {
int get hashCode => _value.hashCode;
}
///InAppWebViewUserPreferredContentMode class represents the content mode to prefer when loading and rendering a webpage.
class InAppWebViewUserPreferredContentMode {
///UserPreferredContentMode class represents the content mode to prefer when loading and rendering a webpage.
class UserPreferredContentMode {
final int _value;
const InAppWebViewUserPreferredContentMode._internal(this._value);
static InAppWebViewUserPreferredContentMode fromValue(int value) {
const UserPreferredContentMode._internal(this._value);
static UserPreferredContentMode fromValue(int value) {
if (value != null && value >= 0 && value <= 2)
return InAppWebViewUserPreferredContentMode._internal(value);
return UserPreferredContentMode._internal(value);
return null;
}
@ -1076,14 +1076,14 @@ class InAppWebViewUserPreferredContentMode {
///The recommended content mode for the current platform.
static const RECOMMENDED =
const InAppWebViewUserPreferredContentMode._internal(0);
const UserPreferredContentMode._internal(0);
///Represents content targeting mobile browsers.
static const MOBILE = const InAppWebViewUserPreferredContentMode._internal(1);
static const MOBILE = const UserPreferredContentMode._internal(1);
///Represents content targeting desktop browsers.
static const DESKTOP =
const InAppWebViewUserPreferredContentMode._internal(2);
const UserPreferredContentMode._internal(2);
bool operator ==(value) => value == _value;
@ -1091,13 +1091,13 @@ class InAppWebViewUserPreferredContentMode {
int get hashCode => _value.hashCode;
}
///IOSWebViewOptionsPresentationStyle class represents an iOS-specific class used to specify the modal presentation style when presenting a view controller.
class IOSWebViewOptionsPresentationStyle {
///IOSUIModalPresentationStyle class represents an iOS-specific class used to specify the modal presentation style when presenting a view controller.
class IOSUIModalPresentationStyle {
final int _value;
const IOSWebViewOptionsPresentationStyle._internal(this._value);
static IOSWebViewOptionsPresentationStyle fromValue(int value) {
const IOSUIModalPresentationStyle._internal(this._value);
static IOSUIModalPresentationStyle fromValue(int value) {
if (value != null && value >= 0 && value <= 9)
return IOSWebViewOptionsPresentationStyle._internal(value);
return IOSUIModalPresentationStyle._internal(value);
return null;
}
@ -1131,42 +1131,42 @@ class IOSWebViewOptionsPresentationStyle {
///A presentation style in which the presented view covers the screen.
static const FULL_SCREEN =
const IOSWebViewOptionsPresentationStyle._internal(0);
const IOSUIModalPresentationStyle._internal(0);
///A presentation style that partially covers the underlying content.
static const PAGE_SHEET =
const IOSWebViewOptionsPresentationStyle._internal(1);
const IOSUIModalPresentationStyle._internal(1);
///A presentation style that displays the content centered in the screen.
static const FORM_SHEET =
const IOSWebViewOptionsPresentationStyle._internal(2);
const IOSUIModalPresentationStyle._internal(2);
///A presentation style where the content is displayed over another view controllers content.
static const CURRENT_CONTEXT =
const IOSWebViewOptionsPresentationStyle._internal(3);
const IOSUIModalPresentationStyle._internal(3);
///A custom view presentation style that is managed by a custom presentation controller and one or more custom animator objects.
static const CUSTOM = const IOSWebViewOptionsPresentationStyle._internal(4);
static const CUSTOM = const IOSUIModalPresentationStyle._internal(4);
///A view presentation style in which the presented view covers the screen.
static const OVER_FULL_SCREEN =
const IOSWebViewOptionsPresentationStyle._internal(5);
const IOSUIModalPresentationStyle._internal(5);
///A presentation style where the content is displayed over another view controllers content.
static const OVER_CURRENT_CONTEXT =
const IOSWebViewOptionsPresentationStyle._internal(6);
const IOSUIModalPresentationStyle._internal(6);
///A presentation style where the content is displayed in a popover view.
static const POPOVER = const IOSWebViewOptionsPresentationStyle._internal(7);
static const POPOVER = const IOSUIModalPresentationStyle._internal(7);
///A presentation style that indicates no adaptations should be made.
static const NONE = const IOSWebViewOptionsPresentationStyle._internal(8);
static const NONE = const IOSUIModalPresentationStyle._internal(8);
///The default presentation style chosen by the system.
///
///**NOTE**: available on iOS 13.0+.
static const AUTOMATIC =
const IOSWebViewOptionsPresentationStyle._internal(9);
const IOSUIModalPresentationStyle._internal(9);
bool operator ==(value) => value == _value;
@ -1174,13 +1174,13 @@ class IOSWebViewOptionsPresentationStyle {
int get hashCode => _value.hashCode;
}
///IOSWebViewOptionsTransitionStyle class represents an iOS-specific class used to specify the transition style when presenting a view controller.
class IOSWebViewOptionsTransitionStyle {
///IOSUIModalTransitionStyle class represents an iOS-specific class used to specify the transition style when presenting a view controller.
class IOSUIModalTransitionStyle {
final int _value;
const IOSWebViewOptionsTransitionStyle._internal(this._value);
static IOSWebViewOptionsTransitionStyle fromValue(int value) {
const IOSUIModalTransitionStyle._internal(this._value);
static IOSUIModalTransitionStyle fromValue(int value) {
if (value != null && value >= 0 && value <= 3)
return IOSWebViewOptionsTransitionStyle._internal(value);
return IOSUIModalTransitionStyle._internal(value);
return null;
}
@ -1203,24 +1203,24 @@ class IOSWebViewOptionsTransitionStyle {
///When the view controller is presented, its view slides up from the bottom of the screen.
///On dismissal, the view slides back down. This is the default transition style.
static const COVER_VERTICAL =
const IOSWebViewOptionsTransitionStyle._internal(0);
const IOSUIModalTransitionStyle._internal(0);
///When the view controller is presented, the current view initiates a horizontal 3D flip from right-to-left,
///resulting in the revealing of the new view as if it were on the back of the previous view.
///On dismissal, the flip occurs from left-to-right, returning to the original view.
static const FLIP_HORIZONTAL =
const IOSWebViewOptionsTransitionStyle._internal(1);
const IOSUIModalTransitionStyle._internal(1);
///When the view controller is presented, the current view fades out while the new view fades in at the same time.
///On dismissal, a similar type of cross-fade is used to return to the original view.
static const CROSS_DISSOLVE =
const IOSWebViewOptionsTransitionStyle._internal(2);
const IOSUIModalTransitionStyle._internal(2);
///When the view controller is presented, one corner of the current view curls up to reveal the presented view underneath.
///On dismissal, the curled up page unfurls itself back on top of the presented view.
///A view controller presented using this transition is itself prevented from presenting any additional view controllers.
static const PARTIAL_CURL =
const IOSWebViewOptionsTransitionStyle._internal(3);
const IOSUIModalTransitionStyle._internal(3);
bool operator ==(value) => value == _value;
@ -1228,15 +1228,15 @@ class IOSWebViewOptionsTransitionStyle {
int get hashCode => _value.hashCode;
}
///IOSSafariOptionsDismissButtonStyle class represents an iOS-specific class used to set the custom style for the dismiss button.
///IOSSafariDismissButtonStyle class represents an iOS-specific class used to set the custom style for the dismiss button.
///
///**NOTE**: available on iOS 11.0+.
class IOSSafariOptionsDismissButtonStyle {
class IOSSafariDismissButtonStyle {
final int _value;
const IOSSafariOptionsDismissButtonStyle._internal(this._value);
static IOSSafariOptionsDismissButtonStyle fromValue(int value) {
const IOSSafariDismissButtonStyle._internal(this._value);
static IOSSafariDismissButtonStyle fromValue(int value) {
if (value != null && value >= 0 && value <= 2)
return IOSSafariOptionsDismissButtonStyle._internal(value);
return IOSSafariDismissButtonStyle._internal(value);
return null;
}
@ -1255,13 +1255,13 @@ class IOSSafariOptionsDismissButtonStyle {
}
///Makes the button title the localized string "Done".
static const DONE = const IOSSafariOptionsDismissButtonStyle._internal(0);
static const DONE = const IOSSafariDismissButtonStyle._internal(0);
///Makes the button title the localized string "Close".
static const CLOSE = const IOSSafariOptionsDismissButtonStyle._internal(1);
static const CLOSE = const IOSSafariDismissButtonStyle._internal(1);
///Makes the button title the localized string "Cancel".
static const CANCEL = const IOSSafariOptionsDismissButtonStyle._internal(2);
static const CANCEL = const IOSSafariDismissButtonStyle._internal(2);
bool operator ==(value) => value == _value;

View File

@ -98,10 +98,10 @@ class InAppWebViewOptions
///**NOTE**: available on iOS 11.0+.
List<ContentBlocker> contentBlockers;
///Sets the content mode that the WebView needs to use when loading and rendering a webpage. The default value is [InAppWebViewUserPreferredContentMode.RECOMMENDED].
///Sets the content mode that the WebView needs to use when loading and rendering a webpage. The default value is [UserPreferredContentMode.RECOMMENDED].
///
///**NOTE**: available on iOS 13.0+.
InAppWebViewUserPreferredContentMode preferredContentMode;
UserPreferredContentMode preferredContentMode;
///Set to `true` to be able to listen at the [shouldInterceptAjaxRequest] event. The default value is `false`.
bool useShouldInterceptAjaxRequest;
@ -145,7 +145,7 @@ class InAppWebViewOptions
this.resourceCustomSchemes = const [],
this.contentBlockers = const [],
this.preferredContentMode =
InAppWebViewUserPreferredContentMode.RECOMMENDED,
UserPreferredContentMode.RECOMMENDED,
this.useShouldInterceptAjaxRequest = false,
this.useShouldInterceptFetchRequest = false,
this.incognito = false,
@ -223,7 +223,7 @@ class InAppWebViewOptions
List<String>.from(map["resourceCustomSchemes"] ?? []);
options.contentBlockers = contentBlockers;
options.preferredContentMode =
InAppWebViewUserPreferredContentMode.fromValue(
UserPreferredContentMode.fromValue(
map["preferredContentMode"]);
options.useShouldInterceptAjaxRequest =
map["useShouldInterceptAjaxRequest"];
@ -277,7 +277,7 @@ class AndroidInAppWebViewOptions
///Configures the WebView's behavior when a secure origin attempts to load a resource from an insecure origin.
///
///**NOTE**: available on Android 21+.
AndroidInAppWebViewMixedContentMode mixedContentMode;
AndroidMixedContentMode mixedContentMode;
///Enables or disables content URL access within WebView. Content URL access allows WebView to load content from a content provider installed in the system. The default value is `true`.
bool allowContentAccess;
@ -307,8 +307,8 @@ class AndroidInAppWebViewOptions
bool blockNetworkLoads;
///Overrides the way the cache is used. The way the cache is used is based on the navigation type. For a normal page load, the cache is checked and content is re-validated as needed.
///When navigating back, content is not revalidated, instead the content is just retrieved from the cache. The default value is [AndroidInAppWebViewCacheMode.LOAD_DEFAULT].
AndroidInAppWebViewCacheMode cacheMode;
///When navigating back, content is not revalidated, instead the content is just retrieved from the cache. The default value is [AndroidCacheMode.LOAD_DEFAULT].
AndroidCacheMode cacheMode;
///Sets the cursive font family name. The default value is `"cursive"`.
String cursiveFontFamily;
@ -325,7 +325,7 @@ class AndroidInAppWebViewOptions
///Disables the action mode menu items according to menuItems flag.
///
///**NOTE**: available on Android 24+.
AndroidInAppWebViewModeMenuItem disabledActionModeMenuItems;
AndroidActionModeMenuItem disabledActionModeMenuItems;
///Sets the fantasy font family name. The default value is `"fantasy"`.
String fantasyFontFamily;
@ -333,16 +333,16 @@ class AndroidInAppWebViewOptions
///Sets the fixed font family name. The default value is `"monospace"`.
String fixedFontFamily;
///Set the force dark mode for this WebView. The default value is [AndroidInAppWebViewForceDark.FORCE_DARK_OFF].
///Set the force dark mode for this WebView. The default value is [AndroidForceDark.FORCE_DARK_OFF].
///
///**NOTE**: available on Android 29+.
AndroidInAppWebViewForceDark forceDark;
AndroidForceDark forceDark;
///Sets whether Geolocation API is enabled. The default value is `true`.
bool geolocationEnabled;
///Sets the underlying layout algorithm. This will cause a re-layout of the WebView.
AndroidInAppWebViewLayoutAlgorithm layoutAlgorithm;
AndroidLayoutAlgorithm layoutAlgorithm;
///Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on screen by width.
///This setting is taken into account when the content width is greater than the width of the WebView control, for example, when [useWideViewPort] is enabled.
@ -426,7 +426,7 @@ class AndroidInAppWebViewOptions
this.appCachePath,
this.blockNetworkImage = false,
this.blockNetworkLoads = false,
this.cacheMode = AndroidInAppWebViewCacheMode.LOAD_DEFAULT,
this.cacheMode = AndroidCacheMode.LOAD_DEFAULT,
this.cursiveFontFamily = "cursive",
this.defaultFixedFontSize = 16,
this.defaultFontSize = 16,
@ -434,7 +434,7 @@ class AndroidInAppWebViewOptions
this.disabledActionModeMenuItems,
this.fantasyFontFamily = "fantasy",
this.fixedFontFamily = "monospace",
this.forceDark = AndroidInAppWebViewForceDark.FORCE_DARK_OFF,
this.forceDark = AndroidForceDark.FORCE_DARK_OFF,
this.geolocationEnabled = true,
this.layoutAlgorithm,
this.loadWithOverviewMode = true,
@ -512,7 +512,7 @@ class AndroidInAppWebViewOptions
options.useWideViewPort = map["useWideViewPort"];
options.safeBrowsingEnabled = map["safeBrowsingEnabled"];
options.mixedContentMode =
AndroidInAppWebViewMixedContentMode.fromValue(map["mixedContentMode"]);
AndroidMixedContentMode.fromValue(map["mixedContentMode"]);
options.allowContentAccess = map["allowContentAccess"];
options.allowFileAccess = map["allowFileAccess"];
options.allowFileAccessFromFileURLs = map["allowFileAccessFromFileURLs"];
@ -522,21 +522,21 @@ class AndroidInAppWebViewOptions
options.blockNetworkImage = map["blockNetworkImage"];
options.blockNetworkLoads = map["blockNetworkLoads"];
options.cacheMode =
AndroidInAppWebViewCacheMode.fromValue(map["cacheMode"]);
AndroidCacheMode.fromValue(map["cacheMode"]);
options.cursiveFontFamily = map["cursiveFontFamily"];
options.defaultFixedFontSize = map["defaultFixedFontSize"];
options.defaultFontSize = map["defaultFontSize"];
options.defaultTextEncodingName = map["defaultTextEncodingName"];
options.disabledActionModeMenuItems =
AndroidInAppWebViewModeMenuItem.fromValue(
AndroidActionModeMenuItem.fromValue(
map["disabledActionModeMenuItems"]);
options.fantasyFontFamily = map["fantasyFontFamily"];
options.fixedFontFamily = map["fixedFontFamily"];
options.forceDark =
AndroidInAppWebViewForceDark.fromValue(map["forceDark"]);
AndroidForceDark.fromValue(map["forceDark"]);
options.geolocationEnabled = map["geolocationEnabled"];
options.layoutAlgorithm =
AndroidInAppWebViewLayoutAlgorithm.fromValue(map["layoutAlgorithm"]);
AndroidLayoutAlgorithm.fromValue(map["layoutAlgorithm"]);
options.loadWithOverviewMode = map["loadWithOverviewMode"];
options.loadsImagesAutomatically = map["loadsImagesAutomatically"];
options.minimumLogicalFontSize = map["minimumLogicalFontSize"];
@ -599,15 +599,15 @@ class IOSInAppWebViewOptions
bool isFraudulentWebsiteWarningEnabled;
///The level of granularity with which the user can interactively select content in the web view.
///The default value is [IOSInAppWebViewSelectionGranularity.DYNAMIC]
IOSInAppWebViewSelectionGranularity selectionGranularity;
///The default value is [IOSWKSelectionGranularity.DYNAMIC]
IOSWKSelectionGranularity selectionGranularity;
///Specifying a dataDetectoryTypes value adds interactivity to web content that matches the value.
///For example, Safari adds a link to apple.com in the text Visit apple.com if the dataDetectorTypes property is set to [IOSInAppWebViewDataDetectorTypes.LINK].
///The default value is [IOSInAppWebViewDataDetectorTypes.NONE].
///For example, Safari adds a link to apple.com in the text Visit apple.com if the dataDetectorTypes property is set to [IOSWKDataDetectorTypes.LINK].
///The default value is [IOSWKDataDetectorTypes.NONE].
///
///**NOTE**: available on iOS 10.0+.
List<IOSInAppWebViewDataDetectorTypes> dataDetectorTypes;
List<IOSWKDataDetectorTypes> dataDetectorTypes;
///Set `true` if shared cookies from `HTTPCookieStorage.shared` should used for every load request in the WebView.
///The default value is `false`.
@ -632,8 +632,8 @@ class IOSInAppWebViewOptions
this.allowsInlineMediaPlayback = false,
this.allowsPictureInPictureMediaPlayback = true,
this.isFraudulentWebsiteWarningEnabled = true,
this.selectionGranularity = IOSInAppWebViewSelectionGranularity.DYNAMIC,
this.dataDetectorTypes = const [IOSInAppWebViewDataDetectorTypes.NONE],
this.selectionGranularity = IOSWKSelectionGranularity.DYNAMIC,
this.dataDetectorTypes = const [IOSWKDataDetectorTypes.NONE],
this.sharedCookiesEnabled = false,
this.automaticallyAdjustsScrollIndicatorInsets = false});
@ -665,12 +665,12 @@ class IOSInAppWebViewOptions
}
static IOSInAppWebViewOptions fromMap(Map<String, dynamic> map) {
List<IOSInAppWebViewDataDetectorTypes> dataDetectorTypes = [];
List<IOSWKDataDetectorTypes> dataDetectorTypes = [];
List<String> dataDetectorTypesList =
List<String>.from(map["dataDetectorTypes"] ?? []);
dataDetectorTypesList.forEach((dataDetectorType) {
dataDetectorTypes
.add(IOSInAppWebViewDataDetectorTypes.fromValue(dataDetectorType));
.add(IOSWKDataDetectorTypes.fromValue(dataDetectorType));
});
IOSInAppWebViewOptions options = new IOSInAppWebViewOptions();
@ -690,7 +690,7 @@ class IOSInAppWebViewOptions
options.isFraudulentWebsiteWarningEnabled =
map["isFraudulentWebsiteWarningEnabled"];
options.selectionGranularity =
IOSInAppWebViewSelectionGranularity.fromValue(
IOSWKSelectionGranularity.fromValue(
map["selectionGranularity"]);
options.dataDetectorTypes = dataDetectorTypes;
options.sharedCookiesEnabled = map["sharedCookiesEnabled"];
@ -798,11 +798,11 @@ class IOSInAppBrowserOptions implements BrowserOptions, IosOptions {
///Set the custom color for the close button.
String closeButtonColor;
///Set the custom modal presentation style when presenting the WebView. The default value is [IOSWebViewOptionsPresentationStyle.FULL_SCREEN].
IOSWebViewOptionsPresentationStyle presentationStyle;
///Set the custom modal presentation style when presenting the WebView. The default value is [IOSUIModalPresentationStyle.FULL_SCREEN].
IOSUIModalPresentationStyle presentationStyle;
///Set to the custom transition style when presenting the WebView. The default value is [IOSWebViewOptionsTransitionStyle.COVER_VERTICAL].
IOSWebViewOptionsTransitionStyle transitionStyle;
///Set to the custom transition style when presenting the WebView. The default value is [IOSUIModalTransitionStyle.COVER_VERTICAL].
IOSUIModalTransitionStyle transitionStyle;
///Set to `false` to hide the spinner when the WebView is loading a page. The default value is `true`.
bool spinner;
@ -813,8 +813,8 @@ class IOSInAppBrowserOptions implements BrowserOptions, IosOptions {
this.toolbarBottomTranslucent = true,
this.closeButtonCaption = "",
this.closeButtonColor = "",
this.presentationStyle = IOSWebViewOptionsPresentationStyle.FULL_SCREEN,
this.transitionStyle = IOSWebViewOptionsTransitionStyle.COVER_VERTICAL,
this.presentationStyle = IOSUIModalPresentationStyle.FULL_SCREEN,
this.transitionStyle = IOSUIModalTransitionStyle.COVER_VERTICAL,
this.spinner = true});
@override
@ -839,9 +839,9 @@ class IOSInAppBrowserOptions implements BrowserOptions, IosOptions {
options.closeButtonCaption = map["closeButtonCaption"];
options.closeButtonColor = map["closeButtonColor"];
options.presentationStyle =
IOSWebViewOptionsPresentationStyle.fromValue(map["presentationStyle"]);
IOSUIModalPresentationStyle.fromValue(map["presentationStyle"]);
options.transitionStyle =
IOSWebViewOptionsTransitionStyle.fromValue(map["transitionStyle"]);
IOSUIModalTransitionStyle.fromValue(map["transitionStyle"]);
options.spinner = map["spinner"];
return options;
}
@ -850,8 +850,8 @@ class IOSInAppBrowserOptions implements BrowserOptions, IosOptions {
///This class represents all the Android-only [ChromeSafariBrowser] options available.
class AndroidChromeCustomTabsOptions
implements ChromeSafariBrowserOptions, AndroidOptions {
///Set to `false` if you don't want the default share button. The default value is `true`.
bool addShareButton;
///Set to `false` if you don't want the default share item to the menu. The default value is `true`.
bool addDefaultShareMenuItem;
///Set to `false` if the title shouldn't be shown in the custom tab. The default value is `true`.
bool showTitle;
@ -865,32 +865,48 @@ class AndroidChromeCustomTabsOptions
///Set to `true` to enable Instant Apps. The default value is `false`.
bool instantAppsEnabled;
///Set an explicit application package name that limits
///the components this Intent will resolve to. If left to the default
///value of null, all components in all applications will considered.
///If non-null, the Intent can only match the components in the given
///application package.
String packageName;
///Set to `true` to enable Keep Alive. The default value is `false`.
bool keepAliveEnabled;
AndroidChromeCustomTabsOptions(
{this.addShareButton = true,
{this.addDefaultShareMenuItem = true,
this.showTitle = true,
this.toolbarBackgroundColor = "",
this.enableUrlBarHiding = false,
this.instantAppsEnabled = false});
this.instantAppsEnabled = false,
this.packageName,
this.keepAliveEnabled = false});
@override
Map<String, dynamic> toMap() {
return {
"addShareButton": addShareButton,
"addDefaultShareMenuItem": addDefaultShareMenuItem,
"showTitle": showTitle,
"toolbarBackgroundColor": toolbarBackgroundColor,
"enableUrlBarHiding": enableUrlBarHiding,
"instantAppsEnabled": instantAppsEnabled
"instantAppsEnabled": instantAppsEnabled,
"packageName": packageName,
"keepAliveEnabled": keepAliveEnabled
};
}
static AndroidChromeCustomTabsOptions fromMap(Map<String, dynamic> map) {
AndroidChromeCustomTabsOptions options =
new AndroidChromeCustomTabsOptions();
options.addShareButton = map["addShareButton"];
options.addDefaultShareMenuItem = map["addDefaultShareMenuItem"];
options.showTitle = map["showTitle"];
options.toolbarBackgroundColor = map["toolbarBackgroundColor"];
options.enableUrlBarHiding = map["enableUrlBarHiding"];
options.instantAppsEnabled = map["instantAppsEnabled"];
options.packageName = map["packageName"];
options.keepAliveEnabled = map["keepAliveEnabled"];
return options;
}
}
@ -903,10 +919,10 @@ class IOSSafariOptions implements ChromeSafariBrowserOptions, IosOptions {
///Set to `true` to enable bar collapsing. The default value is `false`.
bool barCollapsingEnabled;
///Set the custom style for the dismiss button. The default value is [IOSSafariOptionsDismissButtonStyle.DONE].
///Set the custom style for the dismiss button. The default value is [IOSSafariDismissButtonStyle.DONE].
///
///**NOTE**: available on iOS 11.0+.
IOSSafariOptionsDismissButtonStyle dismissButtonStyle;
IOSSafariDismissButtonStyle dismissButtonStyle;
///Set the custom background color of the navigation bar and the toolbar.
///
@ -918,20 +934,20 @@ class IOSSafariOptions implements ChromeSafariBrowserOptions, IosOptions {
///**NOTE**: available on iOS 10.0+.
String preferredControlTintColor;
///Set the custom modal presentation style when presenting the WebView. The default value is [IOSWebViewOptionsPresentationStyle.FULL_SCREEN].
IOSWebViewOptionsPresentationStyle presentationStyle;
///Set the custom modal presentation style when presenting the WebView. The default value is [IOSUIModalPresentationStyle.FULL_SCREEN].
IOSUIModalPresentationStyle presentationStyle;
///Set to the custom transition style when presenting the WebView. The default value is [IOSWebViewOptionsTransitionStyle.COVER_VERTICAL].
IOSWebViewOptionsTransitionStyle transitionStyle;
///Set to the custom transition style when presenting the WebView. The default value is [IOSUIModalTransitionStyle.COVER_VERTICAL].
IOSUIModalTransitionStyle transitionStyle;
IOSSafariOptions(
{this.entersReaderIfAvailable = false,
this.barCollapsingEnabled = false,
this.dismissButtonStyle = IOSSafariOptionsDismissButtonStyle.DONE,
this.dismissButtonStyle = IOSSafariDismissButtonStyle.DONE,
this.preferredBarTintColor = "",
this.preferredControlTintColor = "",
this.presentationStyle = IOSWebViewOptionsPresentationStyle.FULL_SCREEN,
this.transitionStyle = IOSWebViewOptionsTransitionStyle.COVER_VERTICAL});
this.presentationStyle = IOSUIModalPresentationStyle.FULL_SCREEN,
this.transitionStyle = IOSUIModalTransitionStyle.COVER_VERTICAL});
@override
Map<String, dynamic> toMap() {
@ -951,13 +967,13 @@ class IOSSafariOptions implements ChromeSafariBrowserOptions, IosOptions {
options.entersReaderIfAvailable = map["entersReaderIfAvailable"];
options.barCollapsingEnabled = map["barCollapsingEnabled"];
options.dismissButtonStyle =
IOSSafariOptionsDismissButtonStyle.fromValue(map["dismissButtonStyle"]);
IOSSafariDismissButtonStyle.fromValue(map["dismissButtonStyle"]);
options.preferredBarTintColor = map["preferredBarTintColor"];
options.preferredControlTintColor = map["preferredControlTintColor"];
options.presentationStyle =
IOSWebViewOptionsPresentationStyle.fromValue(map["presentationStyle"]);
IOSUIModalPresentationStyle.fromValue(map["presentationStyle"]);
options.transitionStyle =
IOSWebViewOptionsTransitionStyle.fromValue(map["transitionStyle"]);
IOSUIModalTransitionStyle.fromValue(map["transitionStyle"]);
return options;
}
}