Updated code docs, Using Android WebViewClientCompat for Chromium-based WebView if the WebView package major version is >= 73 (https://bugs.chromium.org/p/chromium/issues/detail?id=925887), fix #1422

This commit is contained in:
Lorenzo Pichilli 2022-12-03 15:58:12 +01:00
parent fc98712f30
commit 459875ff2e
161 changed files with 7290 additions and 6065 deletions

View File

@ -1,3 +1,9 @@
## 6.0.0-beta.20
- Using Android `WebViewClientCompat` for Chromium-based WebView if the WebView package major version is >= 73 (https://bugs.chromium.org/p/chromium/issues/detail?id=925887)
- Updated code docs
- Fixed "Unexpected addWebMessageListener behaviour" [#1422](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1422)
## 6.0.0-beta.19
- Updated code docs
@ -164,6 +170,10 @@
- Removed `URLProtectionSpace.iosIsProxy` property
- `historyUrl` and `baseUrl` of `InAppWebViewInitialData` can be `null`
## 5.7.2+2
- Fixed "Unexpected addWebMessageListener behaviour" [#1422](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1422)
## 5.7.2+1
- Fixed "Cannot Grant Permission at Android 21" [#1447](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1447)

View File

@ -1,5 +1,6 @@
package com.pichillilorenzo.flutter_inappwebview;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.os.Build;
@ -82,28 +83,15 @@ public class InAppWebViewStatic extends ChannelDelegateImpl {
result.success(false);
break;
case "getCurrentWebViewPackage":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && plugin != null && (plugin.activity != null || plugin.applicationContext != null)) {
Context context = plugin.activity;
Context context = null;
if (plugin != null) {
context = plugin.activity;
if (context == null) {
context = plugin.applicationContext;
}
result.success(convertWebViewPackageToMap(WebViewCompat.getCurrentWebViewPackage(context)));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//with Android Lollipop (API 21) they started to update the WebView
//as a separate APK with the PlayStore and they added the
//getLoadedPackageInfo() method to the WebViewFactory class and this
//should handle the Android 7.0 behaviour changes too
try {
Class webViewFactory = Class.forName("android.webkit.WebViewFactory");
Method method = webViewFactory.getMethod("getLoadedPackageInfo");
PackageInfo pInfo = (PackageInfo) method.invoke(null);
result.success(convertWebViewPackageToMap(pInfo));
} catch (Exception e) {
result.success(null);
}
} else {
result.success(null);
}
PackageInfo packageInfo = context != null ? WebViewCompat.getCurrentWebViewPackage(context) : null;
result.success(packageInfo != null ? convertWebViewPackageToMap(packageInfo) : null);
break;
case "setWebContentsDebuggingEnabled":
{
@ -135,10 +123,8 @@ public class InAppWebViewStatic extends ChannelDelegateImpl {
}
}
public Map<String, Object> convertWebViewPackageToMap(PackageInfo webViewPackageInfo) {
if (webViewPackageInfo == null) {
return null;
}
@NonNull
public Map<String, Object> convertWebViewPackageToMap(@NonNull PackageInfo webViewPackageInfo) {
HashMap<String, Object> webViewPackageInfoMap = new HashMap<>();
webViewPackageInfoMap.put("versionName", webViewPackageInfo.versionName);

View File

@ -2,9 +2,12 @@ package com.pichillilorenzo.flutter_inappwebview.types;
import android.os.Build;
import android.webkit.WebResourceError;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.webkit.WebResourceErrorCompat;
import androidx.webkit.WebViewFeature;
import java.util.HashMap;
import java.util.Map;
@ -24,6 +27,19 @@ public class WebResourceErrorExt {
return new WebResourceErrorExt(error.getErrorCode(), error.getDescription().toString());
}
@RequiresApi(Build.VERSION_CODES.M)
static public WebResourceErrorExt fromWebResourceError(@NonNull WebResourceErrorCompat error) {
int type = -1;
if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE)) {
type = error.getErrorCode();
}
String description = "";
if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION)) {
description = error.getDescription().toString();
}
return new WebResourceErrorExt(type, description);
}
public Map<String, Object> toMap() {
Map<String, Object> webResourceErrorMap = new HashMap<>();
webResourceErrorMap.put("type", getType());

View File

@ -146,6 +146,9 @@ public class FlutterWebView implements PlatformWebView {
if (webView.inAppWebViewChromeClient != null) {
webView.inAppWebViewChromeClient.dispose();
}
if (webView.inAppWebViewClientCompat != null) {
webView.inAppWebViewClientCompat.dispose();
}
if (webView.inAppWebViewClient != null) {
webView.inAppWebViewClient.dispose();
}

View File

@ -8,6 +8,7 @@ import android.animation.PropertyValuesHolder;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
@ -47,6 +48,7 @@ import android.webkit.WebBackForwardList;
import android.webkit.WebHistoryItem;
import android.webkit.WebSettings;
import android.webkit.WebStorage;
import android.webkit.WebViewClient;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -59,6 +61,7 @@ import androidx.webkit.WebViewCompat;
import androidx.webkit.WebViewFeature;
import com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin;
import com.pichillilorenzo.flutter_inappwebview.InAppWebViewStatic;
import com.pichillilorenzo.flutter_inappwebview.R;
import com.pichillilorenzo.flutter_inappwebview.Util;
import com.pichillilorenzo.flutter_inappwebview.content_blocker.ContentBlocker;
@ -124,6 +127,8 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
@Nullable
public InAppWebViewClient inAppWebViewClient;
@Nullable
public InAppWebViewClientCompat inAppWebViewClientCompat;
@Nullable
public InAppWebViewChromeClient inAppWebViewChromeClient;
@Nullable
public InAppWebViewRenderProcessClient inAppWebViewRenderProcessClient;
@ -199,6 +204,36 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
}
}
public WebViewClient createWebViewClient(InAppBrowserDelegate inAppBrowserDelegate) {
// bug https://bugs.chromium.org/p/chromium/issues/detail?id=925887
PackageInfo packageInfo = WebViewCompat.getCurrentWebViewPackage(getContext());
if (packageInfo == null) {
Log.d(LOG_TAG, "Using InAppWebViewClient implementation");
return new InAppWebViewClient(inAppBrowserDelegate);
}
boolean isChromiumWebView = "com.android.webview".equals(packageInfo.packageName) ||
"com.google.android.webview".equals(packageInfo.packageName) ||
"com.android.chrome".equals(packageInfo.packageName);
boolean isChromiumWebViewBugFixed = false;
if (isChromiumWebView) {
String versionName = packageInfo.versionName != null ? packageInfo.versionName : "";
try {
int majorVersion = versionName.contains(".") ?
Integer.parseInt(versionName.split("\\.")[0]) : 0;
isChromiumWebViewBugFixed = majorVersion >= 73;
} catch (NumberFormatException ignored) {}
}
if (isChromiumWebViewBugFixed || !isChromiumWebView) {
Log.d(LOG_TAG, "Using InAppWebViewClientCompat implementation");
return new InAppWebViewClientCompat(inAppBrowserDelegate);
} else {
Log.d(LOG_TAG, "Using InAppWebViewClient implementation");
return new InAppWebViewClient(inAppBrowserDelegate);
}
}
@SuppressLint("RestrictedApi")
public void prepare() {
if (plugin != null) {
@ -211,8 +246,14 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
inAppWebViewChromeClient = new InAppWebViewChromeClient(plugin, this, inAppBrowserDelegate);
setWebChromeClient(inAppWebViewChromeClient);
inAppWebViewClient = new InAppWebViewClient(inAppBrowserDelegate);
setWebViewClient(inAppWebViewClient);
WebViewClient webViewClient = createWebViewClient(inAppBrowserDelegate);
if (webViewClient instanceof InAppWebViewClientCompat) {
inAppWebViewClientCompat = (InAppWebViewClientCompat) webViewClient;
setWebViewClient(inAppWebViewClientCompat);
} else if (webViewClient instanceof InAppWebViewClient) {
inAppWebViewClient = (InAppWebViewClient) webViewClient;
setWebViewClient(inAppWebViewClient);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && WebViewFeature.isFeatureSupported(WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE)) {
inAppWebViewRenderProcessClient = new InAppWebViewRenderProcessClient();
@ -1982,6 +2023,7 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
evaluateJavaScriptContentWorldCallbacks.clear();
inAppBrowserDelegate = null;
inAppWebViewChromeClient = null;
inAppWebViewClientCompat = null;
inAppWebViewClient = null;
javaScriptBridgeInterface = null;
inAppWebViewRenderProcessClient = null;

View File

@ -731,7 +731,9 @@ public class InAppWebViewChromeClient extends WebChromeClient implements PluginR
InAppWebView webView = (InAppWebView) view;
if (webView.inAppWebViewClient != null) {
if (webView.inAppWebViewClientCompat != null) {
webView.inAppWebViewClientCompat.loadCustomJavaScriptOnPageStarted(view);
} else if (webView.inAppWebViewClient != null) {
webView.inAppWebViewClient.loadCustomJavaScriptOnPageStarted(view);
}

View File

@ -114,7 +114,9 @@ public class InAppWebViewClient extends WebViewClient {
return false;
}
private void allowShouldOverrideUrlLoading(WebView webView, String url, Map<String, String> headers, boolean isForMainFrame) {
private void allowShouldOverrideUrlLoading(WebView webView, String url,
@Nullable Map<String, String> headers,
boolean isForMainFrame) {
if (isForMainFrame) {
// There isn't any way to load an URL for a frame that is not the main frame,
// so call this only on main frame.
@ -124,8 +126,11 @@ public class InAppWebViewClient extends WebViewClient {
webView.loadUrl(url);
}
}
public void onShouldOverrideUrlLoading(final InAppWebView webView, final String url, final String method, final Map<String, String> headers,
final boolean isForMainFrame, boolean hasGesture, boolean isRedirect) {
public void onShouldOverrideUrlLoading(final InAppWebView webView, final String url,
final String method,
@Nullable final Map<String, String> headers,
final boolean isForMainFrame, boolean hasGesture,
boolean isRedirect) {
URLRequest request = new URLRequest(url, method, null, headers);
NavigationAction navigationAction = new NavigationAction(
request,

View File

@ -0,0 +1,841 @@
package com.pichillilorenzo.flutter_inappwebview.webview.in_app_webview;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.webkit.ClientCertRequest;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.HttpAuthHandler;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.SafeBrowsingResponseCompat;
import androidx.webkit.WebResourceErrorCompat;
import androidx.webkit.WebResourceRequestCompat;
import androidx.webkit.WebViewClientCompat;
import androidx.webkit.WebViewFeature;
import com.pichillilorenzo.flutter_inappwebview.Util;
import com.pichillilorenzo.flutter_inappwebview.credential_database.CredentialDatabase;
import com.pichillilorenzo.flutter_inappwebview.in_app_browser.InAppBrowserDelegate;
import com.pichillilorenzo.flutter_inappwebview.plugin_scripts_js.JavaScriptBridgeJS;
import com.pichillilorenzo.flutter_inappwebview.types.ClientCertChallenge;
import com.pichillilorenzo.flutter_inappwebview.types.ClientCertResponse;
import com.pichillilorenzo.flutter_inappwebview.types.CustomSchemeResponse;
import com.pichillilorenzo.flutter_inappwebview.types.HttpAuthResponse;
import com.pichillilorenzo.flutter_inappwebview.types.HttpAuthenticationChallenge;
import com.pichillilorenzo.flutter_inappwebview.types.NavigationAction;
import com.pichillilorenzo.flutter_inappwebview.types.NavigationActionPolicy;
import com.pichillilorenzo.flutter_inappwebview.types.ServerTrustAuthResponse;
import com.pichillilorenzo.flutter_inappwebview.types.ServerTrustChallenge;
import com.pichillilorenzo.flutter_inappwebview.types.URLCredential;
import com.pichillilorenzo.flutter_inappwebview.types.URLProtectionSpace;
import com.pichillilorenzo.flutter_inappwebview.types.URLRequest;
import com.pichillilorenzo.flutter_inappwebview.types.WebResourceErrorExt;
import com.pichillilorenzo.flutter_inappwebview.types.WebResourceRequestExt;
import com.pichillilorenzo.flutter_inappwebview.types.WebResourceResponseExt;
import com.pichillilorenzo.flutter_inappwebview.webview.WebViewChannelDelegate;
import java.io.ByteArrayInputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
public class InAppWebViewClientCompat extends WebViewClientCompat {
protected static final String LOG_TAG = "IAWebViewClientCompat";
private InAppBrowserDelegate inAppBrowserDelegate;
private static int previousAuthRequestFailureCount = 0;
private static List<URLCredential> credentialsProposed = null;
public InAppWebViewClientCompat(InAppBrowserDelegate inAppBrowserDelegate) {
super();
this.inAppBrowserDelegate = inAppBrowserDelegate;
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public boolean shouldOverrideUrlLoading(@NonNull WebView view, @NonNull WebResourceRequest request) {
InAppWebView webView = (InAppWebView) view;
if (webView.customSettings.useShouldOverrideUrlLoading) {
boolean isRedirect = false;
if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_RESOURCE_REQUEST_IS_REDIRECT)) {
isRedirect = WebResourceRequestCompat.isRedirect(request);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
isRedirect = request.isRedirect();
}
onShouldOverrideUrlLoading(
webView,
request.getUrl().toString(),
request.getMethod(),
request.getRequestHeaders(),
request.isForMainFrame(),
request.hasGesture(),
isRedirect);
if (webView.regexToCancelSubFramesLoadingCompiled != null) {
if (request.isForMainFrame())
return true;
else {
Matcher m = webView.regexToCancelSubFramesLoadingCompiled.matcher(request.getUrl().toString());
return m.matches();
}
} else {
// There isn't any way to load an URL for a frame that is not the main frame,
// so if the request is not for the main frame, the navigation is allowed.
return request.isForMainFrame();
}
}
return false;
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String url) {
InAppWebView inAppWebView = (InAppWebView) webView;
if (inAppWebView.customSettings.useShouldOverrideUrlLoading) {
onShouldOverrideUrlLoading(inAppWebView, url, "GET", null,true, false, false);
return true;
}
return false;
}
private void allowShouldOverrideUrlLoading(WebView webView, String url,
@Nullable Map<String, String> headers,
boolean isForMainFrame) {
if (isForMainFrame) {
// There isn't any way to load an URL for a frame that is not the main frame,
// so call this only on main frame.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
webView.loadUrl(url, headers);
else
webView.loadUrl(url);
}
}
public void onShouldOverrideUrlLoading(final InAppWebView webView, final String url,
final String method,
@Nullable final Map<String, String> headers,
final boolean isForMainFrame, boolean hasGesture,
boolean isRedirect) {
URLRequest request = new URLRequest(url, method, null, headers);
NavigationAction navigationAction = new NavigationAction(
request,
isForMainFrame,
hasGesture,
isRedirect
);
final WebViewChannelDelegate.ShouldOverrideUrlLoadingCallback callback = new WebViewChannelDelegate.ShouldOverrideUrlLoadingCallback() {
@Override
public boolean nonNullSuccess(@NonNull NavigationActionPolicy result) {
switch (result) {
case ALLOW:
allowShouldOverrideUrlLoading(webView, url, headers, isForMainFrame);
break;
case CANCEL:
default:
break;
}
return false;
}
@Override
public void defaultBehaviour(@Nullable NavigationActionPolicy result) {
allowShouldOverrideUrlLoading(webView, url, headers, isForMainFrame);
}
@Override
public void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails) {
Log.e(LOG_TAG, errorCode + ", " + ((errorMessage != null) ? errorMessage : ""));
defaultBehaviour(null);
}
};
if (webView.channelDelegate != null) {
webView.channelDelegate.shouldOverrideUrlLoading(navigationAction, callback);
} else {
callback.defaultBehaviour(null);
}
}
@SuppressLint("RestrictedApi")
public void loadCustomJavaScriptOnPageStarted(WebView view) {
InAppWebView webView = (InAppWebView) view;
if (!WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) {
String source = webView.userContentController.generateWrappedCodeForDocumentStart();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
webView.evaluateJavascript(source, (ValueCallback<String>) null);
} else {
webView.loadUrl("javascript:" + source.replaceAll("[\r\n]+", ""));
}
}
}
public void loadCustomJavaScriptOnPageFinished(WebView view) {
InAppWebView webView = (InAppWebView) view;
String source = webView.userContentController.generateWrappedCodeForDocumentEnd();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
webView.evaluateJavascript(source, (ValueCallback<String>) null);
} else {
webView.loadUrl("javascript:" + source.replaceAll("[\r\n]+", ""));
}
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
final InAppWebView webView = (InAppWebView) view;
webView.isLoading = true;
webView.disposeWebMessageChannels();
webView.userContentController.resetContentWorlds();
loadCustomJavaScriptOnPageStarted(webView);
super.onPageStarted(view, url, favicon);
if (inAppBrowserDelegate != null) {
inAppBrowserDelegate.didStartNavigation(url);
}
if (webView.channelDelegate != null) {
webView.channelDelegate.onLoadStart(url);
}
}
public void onPageFinished(WebView view, String url) {
final InAppWebView webView = (InAppWebView) view;
webView.isLoading = false;
loadCustomJavaScriptOnPageFinished(webView);
previousAuthRequestFailureCount = 0;
credentialsProposed = null;
super.onPageFinished(view, url);
if (inAppBrowserDelegate != null) {
inAppBrowserDelegate.didFinishNavigation(url);
}
// WebView not storing cookies reliable to local device storage
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
CookieManager.getInstance().flush();
} else {
CookieSyncManager.getInstance().sync();
}
String js = JavaScriptBridgeJS.PLATFORM_READY_JS_SOURCE;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
webView.evaluateJavascript(js, (ValueCallback<String>) null);
} else {
webView.loadUrl("javascript:" + js.replaceAll("[\r\n]+", ""));
}
if (webView.channelDelegate != null) {
webView.channelDelegate.onLoadStop(url);
}
}
@Override
public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
super.doUpdateVisitedHistory(view, url, isReload);
// url argument sometimes doesn't contain the new changed URL, so we get it again from the webview.
url = view.getUrl();
if (inAppBrowserDelegate != null) {
inAppBrowserDelegate.didUpdateVisitedHistory(url);
}
final InAppWebView webView = (InAppWebView) view;
if (webView.channelDelegate != null) {
webView.channelDelegate.onUpdateVisitedHistory(url, isReload);
}
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onReceivedError(@NonNull WebView view,
@NonNull WebResourceRequest request,
@NonNull WebResourceErrorCompat error) {
final InAppWebView webView = (InAppWebView) view;
if (request.isForMainFrame()) {
if (webView.customSettings.disableDefaultErrorPage) {
webView.stopLoading();
webView.loadUrl("about:blank");
}
webView.isLoading = false;
previousAuthRequestFailureCount = 0;
credentialsProposed = null;
if (inAppBrowserDelegate != null) {
int type = -1;
if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE)) {
type = error.getErrorCode();
}
String description = "";
if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION)) {
description = error.getDescription().toString();
}
inAppBrowserDelegate.didFailNavigation(request.getUrl().toString(), type, description);
}
}
if (webView.channelDelegate != null) {
webView.channelDelegate.onReceivedError(
WebResourceRequestExt.fromWebResourceRequest(request),
WebResourceErrorExt.fromWebResourceError(error));
}
}
@SuppressLint("RestrictedApi")
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
final InAppWebView webView = (InAppWebView) view;
if (!WebViewFeature.isFeatureSupported(WebViewFeature.SUPPRESS_ERROR_PAGE) &&
webView.customSettings.disableDefaultErrorPage) {
webView.stopLoading();
webView.loadUrl("about:blank");
}
webView.isLoading = false;
previousAuthRequestFailureCount = 0;
credentialsProposed = null;
if (inAppBrowserDelegate != null) {
inAppBrowserDelegate.didFailNavigation(failingUrl, errorCode, description);
}
WebResourceRequestExt request = new WebResourceRequestExt(
failingUrl,
null,
false,
false,
true,
"GET");
WebResourceErrorExt error = new WebResourceErrorExt(
errorCode,
description
);
if (webView.channelDelegate != null) {
webView.channelDelegate.onReceivedError(
request,
error);
}
super.onReceivedError(view, errorCode, description, failingUrl);
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onReceivedHttpError(@NonNull WebView view,
@NonNull WebResourceRequest request,
@NonNull WebResourceResponse errorResponse) {
super.onReceivedHttpError(view, request, errorResponse);
final InAppWebView webView = (InAppWebView) view;
if (webView.channelDelegate != null) {
webView.channelDelegate.onReceivedHttpError(
WebResourceRequestExt.fromWebResourceRequest(request),
WebResourceResponseExt.fromWebResourceResponse(errorResponse));
}
}
@Override
public void onReceivedHttpAuthRequest(final WebView view, final HttpAuthHandler handler, final String host, final String realm) {
final String url = view.getUrl();
String protocol = "https";
int port = 0;
if (url != null) {
try {
URI uri = new URI(url);
protocol = uri.getScheme();
port = uri.getPort();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
previousAuthRequestFailureCount++;
if (credentialsProposed == null)
credentialsProposed = CredentialDatabase.getInstance(view.getContext()).getHttpAuthCredentials(host, protocol, realm, port);
URLCredential credentialProposed = null;
if (credentialsProposed != null && credentialsProposed.size() > 0) {
credentialProposed = credentialsProposed.get(0);
}
URLProtectionSpace protectionSpace = new URLProtectionSpace(host, protocol, realm, port, view.getCertificate(), null);
HttpAuthenticationChallenge challenge = new HttpAuthenticationChallenge(protectionSpace, previousAuthRequestFailureCount, credentialProposed);
final InAppWebView webView = (InAppWebView) view;
final String finalProtocol = protocol;
final int finalPort = port;
final WebViewChannelDelegate.ReceivedHttpAuthRequestCallback callback = new WebViewChannelDelegate.ReceivedHttpAuthRequestCallback() {
@Override
public boolean nonNullSuccess(@NonNull HttpAuthResponse response) {
Integer action = response.getAction();
if (action != null) {
switch (action) {
case 1:
String username = response.getUsername();
String password = response.getPassword();
boolean permanentPersistence = response.isPermanentPersistence();
if (permanentPersistence) {
CredentialDatabase.getInstance(view.getContext())
.setHttpAuthCredential(host, finalProtocol, realm, finalPort, username, password);
}
handler.proceed(username, password);
break;
case 2:
if (credentialsProposed.size() > 0) {
URLCredential credential = credentialsProposed.remove(0);
handler.proceed(credential.getUsername(), credential.getPassword());
} else {
handler.cancel();
}
// used custom CredentialDatabase!
// handler.useHttpAuthUsernamePassword();
break;
case 0:
default:
credentialsProposed = null;
previousAuthRequestFailureCount = 0;
handler.cancel();
}
return false;
}
return true;
}
@Override
public void defaultBehaviour(@Nullable HttpAuthResponse result) {
InAppWebViewClientCompat.super.onReceivedHttpAuthRequest(view, handler, host, realm);
}
@Override
public void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails) {
Log.e(LOG_TAG, errorCode + ", " + ((errorMessage != null) ? errorMessage : ""));
defaultBehaviour(null);
}
};
if (webView.channelDelegate != null) {
webView.channelDelegate.onReceivedHttpAuthRequest(challenge, callback);
} else {
callback.defaultBehaviour(null);
}
}
@Override
public void onReceivedSslError(final WebView view, final SslErrorHandler handler, final SslError sslError) {
final String url = sslError.getUrl();
String host = "";
String protocol = "https";
int port = 0;
try {
URI uri = new URI(url);
host = uri.getHost();
protocol = uri.getScheme();
port = uri.getPort();
} catch (URISyntaxException e) {
e.printStackTrace();
}
URLProtectionSpace protectionSpace = new URLProtectionSpace(host, protocol, null, port, sslError.getCertificate(), sslError);
ServerTrustChallenge challenge = new ServerTrustChallenge(protectionSpace);
final InAppWebView webView = (InAppWebView) view;
final WebViewChannelDelegate.ReceivedServerTrustAuthRequestCallback callback = new WebViewChannelDelegate.ReceivedServerTrustAuthRequestCallback() {
@Override
public boolean nonNullSuccess(@NonNull ServerTrustAuthResponse response) {
Integer action = response.getAction();
if (action != null) {
switch (action) {
case 1:
handler.proceed();
break;
case 0:
default:
handler.cancel();
}
return false;
}
return true;
}
@Override
public void defaultBehaviour(@Nullable ServerTrustAuthResponse result) {
InAppWebViewClientCompat.super.onReceivedSslError(view, handler, sslError);
}
@Override
public void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails) {
Log.e(LOG_TAG, errorCode + ", " + ((errorMessage != null) ? errorMessage : ""));
defaultBehaviour(null);
}
};
if (webView.channelDelegate != null) {
webView.channelDelegate.onReceivedServerTrustAuthRequest(challenge, callback);
} else {
callback.defaultBehaviour(null);
}
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void onReceivedClientCertRequest(final WebView view, final ClientCertRequest request) {
final String url = view.getUrl();
final String host = request.getHost();
String protocol = "https";
final int port = request.getPort();
if (url != null) {
try {
URI uri = new URI(url);
protocol = uri.getScheme();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
URLProtectionSpace protectionSpace = new URLProtectionSpace(host, protocol, null, port, view.getCertificate(), null);
ClientCertChallenge challenge = new ClientCertChallenge(protectionSpace, request.getPrincipals(), request.getKeyTypes());
final InAppWebView webView = (InAppWebView) view;
final WebViewChannelDelegate.ReceivedClientCertRequestCallback callback = new WebViewChannelDelegate.ReceivedClientCertRequestCallback() {
@Override
public boolean nonNullSuccess(@NonNull ClientCertResponse response) {
Integer action = response.getAction();
if (action != null && webView.plugin != null) {
switch (action) {
case 1:
{
String certificatePath = (String) response.getCertificatePath();
String certificatePassword = (String) response.getCertificatePassword();
String keyStoreType = (String) response.getKeyStoreType();
Util.PrivateKeyAndCertificates privateKeyAndCertificates =
Util.loadPrivateKeyAndCertificate(webView.plugin, certificatePath, certificatePassword, keyStoreType);
if (privateKeyAndCertificates != null) {
request.proceed(privateKeyAndCertificates.privateKey, privateKeyAndCertificates.certificates);
} else {
request.cancel();
}
}
break;
case 2:
request.ignore();
break;
case 0:
default:
request.cancel();
}
return false;
}
return true;
}
@Override
public void defaultBehaviour(@Nullable ClientCertResponse result) {
InAppWebViewClientCompat.super.onReceivedClientCertRequest(view, request);
}
@Override
public void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails) {
Log.e(LOG_TAG, errorCode + ", " + ((errorMessage != null) ? errorMessage : ""));
defaultBehaviour(null);
}
};
if (webView.channelDelegate != null) {
webView.channelDelegate.onReceivedClientCertRequest(challenge, callback);
} else {
callback.defaultBehaviour(null);
}
}
@Override
public void onScaleChanged(WebView view, float oldScale, float newScale) {
super.onScaleChanged(view, oldScale, newScale);
final InAppWebView webView = (InAppWebView) view;
webView.zoomScale = newScale / Util.getPixelDensity(webView.getContext());
if (webView.channelDelegate != null) {
webView.channelDelegate.onZoomScaleChanged(oldScale, newScale);
}
}
@RequiresApi(api = Build.VERSION_CODES.O_MR1)
@Override
public void onSafeBrowsingHit(@NonNull final WebView view,
@NonNull final WebResourceRequest request,
final int threatType,
@NonNull final SafeBrowsingResponseCompat callback) {
final InAppWebView webView = (InAppWebView) view;
final WebViewChannelDelegate.SafeBrowsingHitCallback resultCallback = new WebViewChannelDelegate.SafeBrowsingHitCallback() {
@Override
public boolean nonNullSuccess(@NonNull com.pichillilorenzo.flutter_inappwebview.types.SafeBrowsingResponse response) {
Integer action = response.getAction();
if (action != null) {
boolean report = response.isReport();
switch (action) {
case 0:
if (WebViewFeature.isFeatureSupported(WebViewFeature.SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY)) {
callback.backToSafety(report);
} else {
return true;
}
break;
case 1:
if (WebViewFeature.isFeatureSupported(WebViewFeature.SAFE_BROWSING_RESPONSE_PROCEED)) {
callback.proceed(report);
} else {
return true;
}
break;
case 2:
default:
if (WebViewFeature.isFeatureSupported(WebViewFeature.SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL)) {
callback.showInterstitial(report);
} else {
return true;
}
}
return false;
}
return true;
}
@Override
public void defaultBehaviour(@Nullable com.pichillilorenzo.flutter_inappwebview.types.SafeBrowsingResponse result) {
InAppWebViewClientCompat.super.onSafeBrowsingHit(view, request, threatType, callback);
}
@Override
public void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails) {
Log.e(LOG_TAG, errorCode + ", " + ((errorMessage != null) ? errorMessage : ""));
defaultBehaviour(null);
}
};
if (webView.channelDelegate != null) {
webView.channelDelegate.onSafeBrowsingHit(request.getUrl().toString(), threatType, resultCallback);
} else {
resultCallback.defaultBehaviour(null);
}
}
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequestExt request) {
final InAppWebView webView = (InAppWebView) view;
if (webView.webViewAssetLoaderExt != null && webView.webViewAssetLoaderExt.loader != null) {
try {
final Uri uri = Uri.parse(request.getUrl());
WebResourceResponse webResourceResponse = webView.webViewAssetLoaderExt.loader.shouldInterceptRequest(uri);
if (webResourceResponse != null) {
return webResourceResponse;
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (webView.customSettings.useShouldInterceptRequest) {
WebResourceResponseExt response = null;
if (webView.channelDelegate != null) {
try {
response = webView.channelDelegate.shouldInterceptRequest(request);
} catch (InterruptedException e) {
e.printStackTrace();
return null;
}
}
if (response != null) {
String contentType = response.getContentType();
String contentEncoding = response.getContentEncoding();
byte[] data = response.getData();
Map<String, String> responseHeaders = response.getHeaders();
Integer statusCode = response.getStatusCode();
String reasonPhrase = response.getReasonPhrase();
ByteArrayInputStream inputStream = (data != null) ? new ByteArrayInputStream(data) : null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && statusCode != null && reasonPhrase != null) {
return new WebResourceResponse(contentType, contentEncoding, statusCode, reasonPhrase, responseHeaders, inputStream);
} else {
return new WebResourceResponse(contentType, contentEncoding, inputStream);
}
}
return null;
}
final String url = request.getUrl();
String scheme = url.split(":")[0].toLowerCase();
try {
scheme = Uri.parse(request.getUrl()).getScheme();
} catch (Exception ignored) {}
if (webView.customSettings.resourceCustomSchemes != null && webView.customSettings.resourceCustomSchemes.contains(scheme)) {
CustomSchemeResponse customSchemeResponse = null;
if (webView.channelDelegate != null) {
try {
customSchemeResponse = webView.channelDelegate.onLoadResourceWithCustomScheme(request);
} catch (InterruptedException e) {
e.printStackTrace();
return null;
}
}
if (customSchemeResponse != null) {
WebResourceResponse response = null;
try {
response = webView.contentBlockerHandler.checkUrl(webView, request, customSchemeResponse.getContentType());
} catch (Exception e) {
e.printStackTrace();
}
if (response != null)
return response;
return new WebResourceResponse(customSchemeResponse.getContentType(),
customSchemeResponse.getContentType(),
new ByteArrayInputStream(customSchemeResponse.getData()));
}
}
WebResourceResponse response = null;
if (webView.contentBlockerHandler.getRuleList().size() > 0) {
try {
response = webView.contentBlockerHandler.checkUrl(webView, request);
} catch (Exception e) {
e.printStackTrace();
}
}
return response;
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, final String url) {
WebResourceRequestExt requestExt = new WebResourceRequestExt(
url, null, false,
false, true, "GET"
);
return shouldInterceptRequest(view, requestExt);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
WebResourceRequestExt requestExt = WebResourceRequestExt.fromWebResourceRequest(request);
return shouldInterceptRequest(view, requestExt);
}
@Override
public void onFormResubmission(final WebView view, final Message dontResend, final Message resend) {
final InAppWebView webView = (InAppWebView) view;
final WebViewChannelDelegate.FormResubmissionCallback callback = new WebViewChannelDelegate.FormResubmissionCallback() {
@Override
public boolean nonNullSuccess(@NonNull Integer action) {
switch (action) {
case 0:
resend.sendToTarget();
break;
case 1:
default:
dontResend.sendToTarget();
}
return false;
}
@Override
public void defaultBehaviour(@Nullable Integer result) {
InAppWebViewClientCompat.super.onFormResubmission(view, dontResend, resend);
}
@Override
public void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails) {
Log.e(LOG_TAG, errorCode + ", " + ((errorMessage != null) ? errorMessage : ""));
defaultBehaviour(null);
}
};
if (webView.channelDelegate != null) {
webView.channelDelegate.onFormResubmission(webView.getUrl(), callback);
} else {
callback.defaultBehaviour(null);
}
}
@Override
public void onPageCommitVisible(@NonNull WebView view, @NonNull String url) {
super.onPageCommitVisible(view, url);
final InAppWebView webView = (InAppWebView) view;
if (webView.channelDelegate != null) {
webView.channelDelegate.onPageCommitVisible(url);
}
}
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
final InAppWebView webView = (InAppWebView) view;
if (webView.customSettings.useOnRenderProcessGone && webView.channelDelegate != null) {
boolean didCrash = detail.didCrash();
int rendererPriorityAtExit = detail.rendererPriorityAtExit();
webView.channelDelegate.onRenderProcessGone(didCrash, rendererPriorityAtExit);
return true;
}
return super.onRenderProcessGone(view, detail);
}
@Override
public void onReceivedLoginRequest(WebView view, String realm, String account, String args) {
final InAppWebView webView = (InAppWebView) view;
if (webView.channelDelegate != null) {
webView.channelDelegate.onReceivedLoginRequest(realm, account, args);
}
}
@Override
public void onUnhandledKeyEvent(WebView view, KeyEvent event) {}
public void dispose() {
if (inAppBrowserDelegate != null) {
inAppBrowserDelegate = null;
}
}
}

View File

@ -33,6 +33,8 @@ public class WebMessageListener implements Disposable {
protected static final String LOG_TAG = "WebMessageListener";
public static final String METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_listener_";
@NonNull
public String id;
public String jsObjectName;
public Set<String> allowedOriginRules;
public WebViewCompat.WebMessageListener listener;
@ -42,12 +44,14 @@ public class WebMessageListener implements Disposable {
@Nullable
public WebMessageListenerChannelDelegate channelDelegate;
public WebMessageListener(@NonNull InAppWebViewInterface webView, @NonNull BinaryMessenger messenger,
public WebMessageListener(@NonNull String id,
@NonNull InAppWebViewInterface webView, @NonNull BinaryMessenger messenger,
@NonNull String jsObjectName, @NonNull Set<String> allowedOriginRules) {
this.id = id;
this.webView = webView;
this.jsObjectName = jsObjectName;
this.allowedOriginRules = allowedOriginRules;
final MethodChannel channel = new MethodChannel(messenger, METHOD_CHANNEL_NAME_PREFIX + this.jsObjectName);
final MethodChannel channel = new MethodChannel(messenger, METHOD_CHANNEL_NAME_PREFIX + this.id + "_" + this.jsObjectName);
this.channelDelegate = new WebMessageListenerChannelDelegate(this, channel);
if (this.webView instanceof InAppWebView) {
@ -107,12 +111,13 @@ public class WebMessageListener implements Disposable {
if (map == null) {
return null;
}
String id = (String) map.get("id");
String jsObjectName = (String) map.get("jsObjectName");
assert jsObjectName != null;
List<String> allowedOriginRuleList = (List<String>) map.get("allowedOriginRules");
assert allowedOriginRuleList != null;
Set<String> allowedOriginRules = new HashSet<>(allowedOriginRuleList);
return new WebMessageListener(webView, messenger, jsObjectName, allowedOriginRules);
return new WebMessageListener(id, webView, messenger, jsObjectName, allowedOriginRules);
}
public void assertOriginRulesValid() throws Exception {

View File

@ -45,10 +45,16 @@ class ExchangeableEnumGenerator
}
classBuffer.writeln('class $extClassName {');
final FieldElement enumValue = visitor.fields.entries
final fieldEntriesSorted = visitor.fields.entries.toList();
fieldEntriesSorted.sort((a, b) => a.key.compareTo(b.key));
final methodEntriesSorted = visitor.methods.entries.toList();
fieldEntriesSorted.sort((a, b) => a.key.compareTo(b.key));
final FieldElement enumValue = fieldEntriesSorted
.firstWhere((element) => element.key == "_value")
.value;
final FieldElement enumNativeValue = visitor.fields.entries
final FieldElement enumNativeValue = fieldEntriesSorted
.firstWhere((element) => element.key == "_nativeValue",
orElse: () => MapEntry("_nativeValue", enumValue))
.value;
@ -62,7 +68,7 @@ class ExchangeableEnumGenerator
classBuffer.writeln(
"factory $extClassName._internalMultiPlatform(${enumValue.type} value, Function nativeValue) => $extClassName._internal(value, nativeValue());");
for (final entry in visitor.fields.entries) {
for (final entry in fieldEntriesSorted) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (fieldName == "_value" || fieldName == "_nativeValue") {
@ -176,7 +182,7 @@ class ExchangeableEnumGenerator
if (annotation.read("valuesProperty").boolValue) {
classBuffer.writeln('///Set of all values of [$extClassName].');
classBuffer.writeln('static final Set<$extClassName> values = [');
for (final entry in visitor.fields.entries) {
for (final entry in fieldEntriesSorted) {
final fieldName = entry.key;
final fieldElement = entry.value;
final isEnumCustomValue = _coreCheckerEnumCustomValue
@ -228,7 +234,7 @@ class ExchangeableEnumGenerator
""");
}
for (final entry in visitor.methods.entries) {
for (final entry in methodEntriesSorted) {
final methodElement = entry.value;
if (Util.methodHasIgnore(methodElement)) {
continue;
@ -301,7 +307,7 @@ class ExchangeableEnumGenerator
classBuffer.writeln('return _value;');
} else {
classBuffer.writeln('switch(_value) {');
for (final entry in visitor.fields.entries) {
for (final entry in fieldEntriesSorted) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (!fieldElement.isPrivate && fieldElement.isStatic) {

View File

@ -67,7 +67,17 @@ class ExchangeableObjectGenerator
final deprecatedFields = <VariableElement>[];
final constructorFields = <String>[];
final superConstructorFields = <String>[];
for (final entry in visitor.fields.entries) {
final fieldEntriesSorted = visitor.fields.entries.toList();
fieldEntriesSorted.sort((a, b) => a.key.compareTo(b.key));
final fieldValuesSorted = visitor.fields.values.toList();
fieldValuesSorted.sort((a, b) => a.name.compareTo(b.name));
final methodEntriesSorted = visitor.methods.entries.toList();
fieldEntriesSorted.sort((a, b) => a.key.compareTo(b.key));
for (final entry in fieldEntriesSorted) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (!fieldElement.isPrivate) {
@ -295,7 +305,7 @@ class ExchangeableObjectGenerator
if (superClass != null) {
fieldElements.addAll(superClass.element2.fields);
}
fieldElements.addAll(visitor.fields.values);
fieldElements.addAll(fieldValuesSorted);
final nonRequiredFields = <String>[];
final requiredFields = <String>[];
for (final fieldElement in fieldElements) {
@ -353,7 +363,7 @@ class ExchangeableObjectGenerator
classBuffer.writeln('}');
}
for (final entry in visitor.methods.entries) {
for (final entry in methodEntriesSorted) {
final methodElement = entry.value;
if (Util.methodHasIgnore(methodElement)) {
continue;
@ -382,7 +392,7 @@ class ExchangeableObjectGenerator
classBuffer.writeln('///Converts instance to a map.');
classBuffer.writeln('Map<String, dynamic> toMap() {');
classBuffer.writeln('return {');
for (final entry in visitor.methods.entries) {
for (final entry in methodEntriesSorted) {
final methodElement = entry.value;
final toMapMergeWith = _coreCheckerObjectMethod
.firstAnnotationOf(methodElement)
@ -403,7 +413,7 @@ class ExchangeableObjectGenerator
}
}
}
for (final entry in visitor.fields.entries) {
for (final entry in fieldEntriesSorted) {
final fieldElement = entry.value;
if (!fieldElement.isPrivate &&
!fieldElement.hasDeprecated &&
@ -475,7 +485,7 @@ class ExchangeableObjectGenerator
}
}
}
for (final entry in visitor.fields.entries) {
for (final entry in fieldEntriesSorted) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (!fieldElement.isPrivate &&

View File

@ -3,11 +3,12 @@
export "FLUTTER_ROOT=/Users/lorenzopichilli/fvm/versions/3.3.6"
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=integration_test/webview_flutter_test.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
export "PACKAGE_CONFIG=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/.dart_tool/package_config.json"

View File

@ -10,16 +10,18 @@ import WebKit
public class WebMessageListener : FlutterMethodCallDelegate {
static var METHOD_CHANNEL_NAME_PREFIX = "com.pichillilorenzo/flutter_inappwebview_web_message_listener_"
var id: String
var jsObjectName: String
var allowedOriginRules: Set<String>
var channelDelegate: WebMessageListenerChannelDelegate?
weak var webView: InAppWebView?
public init(jsObjectName: String, allowedOriginRules: Set<String>) {
public init(id: String, jsObjectName: String, allowedOriginRules: Set<String>) {
self.id = id
self.jsObjectName = jsObjectName
self.allowedOriginRules = allowedOriginRules
super.init()
let channel = FlutterMethodChannel(name: WebMessageListener.METHOD_CHANNEL_NAME_PREFIX + self.jsObjectName,
let channel = FlutterMethodChannel(name: WebMessageListener.METHOD_CHANNEL_NAME_PREFIX + self.id + "_" + self.jsObjectName,
binaryMessenger: SwiftFlutterPlugin.instance!.registrar!.messenger())
self.channelDelegate = WebMessageListenerChannelDelegate(webMessageListener: self, channel: channel)
}
@ -101,7 +103,7 @@ public class WebMessageListener : FlutterMethodCallDelegate {
})();
"""
webView.configuration.userContentController.addPluginScript(PluginScript(
groupName: "WebMessageListener-" + jsObjectName,
groupName: "WebMessageListener-" + id + "-" + jsObjectName,
source: source,
injectionTime: .atDocumentStart,
forMainFrameOnly: false,
@ -117,6 +119,7 @@ public class WebMessageListener : FlutterMethodCallDelegate {
return nil
}
return WebMessageListener(
id: map["id"] as! String,
jsObjectName: map["jsObjectName"] as! String,
allowedOriginRules: Set(map["allowedOriginRules"] as! [String])
)

View File

@ -81,9 +81,9 @@ class WebViewAssetLoader {
///
///Implement this interface to handle other use-cases according to your app's needs.
abstract class PathHandler {
late final String _type;
late final String _id;
late final MethodChannel _channel;
late final String _id;
late final String _type;
///The suffix path to be handled.
///

View File

@ -18,8 +18,10 @@ class WebViewFeature {
factory WebViewFeature._internalMultiPlatform(
String value, Function nativeValue) =>
WebViewFeature._internal(value, nativeValue());
static const _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_webviewfeature');
///This feature covers [InAppWebViewSettings.algorithmicDarkeningAllowed].
static const ALGORITHMIC_DARKENING = WebViewFeature._internal(
'ALGORITHMIC_DARKENING', 'ALGORITHMIC_DARKENING');
///This feature covers [InAppWebViewController.createWebMessageChannel].
static const CREATE_WEB_MESSAGE_CHANNEL = WebViewFeature._internal(
@ -29,6 +31,15 @@ class WebViewFeature {
static const DISABLED_ACTION_MODE_MENU_ITEMS = WebViewFeature._internal(
'DISABLED_ACTION_MODE_MENU_ITEMS', 'DISABLED_ACTION_MODE_MENU_ITEMS');
///This feature covers [UserScriptInjectionTime.AT_DOCUMENT_START].
static const DOCUMENT_START_SCRIPT = WebViewFeature._internal(
'DOCUMENT_START_SCRIPT', 'DOCUMENT_START_SCRIPT');
///This feature covers [InAppWebViewSettings.enterpriseAuthenticationAppLinkPolicyEnabled].
static const ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY =
WebViewFeature._internal('ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY',
'ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY');
///This feature covers [InAppWebViewSettings.forceDark].
static const FORCE_DARK =
WebViewFeature._internal('FORCE_DARK', 'FORCE_DARK');
@ -37,6 +48,10 @@ class WebViewFeature {
static const FORCE_DARK_STRATEGY =
WebViewFeature._internal('FORCE_DARK_STRATEGY', 'FORCE_DARK_STRATEGY');
///This feature covers [InAppWebViewController.getVariationsHeader].
static const GET_VARIATIONS_HEADER = WebViewFeature._internal(
'GET_VARIATIONS_HEADER', 'GET_VARIATIONS_HEADER');
///
static const GET_WEB_CHROME_CLIENT = WebViewFeature._internal(
'GET_WEB_CHROME_CLIENT', 'GET_WEB_CHROME_CLIENT');
@ -77,6 +92,10 @@ class WebViewFeature {
static const RECEIVE_WEB_RESOURCE_ERROR = WebViewFeature._internal(
'RECEIVE_WEB_RESOURCE_ERROR', 'RECEIVE_WEB_RESOURCE_ERROR');
///This feature covers [InAppWebViewSettings.requestedWithHeaderMode].
static const REQUESTED_WITH_HEADER_CONTROL = WebViewFeature._internal(
'REQUESTED_WITH_HEADER_CONTROL', 'REQUESTED_WITH_HEADER_CONTROL');
///This feature covers [InAppWebViewController.setSafeBrowsingAllowlist].
static const SAFE_BROWSING_ALLOWLIST = WebViewFeature._internal(
'SAFE_BROWSING_ALLOWLIST', 'SAFE_BROWSING_ALLOWLIST');
@ -145,6 +164,10 @@ class WebViewFeature {
static const START_SAFE_BROWSING =
WebViewFeature._internal('START_SAFE_BROWSING', 'START_SAFE_BROWSING');
///This feature covers [InAppWebViewSettings.willSuppressErrorPage].
static const SUPPRESS_ERROR_PAGE =
WebViewFeature._internal('SUPPRESS_ERROR_PAGE', 'SUPPRESS_ERROR_PAGE');
///
static const TRACING_CONTROLLER_BASIC_USAGE = WebViewFeature._internal(
'TRACING_CONTROLLER_BASIC_USAGE', 'TRACING_CONTROLLER_BASIC_USAGE');
@ -195,38 +218,19 @@ class WebViewFeature {
///
static const WEB_VIEW_RENDERER_TERMINATE = WebViewFeature._internal(
'WEB_VIEW_RENDERER_TERMINATE', 'WEB_VIEW_RENDERER_TERMINATE');
///This feature covers [UserScriptInjectionTime.AT_DOCUMENT_START].
static const DOCUMENT_START_SCRIPT = WebViewFeature._internal(
'DOCUMENT_START_SCRIPT', 'DOCUMENT_START_SCRIPT');
///This feature covers [InAppWebViewSettings.willSuppressErrorPage].
static const SUPPRESS_ERROR_PAGE =
WebViewFeature._internal('SUPPRESS_ERROR_PAGE', 'SUPPRESS_ERROR_PAGE');
///This feature covers [InAppWebViewSettings.algorithmicDarkeningAllowed].
static const ALGORITHMIC_DARKENING = WebViewFeature._internal(
'ALGORITHMIC_DARKENING', 'ALGORITHMIC_DARKENING');
///This feature covers [InAppWebViewSettings.requestedWithHeaderMode].
static const REQUESTED_WITH_HEADER_CONTROL = WebViewFeature._internal(
'REQUESTED_WITH_HEADER_CONTROL', 'REQUESTED_WITH_HEADER_CONTROL');
///This feature covers [InAppWebViewSettings.enterpriseAuthenticationAppLinkPolicyEnabled].
static const ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY =
WebViewFeature._internal('ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY',
'ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY');
///This feature covers [InAppWebViewController.getVariationsHeader].
static const GET_VARIATIONS_HEADER = WebViewFeature._internal(
'GET_VARIATIONS_HEADER', 'GET_VARIATIONS_HEADER');
static const _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_webviewfeature');
///Set of all values of [WebViewFeature].
static final Set<WebViewFeature> values = [
WebViewFeature.ALGORITHMIC_DARKENING,
WebViewFeature.CREATE_WEB_MESSAGE_CHANNEL,
WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS,
WebViewFeature.DOCUMENT_START_SCRIPT,
WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY,
WebViewFeature.FORCE_DARK,
WebViewFeature.FORCE_DARK_STRATEGY,
WebViewFeature.GET_VARIATIONS_HEADER,
WebViewFeature.GET_WEB_CHROME_CLIENT,
WebViewFeature.GET_WEB_VIEW_CLIENT,
WebViewFeature.GET_WEB_VIEW_RENDERER,
@ -237,6 +241,7 @@ class WebViewFeature {
WebViewFeature.PROXY_OVERRIDE_REVERSE_BYPASS,
WebViewFeature.RECEIVE_HTTP_ERROR,
WebViewFeature.RECEIVE_WEB_RESOURCE_ERROR,
WebViewFeature.REQUESTED_WITH_HEADER_CONTROL,
WebViewFeature.SAFE_BROWSING_ALLOWLIST,
WebViewFeature.SAFE_BROWSING_ENABLE,
WebViewFeature.SAFE_BROWSING_HIT,
@ -253,6 +258,7 @@ class WebViewFeature {
WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST,
WebViewFeature.SHOULD_OVERRIDE_WITH_REDIRECTS,
WebViewFeature.START_SAFE_BROWSING,
WebViewFeature.SUPPRESS_ERROR_PAGE,
WebViewFeature.TRACING_CONTROLLER_BASIC_USAGE,
WebViewFeature.VISUAL_STATE_CALLBACK,
WebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE,
@ -265,12 +271,6 @@ class WebViewFeature {
WebViewFeature.WEB_RESOURCE_REQUEST_IS_REDIRECT,
WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE,
WebViewFeature.WEB_VIEW_RENDERER_TERMINATE,
WebViewFeature.DOCUMENT_START_SCRIPT,
WebViewFeature.SUPPRESS_ERROR_PAGE,
WebViewFeature.ALGORITHMIC_DARKENING,
WebViewFeature.REQUESTED_WITH_HEADER_CONTROL,
WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY,
WebViewFeature.GET_VARIATIONS_HEADER,
].toSet();
///Gets a possible [WebViewFeature] instance from [String] value.
@ -339,8 +339,10 @@ class AndroidWebViewFeature {
factory AndroidWebViewFeature._internalMultiPlatform(
String value, Function nativeValue) =>
AndroidWebViewFeature._internal(value, nativeValue());
static const _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_webviewfeature');
///This feature covers [InAppWebViewSettings.algorithmicDarkeningAllowed].
static const ALGORITHMIC_DARKENING = AndroidWebViewFeature._internal(
'ALGORITHMIC_DARKENING', 'ALGORITHMIC_DARKENING');
///
static const CREATE_WEB_MESSAGE_CHANNEL = AndroidWebViewFeature._internal(
@ -351,6 +353,16 @@ class AndroidWebViewFeature {
AndroidWebViewFeature._internal(
'DISABLED_ACTION_MODE_MENU_ITEMS', 'DISABLED_ACTION_MODE_MENU_ITEMS');
///This feature covers [UserScriptInjectionTime.AT_DOCUMENT_START].
static const DOCUMENT_START_SCRIPT = AndroidWebViewFeature._internal(
'DOCUMENT_START_SCRIPT', 'DOCUMENT_START_SCRIPT');
///This feature covers [InAppWebViewSettings.enterpriseAuthenticationAppLinkPolicyEnabled].
static const ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY =
AndroidWebViewFeature._internal(
'ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY',
'ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY');
///
static const FORCE_DARK =
AndroidWebViewFeature._internal('FORCE_DARK', 'FORCE_DARK');
@ -395,6 +407,10 @@ class AndroidWebViewFeature {
static const RECEIVE_WEB_RESOURCE_ERROR = AndroidWebViewFeature._internal(
'RECEIVE_WEB_RESOURCE_ERROR', 'RECEIVE_WEB_RESOURCE_ERROR');
///This feature covers [InAppWebViewSettings.requestedWithHeaderMode].
static const REQUESTED_WITH_HEADER_CONTROL = AndroidWebViewFeature._internal(
'REQUESTED_WITH_HEADER_CONTROL', 'REQUESTED_WITH_HEADER_CONTROL');
///
static const SAFE_BROWSING_ALLOWLIST = AndroidWebViewFeature._internal(
'SAFE_BROWSING_ALLOWLIST', 'SAFE_BROWSING_ALLOWLIST');
@ -465,6 +481,10 @@ class AndroidWebViewFeature {
static const START_SAFE_BROWSING = AndroidWebViewFeature._internal(
'START_SAFE_BROWSING', 'START_SAFE_BROWSING');
///This feature covers [InAppWebViewSettings.willSuppressErrorPage].
static const SUPPRESS_ERROR_PAGE = AndroidWebViewFeature._internal(
'SUPPRESS_ERROR_PAGE', 'SUPPRESS_ERROR_PAGE');
///
static const TRACING_CONTROLLER_BASIC_USAGE = AndroidWebViewFeature._internal(
'TRACING_CONTROLLER_BASIC_USAGE', 'TRACING_CONTROLLER_BASIC_USAGE');
@ -517,33 +537,16 @@ class AndroidWebViewFeature {
///
static const WEB_VIEW_RENDERER_TERMINATE = AndroidWebViewFeature._internal(
'WEB_VIEW_RENDERER_TERMINATE', 'WEB_VIEW_RENDERER_TERMINATE');
///This feature covers [UserScriptInjectionTime.AT_DOCUMENT_START].
static const DOCUMENT_START_SCRIPT = AndroidWebViewFeature._internal(
'DOCUMENT_START_SCRIPT', 'DOCUMENT_START_SCRIPT');
///This feature covers [InAppWebViewSettings.willSuppressErrorPage].
static const SUPPRESS_ERROR_PAGE = AndroidWebViewFeature._internal(
'SUPPRESS_ERROR_PAGE', 'SUPPRESS_ERROR_PAGE');
///This feature covers [InAppWebViewSettings.algorithmicDarkeningAllowed].
static const ALGORITHMIC_DARKENING = AndroidWebViewFeature._internal(
'ALGORITHMIC_DARKENING', 'ALGORITHMIC_DARKENING');
///This feature covers [InAppWebViewSettings.requestedWithHeaderMode].
static const REQUESTED_WITH_HEADER_CONTROL = AndroidWebViewFeature._internal(
'REQUESTED_WITH_HEADER_CONTROL', 'REQUESTED_WITH_HEADER_CONTROL');
///This feature covers [InAppWebViewSettings.enterpriseAuthenticationAppLinkPolicyEnabled].
static const ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY =
AndroidWebViewFeature._internal(
'ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY',
'ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY');
static const _channel = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_webviewfeature');
///Set of all values of [AndroidWebViewFeature].
static final Set<AndroidWebViewFeature> values = [
AndroidWebViewFeature.ALGORITHMIC_DARKENING,
AndroidWebViewFeature.CREATE_WEB_MESSAGE_CHANNEL,
AndroidWebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS,
AndroidWebViewFeature.DOCUMENT_START_SCRIPT,
AndroidWebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY,
AndroidWebViewFeature.FORCE_DARK,
AndroidWebViewFeature.FORCE_DARK_STRATEGY,
AndroidWebViewFeature.GET_WEB_CHROME_CLIENT,
@ -555,6 +558,7 @@ class AndroidWebViewFeature {
AndroidWebViewFeature.PROXY_OVERRIDE,
AndroidWebViewFeature.RECEIVE_HTTP_ERROR,
AndroidWebViewFeature.RECEIVE_WEB_RESOURCE_ERROR,
AndroidWebViewFeature.REQUESTED_WITH_HEADER_CONTROL,
AndroidWebViewFeature.SAFE_BROWSING_ALLOWLIST,
AndroidWebViewFeature.SAFE_BROWSING_ENABLE,
AndroidWebViewFeature.SAFE_BROWSING_HIT,
@ -571,6 +575,7 @@ class AndroidWebViewFeature {
AndroidWebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST,
AndroidWebViewFeature.SHOULD_OVERRIDE_WITH_REDIRECTS,
AndroidWebViewFeature.START_SAFE_BROWSING,
AndroidWebViewFeature.SUPPRESS_ERROR_PAGE,
AndroidWebViewFeature.TRACING_CONTROLLER_BASIC_USAGE,
AndroidWebViewFeature.VISUAL_STATE_CALLBACK,
AndroidWebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE,
@ -583,11 +588,6 @@ class AndroidWebViewFeature {
AndroidWebViewFeature.WEB_RESOURCE_REQUEST_IS_REDIRECT,
AndroidWebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE,
AndroidWebViewFeature.WEB_VIEW_RENDERER_TERMINATE,
AndroidWebViewFeature.DOCUMENT_START_SCRIPT,
AndroidWebViewFeature.SUPPRESS_ERROR_PAGE,
AndroidWebViewFeature.ALGORITHMIC_DARKENING,
AndroidWebViewFeature.REQUESTED_WITH_HEADER_CONTROL,
AndroidWebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY,
].toSet();
///Gets a possible [AndroidWebViewFeature] instance from [String] value.

View File

@ -8,95 +8,14 @@ part of 'chrome_safari_browser_settings.dart';
///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].
///An additional button to be shown in `SFSafariViewController`'s toolbar.
///This allows the user to access powerful functionality from your extension without needing to first show the `UIActivityViewController`.
///
///**NOTE**: Not available in a Trusted Web Activity.
///**NOTE**: available on iOS 15.0+.
///
///**Supported Platforms/Implementations**:
///- Android
CustomTabsShareState? shareState;
///Set to `false` if the title shouldn't be shown in the custom tab. The default value is `true`.
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
bool? showTitle;
///Set the custom background color of the toolbar.
///
///**Supported Platforms/Implementations**:
///- Android
Color? toolbarBackgroundColor;
///Sets the navigation bar color. Has no effect on Android API versions below L.
///
///**Supported Platforms/Implementations**:
///- Android
Color? navigationBarColor;
///Sets the navigation bar divider color. Has no effect on Android API versions below P.
///
///**Supported Platforms/Implementations**:
///- Android
Color? navigationBarDividerColor;
///Sets the color of the secondary toolbar.
///
///**Supported Platforms/Implementations**:
///- Android
Color? secondaryToolbarColor;
///Set to `true` to enable the url bar to hide as the user scrolls down on the page. The default value is `false`.
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
bool? enableUrlBarHiding;
///Set to `true` to enable Instant Apps. The default value is `false`.
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
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.
///
///**Supported Platforms/Implementations**:
///- Android
String? packageName;
///Set to `true` to enable Keep Alive. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android
bool? keepAliveEnabled;
///Set to `true` to launch the Android activity in `singleInstance` mode. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android
bool? isSingleInstance;
///Set to `true` to launch the Android intent with the flag `FLAG_ACTIVITY_NO_HISTORY`. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android
bool? noHistory;
///Set to `true` to launch the Custom Tab as a Trusted Web Activity. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android
bool? isTrustedWebActivity;
///- iOS
ActivityButton? activityButton;
///Sets a list of additional trusted origins that the user may navigate or be redirected to from the starting uri.
///
@ -106,38 +25,6 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions {
///- Android
List<String>? additionalTrustedOrigins;
///Sets a display mode of a Trusted Web Activity.
///
///**NOTE**: Available only in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
TrustedWebActivityDisplayMode? displayMode;
///Sets a screen orientation. This can be used e.g. to enable the locking of an orientation lock type.
///
///**NOTE**: Available only in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
TrustedWebActivityScreenOrientation? screenOrientation;
///Sets the start animations.
///It must contain 2 [AndroidResource], where the first one represents the "enter" animation for the browser
///and the second one represents the "exit" animation for the application.
///
///**Supported Platforms/Implementations**:
///- Android
List<AndroidResource>? startAnimations;
///Sets the exit animations.
///It must contain 2 [AndroidResource], where the first one represents the "enter" animation for the application
///and the second one represents the "exit" animation for the browser.
///
///**Supported Platforms/Implementations**:
///- Android
List<AndroidResource>? exitAnimations;
///Adds the necessary flags and extras to signal any browser supporting custom tabs to use the browser UI
///at all times and avoid showing custom tab like UI.
///Calling this with an intent will override any custom tabs related customizations.
@ -147,12 +34,6 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions {
///- Android
bool? alwaysUseBrowserUI;
///Set to `true` if Reader mode should be entered automatically when it is available for the webpage. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? entersReaderIfAvailable;
///Set to `true` to enable bar collapsing. The default value is `false`.
///
///**Supported Platforms/Implementations**:
@ -167,6 +48,99 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions {
///- iOS
DismissButtonStyle? dismissButtonStyle;
///Sets a display mode of a Trusted Web Activity.
///
///**NOTE**: Available only in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
TrustedWebActivityDisplayMode? displayMode;
///Set to `true` to enable the url bar to hide as the user scrolls down on the page. The default value is `false`.
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
bool? enableUrlBarHiding;
///Set to `true` if Reader mode should be entered automatically when it is available for the webpage. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? entersReaderIfAvailable;
///An event attribution associated with a click that caused this `SFSafariViewController` to be opened.
///This attribute is ignored if the `SFSafariViewController` url has a scheme of 'http'.
///
///**NOTE**: available on iOS 15.2+.
///
///**Supported Platforms/Implementations**:
///- iOS
UIEventAttribution? eventAttribution;
///Sets the exit animations.
///It must contain 2 [AndroidResource], where the first one represents the "enter" animation for the application
///and the second one represents the "exit" animation for the browser.
///
///**Supported Platforms/Implementations**:
///- Android
List<AndroidResource>? exitAnimations;
///Set to `true` to enable Instant Apps. The default value is `false`.
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
bool? instantAppsEnabled;
///Set to `true` to launch the Android activity in `singleInstance` mode. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android
bool? isSingleInstance;
///Set to `true` to launch the Custom Tab as a Trusted Web Activity. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android
bool? isTrustedWebActivity;
///Set to `true` to enable Keep Alive. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android
bool? keepAliveEnabled;
///Sets the navigation bar color. Has no effect on Android API versions below L.
///
///**Supported Platforms/Implementations**:
///- Android
Color? navigationBarColor;
///Sets the navigation bar divider color. Has no effect on Android API versions below P.
///
///**Supported Platforms/Implementations**:
///- Android
Color? navigationBarDividerColor;
///Set to `true` to launch the Android intent with the flag `FLAG_ACTIVITY_NO_HISTORY`. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android
bool? noHistory;
///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.
///
///**Supported Platforms/Implementations**:
///- Android
String? packageName;
///Set the custom background color of the navigation bar and the toolbar.
///
///**NOTE**: available on iOS 10.0+.
@ -189,29 +163,55 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions {
///- iOS
ModalPresentationStyle? presentationStyle;
///Sets a screen orientation. This can be used e.g. to enable the locking of an orientation lock type.
///
///**NOTE**: Available only in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
TrustedWebActivityScreenOrientation? screenOrientation;
///Sets the color of the secondary toolbar.
///
///**Supported Platforms/Implementations**:
///- Android
Color? secondaryToolbarColor;
///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.
///
///**Supported Platforms/Implementations**:
///- Android
CustomTabsShareState? shareState;
///Set to `false` if the title shouldn't be shown in the custom tab. The default value is `true`.
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
bool? showTitle;
///Sets the start animations.
///It must contain 2 [AndroidResource], where the first one represents the "enter" animation for the browser
///and the second one represents the "exit" animation for the application.
///
///**Supported Platforms/Implementations**:
///- Android
List<AndroidResource>? startAnimations;
///Set the custom background color of the toolbar.
///
///**Supported Platforms/Implementations**:
///- Android
Color? toolbarBackgroundColor;
///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL].
///
///**Supported Platforms/Implementations**:
///- iOS
ModalTransitionStyle? transitionStyle;
///An additional button to be shown in `SFSafariViewController`'s toolbar.
///This allows the user to access powerful functionality from your extension without needing to first show the `UIActivityViewController`.
///
///**NOTE**: available on iOS 15.0+.
///
///**Supported Platforms/Implementations**:
///- iOS
ActivityButton? activityButton;
///An event attribution associated with a click that caused this `SFSafariViewController` to be opened.
///This attribute is ignored if the `SFSafariViewController` url has a scheme of 'http'.
///
///**NOTE**: available on iOS 15.2+.
///
///**Supported Platforms/Implementations**:
///- iOS
UIEventAttribution? eventAttribution;
ChromeSafariBrowserSettings(
{this.shareState = CustomTabsShareState.SHARE_STATE_DEFAULT,
this.showTitle = true,
@ -257,8 +257,14 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions {
return null;
}
final instance = ChromeSafariBrowserSettings(
toolbarBackgroundColor: map['toolbarBackgroundColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarBackgroundColor'])
activityButton: ActivityButton.fromMap(
map['activityButton']?.cast<String, dynamic>()),
displayMode: _deserializeDisplayMode(map['displayMode']),
eventAttribution: UIEventAttribution.fromMap(
map['eventAttribution']?.cast<String, dynamic>()),
exitAnimations: map['exitAnimations'] != null
? List<AndroidResource>.from(map['exitAnimations']
.map((e) => AndroidResource.fromMap(e?.cast<String, dynamic>())!))
: null,
navigationBarColor: map['navigationBarColor'] != null
? UtilColor.fromStringRepresentation(map['navigationBarColor'])
@ -266,51 +272,45 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions {
navigationBarDividerColor: map['navigationBarDividerColor'] != null
? UtilColor.fromStringRepresentation(map['navigationBarDividerColor'])
: null,
secondaryToolbarColor: map['secondaryToolbarColor'] != null
? UtilColor.fromStringRepresentation(map['secondaryToolbarColor'])
: null,
packageName: map['packageName'],
displayMode: _deserializeDisplayMode(map['displayMode']),
startAnimations: map['startAnimations'] != null
? List<AndroidResource>.from(map['startAnimations']
.map((e) => AndroidResource.fromMap(e?.cast<String, dynamic>())!))
: null,
exitAnimations: map['exitAnimations'] != null
? List<AndroidResource>.from(map['exitAnimations']
.map((e) => AndroidResource.fromMap(e?.cast<String, dynamic>())!))
: null,
preferredBarTintColor: map['preferredBarTintColor'] != null
? UtilColor.fromStringRepresentation(map['preferredBarTintColor'])
: null,
preferredControlTintColor: map['preferredControlTintColor'] != null
? UtilColor.fromStringRepresentation(map['preferredControlTintColor'])
: null,
activityButton: ActivityButton.fromMap(
map['activityButton']?.cast<String, dynamic>()),
eventAttribution: UIEventAttribution.fromMap(
map['eventAttribution']?.cast<String, dynamic>()),
secondaryToolbarColor: map['secondaryToolbarColor'] != null
? UtilColor.fromStringRepresentation(map['secondaryToolbarColor'])
: null,
startAnimations: map['startAnimations'] != null
? List<AndroidResource>.from(map['startAnimations']
.map((e) => AndroidResource.fromMap(e?.cast<String, dynamic>())!))
: null,
toolbarBackgroundColor: map['toolbarBackgroundColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarBackgroundColor'])
: null,
);
instance.shareState =
CustomTabsShareState.fromNativeValue(map['shareState']);
instance.showTitle = map['showTitle'];
instance.enableUrlBarHiding = map['enableUrlBarHiding'];
instance.instantAppsEnabled = map['instantAppsEnabled'];
instance.keepAliveEnabled = map['keepAliveEnabled'];
instance.isSingleInstance = map['isSingleInstance'];
instance.noHistory = map['noHistory'];
instance.isTrustedWebActivity = map['isTrustedWebActivity'];
instance.additionalTrustedOrigins =
map['additionalTrustedOrigins']?.cast<String>();
instance.screenOrientation =
TrustedWebActivityScreenOrientation.fromNativeValue(
map['screenOrientation']);
instance.alwaysUseBrowserUI = map['alwaysUseBrowserUI'];
instance.entersReaderIfAvailable = map['entersReaderIfAvailable'];
instance.barCollapsingEnabled = map['barCollapsingEnabled'];
instance.dismissButtonStyle =
DismissButtonStyle.fromNativeValue(map['dismissButtonStyle']);
instance.enableUrlBarHiding = map['enableUrlBarHiding'];
instance.entersReaderIfAvailable = map['entersReaderIfAvailable'];
instance.instantAppsEnabled = map['instantAppsEnabled'];
instance.isSingleInstance = map['isSingleInstance'];
instance.isTrustedWebActivity = map['isTrustedWebActivity'];
instance.keepAliveEnabled = map['keepAliveEnabled'];
instance.noHistory = map['noHistory'];
instance.presentationStyle =
ModalPresentationStyle.fromNativeValue(map['presentationStyle']);
instance.screenOrientation =
TrustedWebActivityScreenOrientation.fromNativeValue(
map['screenOrientation']);
instance.shareState =
CustomTabsShareState.fromNativeValue(map['shareState']);
instance.showTitle = map['showTitle'];
instance.transitionStyle =
ModalTransitionStyle.fromNativeValue(map['transitionStyle']);
return instance;
@ -319,34 +319,34 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"shareState": shareState?.toNativeValue(),
"showTitle": showTitle,
"toolbarBackgroundColor": toolbarBackgroundColor?.toHex(),
"navigationBarColor": navigationBarColor?.toHex(),
"navigationBarDividerColor": navigationBarDividerColor?.toHex(),
"secondaryToolbarColor": secondaryToolbarColor?.toHex(),
"enableUrlBarHiding": enableUrlBarHiding,
"instantAppsEnabled": instantAppsEnabled,
"packageName": packageName,
"keepAliveEnabled": keepAliveEnabled,
"isSingleInstance": isSingleInstance,
"noHistory": noHistory,
"isTrustedWebActivity": isTrustedWebActivity,
"activityButton": activityButton?.toMap(),
"additionalTrustedOrigins": additionalTrustedOrigins,
"displayMode": displayMode?.toMap(),
"screenOrientation": screenOrientation?.toNativeValue(),
"startAnimations": startAnimations?.map((e) => e.toMap()).toList(),
"exitAnimations": exitAnimations?.map((e) => e.toMap()).toList(),
"alwaysUseBrowserUI": alwaysUseBrowserUI,
"entersReaderIfAvailable": entersReaderIfAvailable,
"barCollapsingEnabled": barCollapsingEnabled,
"dismissButtonStyle": dismissButtonStyle?.toNativeValue(),
"displayMode": displayMode?.toMap(),
"enableUrlBarHiding": enableUrlBarHiding,
"entersReaderIfAvailable": entersReaderIfAvailable,
"eventAttribution": eventAttribution?.toMap(),
"exitAnimations": exitAnimations?.map((e) => e.toMap()).toList(),
"instantAppsEnabled": instantAppsEnabled,
"isSingleInstance": isSingleInstance,
"isTrustedWebActivity": isTrustedWebActivity,
"keepAliveEnabled": keepAliveEnabled,
"navigationBarColor": navigationBarColor?.toHex(),
"navigationBarDividerColor": navigationBarDividerColor?.toHex(),
"noHistory": noHistory,
"packageName": packageName,
"preferredBarTintColor": preferredBarTintColor?.toHex(),
"preferredControlTintColor": preferredControlTintColor?.toHex(),
"presentationStyle": presentationStyle?.toNativeValue(),
"screenOrientation": screenOrientation?.toNativeValue(),
"secondaryToolbarColor": secondaryToolbarColor?.toHex(),
"shareState": shareState?.toNativeValue(),
"showTitle": showTitle,
"startAnimations": startAnimations?.map((e) => e.toMap()).toList(),
"toolbarBackgroundColor": toolbarBackgroundColor?.toHex(),
"transitionStyle": transitionStyle?.toNativeValue(),
"activityButton": activityButton?.toMap(),
"eventAttribution": eventAttribution?.toMap(),
};
}
@ -363,6 +363,6 @@ class ChromeSafariBrowserSettings implements ChromeSafariBrowserOptions {
@override
String toString() {
return 'ChromeSafariBrowserSettings{shareState: $shareState, showTitle: $showTitle, toolbarBackgroundColor: $toolbarBackgroundColor, navigationBarColor: $navigationBarColor, navigationBarDividerColor: $navigationBarDividerColor, secondaryToolbarColor: $secondaryToolbarColor, enableUrlBarHiding: $enableUrlBarHiding, instantAppsEnabled: $instantAppsEnabled, packageName: $packageName, keepAliveEnabled: $keepAliveEnabled, isSingleInstance: $isSingleInstance, noHistory: $noHistory, isTrustedWebActivity: $isTrustedWebActivity, additionalTrustedOrigins: $additionalTrustedOrigins, displayMode: $displayMode, screenOrientation: $screenOrientation, startAnimations: $startAnimations, exitAnimations: $exitAnimations, alwaysUseBrowserUI: $alwaysUseBrowserUI, entersReaderIfAvailable: $entersReaderIfAvailable, barCollapsingEnabled: $barCollapsingEnabled, dismissButtonStyle: $dismissButtonStyle, preferredBarTintColor: $preferredBarTintColor, preferredControlTintColor: $preferredControlTintColor, presentationStyle: $presentationStyle, transitionStyle: $transitionStyle, activityButton: $activityButton, eventAttribution: $eventAttribution}';
return 'ChromeSafariBrowserSettings{activityButton: $activityButton, additionalTrustedOrigins: $additionalTrustedOrigins, alwaysUseBrowserUI: $alwaysUseBrowserUI, barCollapsingEnabled: $barCollapsingEnabled, dismissButtonStyle: $dismissButtonStyle, displayMode: $displayMode, enableUrlBarHiding: $enableUrlBarHiding, entersReaderIfAvailable: $entersReaderIfAvailable, eventAttribution: $eventAttribution, exitAnimations: $exitAnimations, instantAppsEnabled: $instantAppsEnabled, isSingleInstance: $isSingleInstance, isTrustedWebActivity: $isTrustedWebActivity, keepAliveEnabled: $keepAliveEnabled, navigationBarColor: $navigationBarColor, navigationBarDividerColor: $navigationBarDividerColor, noHistory: $noHistory, packageName: $packageName, preferredBarTintColor: $preferredBarTintColor, preferredControlTintColor: $preferredControlTintColor, presentationStyle: $presentationStyle, screenOrientation: $screenOrientation, secondaryToolbarColor: $secondaryToolbarColor, shareState: $shareState, showTitle: $showTitle, startAnimations: $startAnimations, toolbarBackgroundColor: $toolbarBackgroundColor, transitionStyle: $transitionStyle}';
}
}

View File

@ -9,6 +9,30 @@ part of 'in_app_browser_settings.dart';
///This class represents all [InAppBrowser] settings available.
class InAppBrowserSettings
implements BrowserOptions, AndroidOptions, IosOptions {
///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? allowGoBackWithBackButton;
///Set the custom text for the close button.
///
///**Supported Platforms/Implementations**:
///- iOS
String? closeButtonCaption;
///Set the custom color for the close button.
///
///**Supported Platforms/Implementations**:
///- iOS
Color? closeButtonColor;
///Set to `false` to not close the InAppBrowser when the user click on the Android back button and the WebView cannot go back to the history. The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? closeOnCannotGoBack;
///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`.
///
@ -18,30 +42,6 @@ class InAppBrowserSettings
///- MacOS
bool? hidden;
///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
bool? hideToolbarTop;
///Set the custom background color of the toolbar at the top.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
Color? toolbarTopBackgroundColor;
///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
bool? hideUrlBar;
///Set to `true` to hide the progress bar when the WebView is loading a page. The default value is `false`.
///
///**Supported Platforms/Implementations**:
@ -56,24 +56,33 @@ class InAppBrowserSettings
///- Android native WebView
bool? hideTitleBar;
///Set the action bar's title.
///Set to `true` to hide the toolbar at the bottom of the WebView. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? hideToolbarBottom;
///Set to `true` to hide the toolbar at the top of the WebView. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
String? toolbarTopFixedTitle;
bool? hideToolbarTop;
///Set to `false` to not close the InAppBrowser when the user click on the Android back button and the WebView cannot go back to the history. The default value is `true`.
///Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? closeOnCannotGoBack;
///- iOS
///- MacOS
bool? hideUrlBar;
///Set to `false` to block the InAppBrowser WebView going back when the user click on the Android back button. The default value is `true`.
///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? allowGoBackWithBackButton;
///- iOS
ModalPresentationStyle? presentationStyle;
///Set to `true` to close the InAppBrowser when the user click on the Android back button. The default value is `false`.
///
@ -81,30 +90,6 @@ class InAppBrowserSettings
///- Android native WebView
bool? shouldCloseOnBackButtonPressed;
///Set to `true` to set the toolbar at the top translucent. The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? toolbarTopTranslucent;
///Set the tint color to apply to the navigation bar background.
///
///**Supported Platforms/Implementations**:
///- iOS
Color? toolbarTopBarTintColor;
///Set the tint color to apply to the navigation items and bar button items.
///
///**Supported Platforms/Implementations**:
///- iOS
Color? toolbarTopTintColor;
///Set to `true` to hide the toolbar at the bottom of the WebView. The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? hideToolbarBottom;
///Set the custom background color of the toolbar at the bottom.
///
///**Supported Platforms/Implementations**:
@ -123,23 +108,38 @@ class InAppBrowserSettings
///- iOS
bool? toolbarBottomTranslucent;
///Set the custom text for the close button.
///Set the custom background color of the toolbar at the top.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
String? closeButtonCaption;
///- MacOS
Color? toolbarTopBackgroundColor;
///Set the custom color for the close button.
///Set the tint color to apply to the navigation bar background.
///
///**Supported Platforms/Implementations**:
///- iOS
Color? closeButtonColor;
Color? toolbarTopBarTintColor;
///Set the custom modal presentation style when presenting the WebView. The default value is [ModalPresentationStyle.FULL_SCREEN].
///Set the action bar's title.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- MacOS
String? toolbarTopFixedTitle;
///Set the tint color to apply to the navigation items and bar button items.
///
///**Supported Platforms/Implementations**:
///- iOS
ModalPresentationStyle? presentationStyle;
Color? toolbarTopTintColor;
///Set to `true` to set the toolbar at the top translucent. The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? toolbarTopTranslucent;
///Set to the custom transition style when presenting the WebView. The default value is [ModalTransitionStyle.COVER_VERTICAL].
///
@ -147,13 +147,6 @@ class InAppBrowserSettings
///- iOS
ModalTransitionStyle? transitionStyle;
///How the browser window should be added to the main window.
///The default value is [WindowType.CHILD].
///
///**Supported Platforms/Implementations**:
///- MacOS
WindowType? windowType;
///The windows alpha value.
///The default value is `1.0`.
///
@ -161,6 +154,13 @@ class InAppBrowserSettings
///- MacOS
double? windowAlphaValue;
///Sets the origin and size of the windows frame rectangle according to a given frame rectangle,
///thereby setting its position and size onscreen.
///
///**Supported Platforms/Implementations**:
///- MacOS
InAppWebViewRect? windowFrame;
///Flags that describe the windows current style, such as if its resizable or in full-screen mode.
///
///**Supported Platforms/Implementations**:
@ -175,38 +175,38 @@ class InAppBrowserSettings
///- MacOS
WindowTitlebarSeparatorStyle? windowTitlebarSeparatorStyle;
///Sets the origin and size of the windows frame rectangle according to a given frame rectangle,
///thereby setting its position and size onscreen.
///How the browser window should be added to the main window.
///The default value is [WindowType.CHILD].
///
///**Supported Platforms/Implementations**:
///- MacOS
InAppWebViewRect? windowFrame;
WindowType? windowType;
InAppBrowserSettings(
{this.hidden = false,
this.hideToolbarTop = false,
this.toolbarTopBackgroundColor,
this.hideUrlBar = false,
{this.allowGoBackWithBackButton = true,
this.closeButtonCaption,
this.closeButtonColor,
this.closeOnCannotGoBack = true,
this.hidden = false,
this.hideProgressBar = false,
this.hideTitleBar = false,
this.toolbarTopFixedTitle,
this.closeOnCannotGoBack = true,
this.allowGoBackWithBackButton = true,
this.shouldCloseOnBackButtonPressed = false,
this.toolbarTopTranslucent = true,
this.toolbarTopTintColor,
this.hideToolbarBottom = false,
this.hideToolbarTop = false,
this.hideUrlBar = false,
this.presentationStyle = ModalPresentationStyle.FULL_SCREEN,
this.shouldCloseOnBackButtonPressed = false,
this.toolbarBottomBackgroundColor,
this.toolbarBottomTintColor,
this.toolbarBottomTranslucent = true,
this.closeButtonCaption,
this.closeButtonColor,
this.presentationStyle = ModalPresentationStyle.FULL_SCREEN,
this.toolbarTopBackgroundColor,
this.toolbarTopFixedTitle,
this.toolbarTopTintColor,
this.toolbarTopTranslucent = true,
this.transitionStyle = ModalTransitionStyle.COVER_VERTICAL,
this.windowType,
this.windowAlphaValue = 1.0,
this.windowFrame,
this.windowStyleMask,
this.windowTitlebarSeparatorStyle,
this.windowFrame});
this.windowType});
///Gets a possible [InAppBrowserSettings] instance from a [Map] value.
static InAppBrowserSettings? fromMap(Map<String, dynamic>? map) {
@ -214,12 +214,9 @@ class InAppBrowserSettings
return null;
}
final instance = InAppBrowserSettings(
toolbarTopBackgroundColor: map['toolbarTopBackgroundColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarTopBackgroundColor'])
: null,
toolbarTopFixedTitle: map['toolbarTopFixedTitle'],
toolbarTopTintColor: map['toolbarTopTintColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarTopTintColor'])
closeButtonCaption: map['closeButtonCaption'],
closeButtonColor: map['closeButtonColor'] != null
? UtilColor.fromStringRepresentation(map['closeButtonColor'])
: null,
toolbarBottomBackgroundColor: map['toolbarBottomBackgroundColor'] != null
? UtilColor.fromStringRepresentation(
@ -228,35 +225,38 @@ class InAppBrowserSettings
toolbarBottomTintColor: map['toolbarBottomTintColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarBottomTintColor'])
: null,
closeButtonCaption: map['closeButtonCaption'],
closeButtonColor: map['closeButtonColor'] != null
? UtilColor.fromStringRepresentation(map['closeButtonColor'])
toolbarTopBackgroundColor: map['toolbarTopBackgroundColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarTopBackgroundColor'])
: null,
windowType: WindowType.fromNativeValue(map['windowType']),
toolbarTopFixedTitle: map['toolbarTopFixedTitle'],
toolbarTopTintColor: map['toolbarTopTintColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarTopTintColor'])
: null,
windowFrame:
InAppWebViewRect.fromMap(map['windowFrame']?.cast<String, dynamic>()),
windowStyleMask: WindowStyleMask.fromNativeValue(map['windowStyleMask']),
windowTitlebarSeparatorStyle:
WindowTitlebarSeparatorStyle.fromNativeValue(
map['windowTitlebarSeparatorStyle']),
windowFrame:
InAppWebViewRect.fromMap(map['windowFrame']?.cast<String, dynamic>()),
windowType: WindowType.fromNativeValue(map['windowType']),
);
instance.allowGoBackWithBackButton = map['allowGoBackWithBackButton'];
instance.closeOnCannotGoBack = map['closeOnCannotGoBack'];
instance.hidden = map['hidden'];
instance.hideToolbarTop = map['hideToolbarTop'];
instance.hideUrlBar = map['hideUrlBar'];
instance.hideProgressBar = map['hideProgressBar'];
instance.hideTitleBar = map['hideTitleBar'];
instance.closeOnCannotGoBack = map['closeOnCannotGoBack'];
instance.allowGoBackWithBackButton = map['allowGoBackWithBackButton'];
instance.hideToolbarBottom = map['hideToolbarBottom'];
instance.hideToolbarTop = map['hideToolbarTop'];
instance.hideUrlBar = map['hideUrlBar'];
instance.presentationStyle =
ModalPresentationStyle.fromNativeValue(map['presentationStyle']);
instance.shouldCloseOnBackButtonPressed =
map['shouldCloseOnBackButtonPressed'];
instance.toolbarTopTranslucent = map['toolbarTopTranslucent'];
instance.toolbarBottomTranslucent = map['toolbarBottomTranslucent'];
instance.toolbarTopBarTintColor = map['toolbarTopBarTintColor'] != null
? UtilColor.fromStringRepresentation(map['toolbarTopBarTintColor'])
: null;
instance.hideToolbarBottom = map['hideToolbarBottom'];
instance.toolbarBottomTranslucent = map['toolbarBottomTranslucent'];
instance.presentationStyle =
ModalPresentationStyle.fromNativeValue(map['presentationStyle']);
instance.toolbarTopTranslucent = map['toolbarTopTranslucent'];
instance.transitionStyle =
ModalTransitionStyle.fromNativeValue(map['transitionStyle']);
instance.windowAlphaValue = map['windowAlphaValue'];
@ -266,33 +266,33 @@ class InAppBrowserSettings
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"allowGoBackWithBackButton": allowGoBackWithBackButton,
"closeButtonCaption": closeButtonCaption,
"closeButtonColor": closeButtonColor?.toHex(),
"closeOnCannotGoBack": closeOnCannotGoBack,
"hidden": hidden,
"hideToolbarTop": hideToolbarTop,
"toolbarTopBackgroundColor": toolbarTopBackgroundColor?.toHex(),
"hideUrlBar": hideUrlBar,
"hideProgressBar": hideProgressBar,
"hideTitleBar": hideTitleBar,
"toolbarTopFixedTitle": toolbarTopFixedTitle,
"closeOnCannotGoBack": closeOnCannotGoBack,
"allowGoBackWithBackButton": allowGoBackWithBackButton,
"shouldCloseOnBackButtonPressed": shouldCloseOnBackButtonPressed,
"toolbarTopTranslucent": toolbarTopTranslucent,
"toolbarTopBarTintColor": toolbarTopBarTintColor?.toHex(),
"toolbarTopTintColor": toolbarTopTintColor?.toHex(),
"hideToolbarBottom": hideToolbarBottom,
"hideToolbarTop": hideToolbarTop,
"hideUrlBar": hideUrlBar,
"presentationStyle": presentationStyle?.toNativeValue(),
"shouldCloseOnBackButtonPressed": shouldCloseOnBackButtonPressed,
"toolbarBottomBackgroundColor": toolbarBottomBackgroundColor?.toHex(),
"toolbarBottomTintColor": toolbarBottomTintColor?.toHex(),
"toolbarBottomTranslucent": toolbarBottomTranslucent,
"closeButtonCaption": closeButtonCaption,
"closeButtonColor": closeButtonColor?.toHex(),
"presentationStyle": presentationStyle?.toNativeValue(),
"toolbarTopBackgroundColor": toolbarTopBackgroundColor?.toHex(),
"toolbarTopBarTintColor": toolbarTopBarTintColor?.toHex(),
"toolbarTopFixedTitle": toolbarTopFixedTitle,
"toolbarTopTintColor": toolbarTopTintColor?.toHex(),
"toolbarTopTranslucent": toolbarTopTranslucent,
"transitionStyle": transitionStyle?.toNativeValue(),
"windowType": windowType?.toNativeValue(),
"windowAlphaValue": windowAlphaValue,
"windowFrame": windowFrame?.toMap(),
"windowStyleMask": windowStyleMask?.toNativeValue(),
"windowTitlebarSeparatorStyle":
windowTitlebarSeparatorStyle?.toNativeValue(),
"windowFrame": windowFrame?.toMap(),
"windowType": windowType?.toNativeValue(),
};
}
@ -308,6 +308,6 @@ class InAppBrowserSettings
@override
String toString() {
return 'InAppBrowserSettings{hidden: $hidden, hideToolbarTop: $hideToolbarTop, toolbarTopBackgroundColor: $toolbarTopBackgroundColor, hideUrlBar: $hideUrlBar, hideProgressBar: $hideProgressBar, hideTitleBar: $hideTitleBar, toolbarTopFixedTitle: $toolbarTopFixedTitle, closeOnCannotGoBack: $closeOnCannotGoBack, allowGoBackWithBackButton: $allowGoBackWithBackButton, shouldCloseOnBackButtonPressed: $shouldCloseOnBackButtonPressed, toolbarTopTranslucent: $toolbarTopTranslucent, toolbarTopBarTintColor: $toolbarTopBarTintColor, toolbarTopTintColor: $toolbarTopTintColor, hideToolbarBottom: $hideToolbarBottom, toolbarBottomBackgroundColor: $toolbarBottomBackgroundColor, toolbarBottomTintColor: $toolbarBottomTintColor, toolbarBottomTranslucent: $toolbarBottomTranslucent, closeButtonCaption: $closeButtonCaption, closeButtonColor: $closeButtonColor, presentationStyle: $presentationStyle, transitionStyle: $transitionStyle, windowType: $windowType, windowAlphaValue: $windowAlphaValue, windowStyleMask: $windowStyleMask, windowTitlebarSeparatorStyle: $windowTitlebarSeparatorStyle, windowFrame: $windowFrame}';
return 'InAppBrowserSettings{allowGoBackWithBackButton: $allowGoBackWithBackButton, closeButtonCaption: $closeButtonCaption, closeButtonColor: $closeButtonColor, closeOnCannotGoBack: $closeOnCannotGoBack, hidden: $hidden, hideProgressBar: $hideProgressBar, hideTitleBar: $hideTitleBar, hideToolbarBottom: $hideToolbarBottom, hideToolbarTop: $hideToolbarTop, hideUrlBar: $hideUrlBar, presentationStyle: $presentationStyle, shouldCloseOnBackButtonPressed: $shouldCloseOnBackButtonPressed, toolbarBottomBackgroundColor: $toolbarBottomBackgroundColor, toolbarBottomTintColor: $toolbarBottomTintColor, toolbarBottomTranslucent: $toolbarBottomTranslucent, toolbarTopBackgroundColor: $toolbarTopBackgroundColor, toolbarTopBarTintColor: $toolbarTopBarTintColor, toolbarTopFixedTitle: $toolbarTopFixedTitle, toolbarTopTintColor: $toolbarTopTintColor, toolbarTopTranslucent: $toolbarTopTranslucent, transitionStyle: $transitionStyle, windowAlphaValue: $windowAlphaValue, windowFrame: $windowFrame, windowStyleMask: $windowStyleMask, windowTitlebarSeparatorStyle: $windowTitlebarSeparatorStyle, windowType: $windowType}';
}
}

View File

@ -17,6 +17,7 @@ import '../pull_to_refresh/pull_to_refresh_controller.dart';
import '../pull_to_refresh/pull_to_refresh_settings.dart';
import '../types/disposable.dart';
///{@template flutter_inappwebview.HeadlessInAppWebView}
///Class that represents a WebView in headless mode.
///It can be used to run a WebView in background without attaching an `InAppWebView` to the widget tree.
///
@ -27,6 +28,7 @@ import '../types/disposable.dart';
///- iOS
///- Web
///- MacOS
///{@endtemplate}
class HeadlessInAppWebView implements WebView, Disposable {
///View ID.
late final String id;
@ -41,7 +43,7 @@ class HeadlessInAppWebView implements WebView, Disposable {
///WebView Controller that can be used to access the [InAppWebViewController] API.
late final InAppWebViewController webViewController;
///The window id of a [CreateWindowAction.windowId].
///{@macro flutter_inappwebview.WebView.windowId}
final int? windowId;
///The WebView initial size in pixels.
@ -50,8 +52,15 @@ class HeadlessInAppWebView implements WebView, Disposable {
///`Size(-1, -1)` will match both width and height of the current device screen size.
///
///**NOTE for Android**: `Size` width and height values will be converted to `int` values because they cannot have `double` values.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- Web
///- MacOS
final Size initialSize;
///{@macro flutter_inappwebview.HeadlessInAppWebView}
HeadlessInAppWebView(
{this.initialSize = const Size(-1, -1),
this.windowId,
@ -357,34 +366,44 @@ class HeadlessInAppWebView implements WebView, Disposable {
return MapSize.fromMap(sizeMap);
}
///{@macro flutter_inappwebview.WebView.initialData}
@override
final InAppWebViewInitialData? initialData;
///{@macro flutter_inappwebview.WebView.initialFile}
@override
final String? initialFile;
///Use [initialSettings] instead.
@override
@Deprecated('Use initialSettings instead')
final InAppWebViewGroupOptions? initialOptions;
///{@macro flutter_inappwebview.WebView.initialSettings}
@override
final InAppWebViewSettings? initialSettings;
///{@macro flutter_inappwebview.WebView.contextMenu}
@override
final ContextMenu? contextMenu;
///{@macro flutter_inappwebview.WebView.initialUrlRequest}
@override
final URLRequest? initialUrlRequest;
///{@macro flutter_inappwebview.WebView.initialUserScripts}
@override
final UnmodifiableListView<UserScript>? initialUserScripts;
///{@macro flutter_inappwebview.WebView.pullToRefreshController}
@override
final PullToRefreshController? pullToRefreshController;
///{@macro flutter_inappwebview.WebView.findInteractionController}
@override
final FindInteractionController? findInteractionController;
///{@macro flutter_inappwebview.WebView.implementation}
@override
final WebViewImplementation implementation;
@ -413,10 +432,12 @@ class HeadlessInAppWebView implements WebView, Disposable {
Future<SafeBrowsingResponse?> Function(InAppWebViewController controller,
Uri url, SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit;
///{@macro flutter_inappwebview.WebView.onPageCommitVisible}
@override
void Function(InAppWebViewController controller, WebUri? url)?
onPageCommitVisible;
///{@macro flutter_inappwebview.WebView.onTitleChanged}
@override
void Function(InAppWebViewController controller, String? title)?
onTitleChanged;
@ -447,31 +468,38 @@ class HeadlessInAppWebView implements WebView, Disposable {
InAppWebViewController controller,
URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS;
///{@macro flutter_inappwebview.WebView.onAjaxProgress}
@override
Future<AjaxRequestAction> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)?
onAjaxProgress;
///{@macro flutter_inappwebview.WebView.onAjaxReadyStateChange}
@override
Future<AjaxRequestAction?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)?
onAjaxReadyStateChange;
///{@macro flutter_inappwebview.WebView.onConsoleMessage}
@override
void Function(
InAppWebViewController controller, ConsoleMessage consoleMessage)?
onConsoleMessage;
///{@macro flutter_inappwebview.WebView.onCreateWindow}
@override
Future<bool?> Function(InAppWebViewController controller,
CreateWindowAction createWindowAction)? onCreateWindow;
///{@macro flutter_inappwebview.WebView.onCloseWindow}
@override
void Function(InAppWebViewController controller)? onCloseWindow;
///{@macro flutter_inappwebview.WebView.onWindowFocus}
@override
void Function(InAppWebViewController controller)? onWindowFocus;
///{@macro flutter_inappwebview.WebView.onWindowBlur}
@override
void Function(InAppWebViewController controller)? onWindowBlur;
@ -480,6 +508,7 @@ class HeadlessInAppWebView implements WebView, Disposable {
@override
void Function(InAppWebViewController controller, Uri url)? onDownloadStart;
///{@macro flutter_inappwebview.WebView.onDownloadStartRequest}
@override
void Function(InAppWebViewController controller,
DownloadStartRequest downloadStartRequest)? onDownloadStartRequest;
@ -490,16 +519,19 @@ class HeadlessInAppWebView implements WebView, Disposable {
void Function(InAppWebViewController controller, int activeMatchOrdinal,
int numberOfMatches, bool isDoneCounting)? onFindResultReceived;
///{@macro flutter_inappwebview.WebView.onJsAlert}
@override
Future<JsAlertResponse?> Function(
InAppWebViewController controller, JsAlertRequest jsAlertRequest)?
onJsAlert;
///{@macro flutter_inappwebview.WebView.onJsConfirm}
@override
Future<JsConfirmResponse?> Function(
InAppWebViewController controller, JsConfirmRequest jsConfirmRequest)?
onJsConfirm;
///{@macro flutter_inappwebview.WebView.onJsPrompt}
@override
Future<JsPromptResponse?> Function(
InAppWebViewController controller, JsPromptRequest jsPromptRequest)?
@ -511,6 +543,7 @@ class HeadlessInAppWebView implements WebView, Disposable {
void Function(InAppWebViewController controller, Uri? url, int code,
String message)? onLoadError;
///{@macro flutter_inappwebview.WebView.onReceivedError}
@override
void Function(InAppWebViewController controller, WebResourceRequest request,
WebResourceError error)? onReceivedError;
@ -521,9 +554,12 @@ class HeadlessInAppWebView implements WebView, Disposable {
void Function(InAppWebViewController controller, Uri? url, int statusCode,
String description)? onLoadHttpError;
///{@macro flutter_inappwebview.WebView.onReceivedHttpError}
@override
void Function(InAppWebViewController controller, WebResourceRequest request,
WebResourceResponse errorResponse)? onReceivedHttpError;
///{@macro flutter_inappwebview.WebView.onLoadResource}
@override
void Function(InAppWebViewController controller, LoadedResource resource)?
onLoadResource;
@ -534,17 +570,21 @@ class HeadlessInAppWebView implements WebView, Disposable {
Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, Uri url)? onLoadResourceCustomScheme;
///{@macro flutter_inappwebview.WebView.onLoadResourceWithCustomScheme}
@override
Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, WebResourceRequest request)?
onLoadResourceWithCustomScheme;
///{@macro flutter_inappwebview.WebView.onLoadStart}
@override
void Function(InAppWebViewController controller, WebUri? url)? onLoadStart;
///{@macro flutter_inappwebview.WebView.onLoadStop}
@override
void Function(InAppWebViewController controller, WebUri? url)? onLoadStop;
///{@macro flutter_inappwebview.WebView.onLongPressHitTestResult}
@override
void Function(InAppWebViewController controller,
InAppWebViewHitTestResult hitTestResult)? onLongPressHitTestResult;
@ -554,62 +594,77 @@ class HeadlessInAppWebView implements WebView, Disposable {
@override
void Function(InAppWebViewController controller, Uri? url)? onPrint;
///{@macro flutter_inappwebview.WebView.onPrintRequest}
@override
Future<bool?> Function(InAppWebViewController controller, WebUri? url,
PrintJobController? printJobController)? onPrintRequest;
///{@macro flutter_inappwebview.WebView.onProgressChanged}
@override
void Function(InAppWebViewController controller, int progress)?
onProgressChanged;
///{@macro flutter_inappwebview.WebView.onReceivedClientCertRequest}
@override
Future<ClientCertResponse?> Function(InAppWebViewController controller,
URLAuthenticationChallenge challenge)? onReceivedClientCertRequest;
///{@macro flutter_inappwebview.WebView.onReceivedHttpAuthRequest}
@override
Future<HttpAuthResponse?> Function(InAppWebViewController controller,
URLAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
///{@macro flutter_inappwebview.WebView.onReceivedServerTrustAuthRequest}
@override
Future<ServerTrustAuthResponse?> Function(InAppWebViewController controller,
URLAuthenticationChallenge challenge)? onReceivedServerTrustAuthRequest;
///{@macro flutter_inappwebview.WebView.onScrollChanged}
@override
void Function(InAppWebViewController controller, int x, int y)?
onScrollChanged;
///{@macro flutter_inappwebview.WebView.onUpdateVisitedHistory}
@override
void Function(InAppWebViewController controller, WebUri? url, bool? isReload)?
onUpdateVisitedHistory;
///{@macro flutter_inappwebview.WebView.onWebViewCreated}
@override
void Function(InAppWebViewController controller)? onWebViewCreated;
///{@macro flutter_inappwebview.WebView.shouldInterceptAjaxRequest}
@override
Future<AjaxRequest?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)?
shouldInterceptAjaxRequest;
///{@macro flutter_inappwebview.WebView.shouldInterceptFetchRequest}
@override
Future<FetchRequest?> Function(
InAppWebViewController controller, FetchRequest fetchRequest)?
shouldInterceptFetchRequest;
///{@macro flutter_inappwebview.WebView.shouldOverrideUrlLoading}
@override
Future<NavigationActionPolicy?> Function(
InAppWebViewController controller, NavigationAction navigationAction)?
shouldOverrideUrlLoading;
///{@macro flutter_inappwebview.WebView.onEnterFullscreen}
@override
void Function(InAppWebViewController controller)? onEnterFullscreen;
///{@macro flutter_inappwebview.WebView.onExitFullscreen}
@override
void Function(InAppWebViewController controller)? onExitFullscreen;
///{@macro flutter_inappwebview.WebView.onOverScrolled}
@override
void Function(InAppWebViewController controller, int x, int y, bool clampedX,
bool clampedY)? onOverScrolled;
///{@macro flutter_inappwebview.WebView.onZoomScaleChanged}
@override
void Function(
InAppWebViewController controller, double oldScale, double newScale)?
@ -680,88 +735,108 @@ class HeadlessInAppWebView implements WebView, Disposable {
void Function(InAppWebViewController controller, LoginRequest loginRequest)?
androidOnReceivedLoginRequest;
///{@macro flutter_inappwebview.WebView.onDidReceiveServerRedirectForProvisionalNavigation}
@override
void Function(InAppWebViewController controller)?
onDidReceiveServerRedirectForProvisionalNavigation;
///{@macro flutter_inappwebview.WebView.onFormResubmission}
@override
Future<FormResubmissionAction?> Function(
InAppWebViewController controller, WebUri? url)? onFormResubmission;
///{@macro flutter_inappwebview.WebView.onGeolocationPermissionsHidePrompt}
@override
void Function(InAppWebViewController controller)?
onGeolocationPermissionsHidePrompt;
///{@macro flutter_inappwebview.WebView.onGeolocationPermissionsShowPrompt}
@override
Future<GeolocationPermissionShowPromptResponse?> Function(
InAppWebViewController controller, String origin)?
onGeolocationPermissionsShowPrompt;
///{@macro flutter_inappwebview.WebView.onJsBeforeUnload}
@override
Future<JsBeforeUnloadResponse?> Function(InAppWebViewController controller,
JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload;
///{@macro flutter_inappwebview.WebView.onNavigationResponse}
@override
Future<NavigationResponseAction?> Function(InAppWebViewController controller,
NavigationResponse navigationResponse)? onNavigationResponse;
///{@macro flutter_inappwebview.WebView.onPermissionRequest}
@override
Future<PermissionResponse?> Function(InAppWebViewController controller,
PermissionRequest permissionRequest)? onPermissionRequest;
///{@macro flutter_inappwebview.WebView.onReceivedIcon}
@override
void Function(InAppWebViewController controller, Uint8List icon)?
onReceivedIcon;
///{@macro flutter_inappwebview.WebView.onReceivedLoginRequest}
@override
void Function(InAppWebViewController controller, LoginRequest loginRequest)?
onReceivedLoginRequest;
///{@macro flutter_inappwebview.WebView.onPermissionRequestCanceled}
@override
final void Function(InAppWebViewController controller,
void Function(InAppWebViewController controller,
PermissionRequest permissionRequest)? onPermissionRequestCanceled;
///{@macro flutter_inappwebview.WebView.onRequestFocus}
@override
final void Function(InAppWebViewController controller)? onRequestFocus;
void Function(InAppWebViewController controller)? onRequestFocus;
///{@macro flutter_inappwebview.WebView.onReceivedTouchIconUrl}
@override
void Function(
InAppWebViewController controller, WebUri url, bool precomposed)?
onReceivedTouchIconUrl;
///{@macro flutter_inappwebview.WebView.onRenderProcessGone}
@override
void Function(
InAppWebViewController controller, RenderProcessGoneDetail detail)?
onRenderProcessGone;
///{@macro flutter_inappwebview.WebView.onRenderProcessResponsive}
@override
Future<WebViewRenderProcessAction?> Function(
InAppWebViewController controller, WebUri? url)?
onRenderProcessResponsive;
///{@macro flutter_inappwebview.WebView.onRenderProcessUnresponsive}
@override
Future<WebViewRenderProcessAction?> Function(
InAppWebViewController controller, WebUri? url)?
onRenderProcessUnresponsive;
///{@macro flutter_inappwebview.WebView.onSafeBrowsingHit}
@override
Future<SafeBrowsingResponse?> Function(InAppWebViewController controller,
WebUri url, SafeBrowsingThreat? threatType)? onSafeBrowsingHit;
///{@macro flutter_inappwebview.WebView.onWebContentProcessDidTerminate}
@override
void Function(InAppWebViewController controller)?
onWebContentProcessDidTerminate;
///{@macro flutter_inappwebview.WebView.shouldAllowDeprecatedTLS}
@override
Future<ShouldAllowDeprecatedTLSAction?> Function(
InAppWebViewController controller,
URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS;
///{@macro flutter_inappwebview.WebView.shouldInterceptRequest}
@override
Future<WebResourceResponse?> Function(
InAppWebViewController controller, WebResourceRequest request)?
shouldInterceptRequest;
///{@macro flutter_inappwebview.WebView.onCameraCaptureStateChanged}
@override
Future<void> Function(
InAppWebViewController controller,
@ -769,6 +844,7 @@ class HeadlessInAppWebView implements WebView, Disposable {
MediaCaptureState? newState,
)? onCameraCaptureStateChanged;
///{@macro flutter_inappwebview.WebView.onMicrophoneCaptureStateChanged}
@override
Future<void> Function(
InAppWebViewController controller,
@ -776,8 +852,9 @@ class HeadlessInAppWebView implements WebView, Disposable {
MediaCaptureState? newState,
)? onMicrophoneCaptureStateChanged;
///{@macro flutter_inappwebview.WebView.onContentSizeChanged}
@override
final void Function(InAppWebViewController controller, Size oldContentSize,
void Function(InAppWebViewController controller, Size oldContentSize,
Size newContentSize)? onContentSizeChanged;
}

View File

@ -24,12 +24,14 @@ import 'in_app_webview_controller.dart';
import 'in_app_webview_settings.dart';
import '../pull_to_refresh/main.dart';
///{@template flutter_inappwebview.InAppWebView}
///Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- Web
///{@endtemplate}
class InAppWebView extends StatefulWidget implements WebView {
/// `gestureRecognizers` specifies which gestures should be consumed by the WebView.
/// It is possible for other gesture recognizers to be competing with the web view on pointer
@ -40,11 +42,7 @@ class InAppWebView extends StatefulWidget implements WebView {
/// were not claimed by any other gesture recognizer.
final Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers;
///The window id of a [CreateWindowAction.windowId].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///{@macro flutter_inappwebview.WebView.windowId}
@override
final int? windowId;
@ -56,6 +54,7 @@ class InAppWebView extends StatefulWidget implements WebView {
///- Web
final HeadlessInAppWebView? headlessWebView;
///{@macro flutter_inappwebview.InAppWebView}
const InAppWebView({
Key? key,
this.windowId,
@ -202,9 +201,11 @@ class InAppWebView extends StatefulWidget implements WebView {
Uri url,
SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit;
///{@macro flutter_inappwebview.WebView.initialData}
@override
final InAppWebViewInitialData? initialData;
///{@macro flutter_inappwebview.WebView.initialFile}
@override
final String? initialFile;
@ -213,31 +214,40 @@ class InAppWebView extends StatefulWidget implements WebView {
@Deprecated('Use initialSettings instead')
final InAppWebViewGroupOptions? initialOptions;
///{@macro flutter_inappwebview.WebView.initialSettings}
@override
final InAppWebViewSettings? initialSettings;
///{@macro flutter_inappwebview.WebView.initialUrlRequest}
@override
final URLRequest? initialUrlRequest;
///{@macro flutter_inappwebview.WebView.implementation}
@override
final WebViewImplementation implementation;
///{@macro flutter_inappwebview.WebView.initialUserScripts}
@override
final UnmodifiableListView<UserScript>? initialUserScripts;
///{@macro flutter_inappwebview.WebView.pullToRefreshController}
@override
final PullToRefreshController? pullToRefreshController;
///{@macro flutter_inappwebview.WebView.findInteractionController}
@override
final FindInteractionController? findInteractionController;
///{@macro flutter_inappwebview.WebView.contextMenu}
@override
final ContextMenu? contextMenu;
///{@macro flutter_inappwebview.WebView.onPageCommitVisible}
@override
final void Function(InAppWebViewController controller, WebUri? url)?
onPageCommitVisible;
///{@macro flutter_inappwebview.WebView.onTitleChanged}
@override
final void Function(InAppWebViewController controller, String? title)?
onTitleChanged;
@ -268,31 +278,38 @@ class InAppWebView extends StatefulWidget implements WebView {
InAppWebViewController controller,
URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS;
///{@macro flutter_inappwebview.WebView.onAjaxProgress}
@override
final Future<AjaxRequestAction> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)?
onAjaxProgress;
///{@macro flutter_inappwebview.WebView.onAjaxReadyStateChange}
@override
final Future<AjaxRequestAction?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)?
onAjaxReadyStateChange;
///{@macro flutter_inappwebview.WebView.onConsoleMessage}
@override
final void Function(
InAppWebViewController controller, ConsoleMessage consoleMessage)?
onConsoleMessage;
///{@macro flutter_inappwebview.WebView.onCreateWindow}
@override
final Future<bool?> Function(InAppWebViewController controller,
CreateWindowAction createWindowAction)? onCreateWindow;
///{@macro flutter_inappwebview.WebView.onCloseWindow}
@override
final void Function(InAppWebViewController controller)? onCloseWindow;
///{@macro flutter_inappwebview.WebView.onWindowFocus}
@override
final void Function(InAppWebViewController controller)? onWindowFocus;
///{@macro flutter_inappwebview.WebView.onWindowBlur}
@override
final void Function(InAppWebViewController controller)? onWindowBlur;
@ -315,6 +332,7 @@ class InAppWebView extends StatefulWidget implements WebView {
final void Function(InAppWebViewController controller, Uri url)?
onDownloadStart;
///{@macro flutter_inappwebview.WebView.onDownloadStartRequest}
@override
final void Function(InAppWebViewController controller,
DownloadStartRequest downloadStartRequest)? onDownloadStartRequest;
@ -325,16 +343,19 @@ class InAppWebView extends StatefulWidget implements WebView {
final void Function(InAppWebViewController controller, int activeMatchOrdinal,
int numberOfMatches, bool isDoneCounting)? onFindResultReceived;
///{@macro flutter_inappwebview.WebView.onJsAlert}
@override
final Future<JsAlertResponse?> Function(
InAppWebViewController controller, JsAlertRequest jsAlertRequest)?
onJsAlert;
///{@macro flutter_inappwebview.WebView.onJsConfirm}
@override
final Future<JsConfirmResponse?> Function(
InAppWebViewController controller, JsConfirmRequest jsConfirmRequest)?
onJsConfirm;
///{@macro flutter_inappwebview.WebView.onJsPrompt}
@override
final Future<JsPromptResponse?> Function(
InAppWebViewController controller, JsPromptRequest jsPromptRequest)?
@ -346,6 +367,7 @@ class InAppWebView extends StatefulWidget implements WebView {
final void Function(InAppWebViewController controller, Uri? url, int code,
String message)? onLoadError;
///{@macro flutter_inappwebview.WebView.onReceivedError}
@override
final void Function(InAppWebViewController controller,
WebResourceRequest request, WebResourceError error)? onReceivedError;
@ -356,12 +378,14 @@ class InAppWebView extends StatefulWidget implements WebView {
final void Function(InAppWebViewController controller, Uri? url,
int statusCode, String description)? onLoadHttpError;
///{@macro flutter_inappwebview.WebView.onReceivedHttpError}
@override
final void Function(
InAppWebViewController controller,
WebResourceRequest request,
WebResourceResponse errorResponse)? onReceivedHttpError;
///{@macro flutter_inappwebview.WebView.onLoadResource}
@override
final void Function(
InAppWebViewController controller, LoadedResource resource)?
@ -373,19 +397,23 @@ class InAppWebView extends StatefulWidget implements WebView {
final Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, Uri url)? onLoadResourceCustomScheme;
///{@macro flutter_inappwebview.WebView.onLoadResourceWithCustomScheme}
@override
final Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, WebResourceRequest request)?
onLoadResourceWithCustomScheme;
///{@macro flutter_inappwebview.WebView.onLoadStart}
@override
final void Function(InAppWebViewController controller, WebUri? url)?
onLoadStart;
///{@macro flutter_inappwebview.WebView.onLoadStop}
@override
final void Function(InAppWebViewController controller, WebUri? url)?
onLoadStop;
///{@macro flutter_inappwebview.WebView.onLongPressHitTestResult}
@override
final void Function(InAppWebViewController controller,
InAppWebViewHitTestResult hitTestResult)? onLongPressHitTestResult;
@ -395,64 +423,79 @@ class InAppWebView extends StatefulWidget implements WebView {
@override
final void Function(InAppWebViewController controller, Uri? url)? onPrint;
///{@macro flutter_inappwebview.WebView.onPrintRequest}
@override
final Future<bool?> Function(InAppWebViewController controller, WebUri? url,
PrintJobController? printJobController)? onPrintRequest;
///{@macro flutter_inappwebview.WebView.onProgressChanged}
@override
final void Function(InAppWebViewController controller, int progress)?
onProgressChanged;
///{@macro flutter_inappwebview.WebView.onReceivedClientCertRequest}
@override
final Future<ClientCertResponse?> Function(InAppWebViewController controller,
URLAuthenticationChallenge challenge)? onReceivedClientCertRequest;
///{@macro flutter_inappwebview.WebView.onReceivedHttpAuthRequest}
@override
final Future<HttpAuthResponse?> Function(InAppWebViewController controller,
URLAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
///{@macro flutter_inappwebview.WebView.onReceivedServerTrustAuthRequest}
@override
final Future<ServerTrustAuthResponse?> Function(
InAppWebViewController controller,
URLAuthenticationChallenge challenge)? onReceivedServerTrustAuthRequest;
///{@macro flutter_inappwebview.WebView.onScrollChanged}
@override
final void Function(InAppWebViewController controller, int x, int y)?
onScrollChanged;
///{@macro flutter_inappwebview.WebView.onUpdateVisitedHistory}
@override
final void Function(
InAppWebViewController controller, WebUri? url, bool? isReload)?
onUpdateVisitedHistory;
///{@macro flutter_inappwebview.WebView.onWebViewCreated}
@override
final void Function(InAppWebViewController controller)? onWebViewCreated;
///{@macro flutter_inappwebview.WebView.shouldInterceptAjaxRequest}
@override
final Future<AjaxRequest?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)?
shouldInterceptAjaxRequest;
///{@macro flutter_inappwebview.WebView.shouldInterceptFetchRequest}
@override
final Future<FetchRequest?> Function(
InAppWebViewController controller, FetchRequest fetchRequest)?
shouldInterceptFetchRequest;
///{@macro flutter_inappwebview.WebView.shouldOverrideUrlLoading}
@override
final Future<NavigationActionPolicy?> Function(
InAppWebViewController controller, NavigationAction navigationAction)?
shouldOverrideUrlLoading;
///{@macro flutter_inappwebview.WebView.onEnterFullscreen}
@override
final void Function(InAppWebViewController controller)? onEnterFullscreen;
///{@macro flutter_inappwebview.WebView.onExitFullscreen}
@override
final void Function(InAppWebViewController controller)? onExitFullscreen;
///{@macro flutter_inappwebview.WebView.onOverScrolled}
@override
final void Function(InAppWebViewController controller, int x, int y,
bool clampedX, bool clampedY)? onOverScrolled;
///{@macro flutter_inappwebview.WebView.onZoomScaleChanged}
@override
final void Function(
InAppWebViewController controller, double oldScale, double newScale)?
@ -513,93 +556,113 @@ class InAppWebView extends StatefulWidget implements WebView {
InAppWebViewController controller, LoginRequest loginRequest)?
androidOnReceivedLoginRequest;
///{@macro flutter_inappwebview.WebView.onDidReceiveServerRedirectForProvisionalNavigation}
@override
final void Function(InAppWebViewController controller)?
onDidReceiveServerRedirectForProvisionalNavigation;
///{@macro flutter_inappwebview.WebView.onFormResubmission}
@override
final Future<FormResubmissionAction?> Function(
InAppWebViewController controller, WebUri? url)? onFormResubmission;
///{@macro flutter_inappwebview.WebView.onGeolocationPermissionsHidePrompt}
@override
final void Function(InAppWebViewController controller)?
onGeolocationPermissionsHidePrompt;
///{@macro flutter_inappwebview.WebView.onGeolocationPermissionsShowPrompt}
@override
final Future<GeolocationPermissionShowPromptResponse?> Function(
InAppWebViewController controller, String origin)?
onGeolocationPermissionsShowPrompt;
///{@macro flutter_inappwebview.WebView.onJsBeforeUnload}
@override
final Future<JsBeforeUnloadResponse?> Function(
InAppWebViewController controller,
JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload;
///{@macro flutter_inappwebview.WebView.onNavigationResponse}
@override
final Future<NavigationResponseAction?> Function(
InAppWebViewController controller,
NavigationResponse navigationResponse)? onNavigationResponse;
///{@macro flutter_inappwebview.WebView.onPermissionRequest}
@override
final Future<PermissionResponse?> Function(InAppWebViewController controller,
PermissionRequest permissionRequest)? onPermissionRequest;
///{@macro flutter_inappwebview.WebView.onReceivedIcon}
@override
final void Function(InAppWebViewController controller, Uint8List icon)?
onReceivedIcon;
///{@macro flutter_inappwebview.WebView.onReceivedLoginRequest}
@override
final void Function(
InAppWebViewController controller, LoginRequest loginRequest)?
onReceivedLoginRequest;
///{@macro flutter_inappwebview.WebView.onPermissionRequestCanceled}
@override
final void Function(InAppWebViewController controller,
PermissionRequest permissionRequest)? onPermissionRequestCanceled;
///{@macro flutter_inappwebview.WebView.onRequestFocus}
@override
final void Function(InAppWebViewController controller)? onRequestFocus;
///{@macro flutter_inappwebview.WebView.onReceivedTouchIconUrl}
@override
final void Function(
InAppWebViewController controller, WebUri url, bool precomposed)?
onReceivedTouchIconUrl;
///{@macro flutter_inappwebview.WebView.onRenderProcessGone}
@override
final void Function(
InAppWebViewController controller, RenderProcessGoneDetail detail)?
onRenderProcessGone;
///{@macro flutter_inappwebview.WebView.onRenderProcessResponsive}
@override
final Future<WebViewRenderProcessAction?> Function(
InAppWebViewController controller, WebUri? url)?
onRenderProcessResponsive;
///{@macro flutter_inappwebview.WebView.onRenderProcessUnresponsive}
@override
final Future<WebViewRenderProcessAction?> Function(
InAppWebViewController controller, WebUri? url)?
onRenderProcessUnresponsive;
///{@macro flutter_inappwebview.WebView.onSafeBrowsingHit}
@override
final Future<SafeBrowsingResponse?> Function(
InAppWebViewController controller,
WebUri url,
SafeBrowsingThreat? threatType)? onSafeBrowsingHit;
///{@macro flutter_inappwebview.WebView.onWebContentProcessDidTerminate}
@override
final void Function(InAppWebViewController controller)?
onWebContentProcessDidTerminate;
///{@macro flutter_inappwebview.WebView.shouldAllowDeprecatedTLS}
@override
final Future<ShouldAllowDeprecatedTLSAction?> Function(
InAppWebViewController controller,
URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS;
///{@macro flutter_inappwebview.WebView.shouldInterceptRequest}
@override
final Future<WebResourceResponse?> Function(
InAppWebViewController controller, WebResourceRequest request)?
shouldInterceptRequest;
///{@macro flutter_inappwebview.WebView.onCameraCaptureStateChanged}
@override
final Future<void> Function(
InAppWebViewController controller,
@ -607,6 +670,7 @@ class InAppWebView extends StatefulWidget implements WebView {
MediaCaptureState? newState,
)? onCameraCaptureStateChanged;
///{@macro flutter_inappwebview.WebView.onMicrophoneCaptureStateChanged}
@override
final Future<void> Function(
InAppWebViewController controller,
@ -614,6 +678,7 @@ class InAppWebView extends StatefulWidget implements WebView {
MediaCaptureState? newState,
)? onMicrophoneCaptureStateChanged;
///{@macro flutter_inappwebview.WebView.onContentSizeChanged}
@override
final void Function(InAppWebViewController controller, Size oldContentSize,
Size newContentSize)? onContentSizeChanged;

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,9 @@ import '../print_job/main.dart';
import '../debug_logging_settings.dart';
///{@template flutter_inappwebview.WebView}
///Abstract class that represents a WebView. Used by [InAppWebView], [HeadlessInAppWebView] and the WebView of [InAppBrowser].
///{@endtemplate}
abstract class WebView {
///Debug settings used by [InAppWebView], [HeadlessInAppWebView] and [InAppBrowser].
///The default value excludes the [WebView.onScrollChanged], [WebView.onOverScrolled] and [WebView.onReceivedIcon] events.
@ -30,9 +32,17 @@ abstract class WebView {
RegExp(r"onReceivedIcon")
]);
///{@template flutter_inappwebview.WebView.windowId}
///The window id of a [CreateWindowAction.windowId].
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
///{@endtemplate}
final int? windowId;
///{@template flutter_inappwebview.WebView.onWebViewCreated}
///Event fired when the [WebView] is created.
///
///**Supported Platforms/Implementations**:
@ -40,8 +50,10 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web
///{@endtemplate}
final void Function(InAppWebViewController controller)? onWebViewCreated;
///{@template flutter_inappwebview.WebView.onLoadStart}
///Event fired when the [WebView] starts to load an [url].
///
///**NOTE for Web**: it will be dispatched at the same time of [onLoadStop] event
@ -54,9 +66,11 @@ abstract class WebView {
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview))
///- Web
///{@endtemplate}
final void Function(InAppWebViewController controller, WebUri? url)?
onLoadStart;
///{@template flutter_inappwebview.WebView.onLoadStop}
///Event fired when the [WebView] finishes loading an [url].
///
///**NOTE for Web**: If `window.location.href` isn't accessible inside the iframe,
@ -67,6 +81,7 @@ abstract class WebView {
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview))
///- Web ([Official API - Window.onload](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event))
///{@endtemplate}
final void Function(InAppWebViewController controller, WebUri? url)?
onLoadStop;
@ -75,12 +90,14 @@ abstract class WebView {
final void Function(InAppWebViewController controller, Uri? url, int code,
String message)? onLoadError;
///{@template flutter_inappwebview.WebView.onReceivedError}
///Event fired when the [WebView] encounters an [error] loading a [request].
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceError)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
///{@endtemplate}
final void Function(InAppWebViewController controller,
WebResourceRequest request, WebResourceError error)? onReceivedError;
@ -89,6 +106,7 @@ abstract class WebView {
final void Function(InAppWebViewController controller, Uri? url,
int statusCode, String description)? onLoadHttpError;
///{@template flutter_inappwebview.WebView.onReceivedHttpError}
///Event fired when the [WebView] receives an HTTP error.
///
///[request] represents the originating request.
@ -101,20 +119,24 @@ abstract class WebView {
///- Android native WebView ([Official API - WebViewClient.onReceivedHttpError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceResponse)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///{@endtemplate}
final void Function(
InAppWebViewController controller,
WebResourceRequest request,
WebResourceResponse errorResponse)? onReceivedHttpError;
///{@template flutter_inappwebview.WebView.onProgressChanged}
///Event fired when the current [progress] of loading a page is changed.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onProgressChanged](https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int)))
///- iOS
///- MacOS
///{@endtemplate}
final void Function(InAppWebViewController controller, int progress)?
onProgressChanged;
///{@template flutter_inappwebview.WebView.onConsoleMessage}
///Event fired when the [WebView] receives a [ConsoleMessage].
///
///**NOTE for Web**: this event will be called only if the iframe has the same origin.
@ -124,10 +146,12 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web
///{@endtemplate}
final void Function(
InAppWebViewController controller, ConsoleMessage consoleMessage)?
onConsoleMessage;
///{@template flutter_inappwebview.WebView.shouldOverrideUrlLoading}
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView.
///
///Note that on Android there isn't any way to load an URL for a frame that is not the main frame, so if the request is not for the main frame, the navigation is allowed by default.
@ -145,10 +169,12 @@ abstract class WebView {
///- Android native WebView ([Official API - WebViewClient.shouldOverrideUrlLoading](https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview))
///{@endtemplate}
final Future<NavigationActionPolicy?> Function(
InAppWebViewController controller, NavigationAction navigationAction)?
shouldOverrideUrlLoading;
///{@template flutter_inappwebview.WebView.onLoadResource}
///Event fired when the [WebView] loads a resource.
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnLoadResource] and [InAppWebViewSettings.javaScriptEnabled] setting to `true`.
@ -157,10 +183,12 @@ abstract class WebView {
///- Android native WebView
///- iOS
///- MacOS
///{@endtemplate}
final void Function(
InAppWebViewController controller, LoadedResource resource)?
onLoadResource;
///{@template flutter_inappwebview.WebView.onScrollChanged}
///Event fired when the [WebView] scrolls.
///
///[x] represents the current horizontal scroll origin in pixels.
@ -176,6 +204,7 @@ abstract class WebView {
///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidScroll](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll))
///- Web ([Official API - Window.onscroll](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onscroll))
///- MacOS
///{@endtemplate}
final void Function(InAppWebViewController controller, int x, int y)?
onScrollChanged;
@ -184,6 +213,7 @@ abstract class WebView {
final void Function(InAppWebViewController controller, Uri url)?
onDownloadStart;
///{@template flutter_inappwebview.WebView.onDownloadStartRequest}
///Event fired when [WebView] recognizes a downloadable file.
///To download the file, you can use the [flutter_downloader](https://pub.dev/packages/flutter_downloader) plugin.
///
@ -195,6 +225,7 @@ abstract class WebView {
///- Android native WebView ([Official API - WebView.setDownloadListener](https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener)))
///- iOS
///- MacOS
///{@endtemplate}
final void Function(InAppWebViewController controller,
DownloadStartRequest downloadStartRequest)? onDownloadStartRequest;
@ -203,6 +234,7 @@ abstract class WebView {
final Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, Uri url)? onLoadResourceCustomScheme;
///{@template flutter_inappwebview.WebView.onLoadResourceWithCustomScheme}
///Event fired when the [WebView] finds the `custom-scheme` while loading a resource.
///Here you can handle the url [request] and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`.
///
@ -210,10 +242,12 @@ abstract class WebView {
///- Android native WebView
///- iOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler))
///- MacOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler))
///{@endtemplate}
final Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, WebResourceRequest request)?
onLoadResourceWithCustomScheme;
///{@template flutter_inappwebview.WebView.onCreateWindow}
///Event fired when the [WebView] requests the host application to create a new window,
///for example when trying to open a link with `target="_blank"` or when `window.open()` is called by JavaScript side.
///If the host application chooses to honor this request, it should return `true` from this method, create a new WebView to host the window.
@ -251,9 +285,11 @@ abstract class WebView {
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview))
///- Web
///{@endtemplate}
final Future<bool?> Function(InAppWebViewController controller,
CreateWindowAction createWindowAction)? onCreateWindow;
///{@template flutter_inappwebview.WebView.onCloseWindow}
///Event fired when the host application should close the given WebView and remove it from the view system if necessary.
///At this point, WebCore has stopped any loading in this window and has removed any cross-scripting ability in javascript.
///
@ -261,8 +297,10 @@ abstract class WebView {
///- Android native WebView ([Official API - WebChromeClient.onCloseWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView)))
///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
///- MacOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
///{@endtemplate}
final void Function(InAppWebViewController controller)? onCloseWindow;
///{@template flutter_inappwebview.WebView.onWindowFocus}
///Event fired when the JavaScript `window` object of the WebView has received focus.
///This is the result of the `focus` JavaScript event applied to the `window` object.
///
@ -273,8 +311,10 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web ([Official API - Window.onfocus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event))
///{@endtemplate}
final void Function(InAppWebViewController controller)? onWindowFocus;
///{@template flutter_inappwebview.WebView.onWindowBlur}
///Event fired when the JavaScript `window` object of the WebView has lost focus.
///This is the result of the `blur` JavaScript event applied to the `window` object.
///
@ -285,8 +325,10 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web ([Official API - Window.onblur](https://developer.mozilla.org/en-US/docs/Web/API/Window/blur_event))
///{@endtemplate}
final void Function(InAppWebViewController controller)? onWindowBlur;
///{@template flutter_inappwebview.WebView.onJsAlert}
///Event fired when javascript calls the `alert()` method to display an alert dialog.
///If [JsAlertResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///
@ -296,10 +338,12 @@ abstract class WebView {
///- Android native WebView ([Official API - WebChromeClient.onJsAlert](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview))
///{@endtemplate}
final Future<JsAlertResponse?> Function(
InAppWebViewController controller, JsAlertRequest jsAlertRequest)?
onJsAlert;
///{@template flutter_inappwebview.WebView.onJsConfirm}
///Event fired when javascript calls the `confirm()` method to display a confirm dialog.
///If [JsConfirmResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///
@ -309,10 +353,12 @@ abstract class WebView {
///- Android native WebView ([Official API - WebChromeClient.onJsConfirm](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsConfirm(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview))
///{@endtemplate}
final Future<JsConfirmResponse?> Function(
InAppWebViewController controller, JsConfirmRequest jsConfirmRequest)?
onJsConfirm;
///{@template flutter_inappwebview.WebView.onJsPrompt}
///Event fired when javascript calls the `prompt()` method to display a prompt dialog.
///If [JsPromptResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///
@ -322,10 +368,12 @@ abstract class WebView {
///- Android native WebView ([Official API - WebChromeClient.onJsPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview))
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview))
///{@endtemplate}
final Future<JsPromptResponse?> Function(
InAppWebViewController controller, JsPromptRequest jsPromptRequest)?
onJsPrompt;
///{@template flutter_inappwebview.WebView.onReceivedHttpAuthRequest}
///Event fired when the WebView received an HTTP authentication request. The default behavior is to cancel the request.
///
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [URLAuthenticationChallenge].
@ -334,9 +382,11 @@ abstract class WebView {
///- Android native WebView ([Official API - WebViewClient.onReceivedHttpAuthRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///{@endtemplate}
final Future<HttpAuthResponse?> Function(InAppWebViewController controller,
HttpAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
///{@template flutter_inappwebview.WebView.onReceivedServerTrustAuthRequest}
///Event fired when the WebView need to perform server trust authentication (certificate validation).
///The host application must return either [ServerTrustAuthResponse] instance with [ServerTrustAuthResponseAction.CANCEL] or [ServerTrustAuthResponseAction.PROCEED].
///
@ -346,10 +396,12 @@ abstract class WebView {
///- Android native WebView ([Official API - WebViewClient.onReceivedSslError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///{@endtemplate}
final Future<ServerTrustAuthResponse?> Function(
InAppWebViewController controller, ServerTrustChallenge challenge)?
onReceivedServerTrustAuthRequest;
///{@template flutter_inappwebview.WebView.onReceivedClientCertRequest}
///Notify the host application to handle an SSL client certificate request.
///Webview stores the response in memory (for the life of the application) if [ClientCertResponseAction.PROCEED] or [ClientCertResponseAction.CANCEL]
///is called and does not call [onReceivedClientCertRequest] again for the same host and port pair.
@ -361,6 +413,7 @@ abstract class WebView {
///- Android native WebView ([Official API - WebViewClient.onReceivedClientCertRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///{@endtemplate}
final Future<ClientCertResponse?> Function(
InAppWebViewController controller, ClientCertChallenge challenge)?
onReceivedClientCertRequest;
@ -370,6 +423,7 @@ abstract class WebView {
final void Function(InAppWebViewController controller, int activeMatchOrdinal,
int numberOfMatches, bool isDoneCounting)? onFindResultReceived;
///{@template flutter_inappwebview.WebView.shouldInterceptAjaxRequest}
///Event fired when an `XMLHttpRequest` is sent to a server.
///It gives the host application a chance to take control over the request before sending it.
///
@ -385,10 +439,12 @@ abstract class WebView {
///- Android native WebView
///- iOS
///- MacOS
///{@endtemplate}
final Future<AjaxRequest?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)?
shouldInterceptAjaxRequest;
///{@template flutter_inappwebview.WebView.onAjaxReadyStateChange}
///Event fired whenever the `readyState` attribute of an `XMLHttpRequest` changes.
///It gives the host application a chance to abort the request.
///
@ -404,10 +460,12 @@ abstract class WebView {
///- Android native WebView
///- iOS
///- MacOS
///{@endtemplate}
final Future<AjaxRequestAction?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)?
onAjaxReadyStateChange;
///{@template flutter_inappwebview.WebView.onAjaxProgress}
///Event fired as an `XMLHttpRequest` progress.
///It gives the host application a chance to abort the request.
///
@ -423,10 +481,12 @@ abstract class WebView {
///- Android native WebView
///- iOS
///- MacOS
///{@endtemplate}
final Future<AjaxRequestAction?> Function(
InAppWebViewController controller, AjaxRequest ajaxRequest)?
onAjaxProgress;
///{@template flutter_inappwebview.WebView.shouldInterceptFetchRequest}
///Event fired when a request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API).
///It gives the host application a chance to take control over the request before sending it.
///
@ -442,10 +502,12 @@ abstract class WebView {
///- Android native WebView
///- iOS
///- MacOS
///{@endtemplate}
final Future<FetchRequest?> Function(
InAppWebViewController controller, FetchRequest fetchRequest)?
shouldInterceptFetchRequest;
///{@template flutter_inappwebview.WebView.onUpdateVisitedHistory}
///Event fired when the host application updates its visited links database.
///This event is also fired when the navigation state of the [WebView] changes through the usage of
///javascript **[History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API)** functions (`pushState()`, `replaceState()`) and `onpopstate` event
@ -462,6 +524,7 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web
///{@endtemplate}
final void Function(
InAppWebViewController controller, WebUri? url, bool? isReload)?
onUpdateVisitedHistory;
@ -470,6 +533,7 @@ abstract class WebView {
@Deprecated("Use onPrintRequest instead")
final void Function(InAppWebViewController controller, Uri? url)? onPrint;
///{@template flutter_inappwebview.WebView.onPrintRequest}
///Event fired when `window.print()` is called from JavaScript side.
///Return `true` if you want to handle the print job.
///Otherwise return `false`, so the [PrintJobController] will be handled and disposed automatically by the system.
@ -486,9 +550,11 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web
///{@endtemplate}
final Future<bool?> Function(InAppWebViewController controller, WebUri? url,
PrintJobController? printJobController)? onPrintRequest;
///{@template flutter_inappwebview.WebView.onLongPressHitTestResult}
///Event fired when an HTML element of the webview has been clicked and held.
///
///[hitTestResult] represents the hit result for hitting an HTML elements.
@ -496,9 +562,11 @@ abstract class WebView {
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - View.setOnLongClickListener](https://developer.android.com/reference/android/view/View#setOnLongClickListener(android.view.View.OnLongClickListener)))
///- iOS ([Official API - UILongPressGestureRecognizer](https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer))
///{@endtemplate}
final void Function(InAppWebViewController controller,
InAppWebViewHitTestResult hitTestResult)? onLongPressHitTestResult;
///{@template flutter_inappwebview.WebView.onEnterFullscreen}
///Event fired when the current page has entered full screen mode.
///
///**Supported Platforms/Implementations**:
@ -506,8 +574,10 @@ abstract class WebView {
///- iOS ([Official API - UIWindow.didBecomeVisibleNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621621-didbecomevisiblenotification))
///- MacOS ([Official API - NSWindow.didEnterFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419651-didenterfullscreennotification))
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
///{@endtemplate}
final void Function(InAppWebViewController controller)? onEnterFullscreen;
///{@template flutter_inappwebview.WebView.onExitFullscreen}
///Event fired when the current page has exited full screen mode.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onHideCustomView()
@ -519,8 +589,10 @@ abstract class WebView {
///- iOS ([Official API - UIWindow.didBecomeHiddenNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621617-didbecomehiddennotification))
///- MacOS ([Official API - NSWindow.didExitFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419177-didexitfullscreennotification))
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
///{@endtemplate}
final void Function(InAppWebViewController controller)? onExitFullscreen;
///{@template flutter_inappwebview.WebView.onPageCommitVisible}
///Called when the web view begins to receive web content.
///
///This event occurs early in the document loading process, and as such
@ -532,9 +604,11 @@ abstract class WebView {
///- Android native WebView ([Official API - WebViewClient.onPageCommitVisible](https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
///{@endtemplate}
final void Function(InAppWebViewController controller, WebUri? url)?
onPageCommitVisible;
///{@template flutter_inappwebview.WebView.onTitleChanged}
///Event fired when a change in the document title occurred.
///
///[title] represents the string containing the new title of the document.
@ -546,9 +620,11 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web
///{@endtemplate}
final void Function(InAppWebViewController controller, String? title)?
onTitleChanged;
///{@template flutter_inappwebview.WebView.onOverScrolled}
///Event fired to respond to the results of an over-scroll operation.
///
///[x] represents the new X scroll value in pixels.
@ -562,9 +638,11 @@ abstract class WebView {
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.onOverScrolled](https://developer.android.com/reference/android/webkit/WebView#onOverScrolled(int,%20int,%20boolean,%20boolean)))
///- iOS
///{@endtemplate}
final void Function(InAppWebViewController controller, int x, int y,
bool clampedX, bool clampedY)? onOverScrolled;
///{@template flutter_inappwebview.WebView.onZoomScaleChanged}
///Event fired when the zoom scale of the WebView has changed.
///
///[oldScale] The old zoom scale factor.
@ -577,6 +655,7 @@ abstract class WebView {
///- Android native WebView ([Official API - WebViewClient.onScaleChanged](https://developer.android.com/reference/android/webkit/WebViewClient#onScaleChanged(android.webkit.WebView,%20float,%20float)))
///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidZoom](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619409-scrollviewdidzoom))
///- Web
///{@endtemplate}
final void Function(
InAppWebViewController controller, double oldScale, double newScale)?
onZoomScaleChanged;
@ -588,6 +667,7 @@ abstract class WebView {
Uri url,
SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit;
///{@template flutter_inappwebview.WebView.onSafeBrowsingHit}
///Event fired when the webview notifies that a loading URL has been flagged by Safe Browsing.
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
///
@ -599,6 +679,7 @@ abstract class WebView {
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onSafeBrowsingHit](https://developer.android.com/reference/android/webkit/WebViewClient#onSafeBrowsingHit(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20int,%20android.webkit.SafeBrowsingResponse)))
///{@endtemplate}
final Future<SafeBrowsingResponse?> Function(
InAppWebViewController controller,
WebUri url,
@ -611,6 +692,7 @@ abstract class WebView {
String origin,
List<String> resources)? androidOnPermissionRequest;
///{@template flutter_inappwebview.WebView.onPermissionRequest}
///Event fired when the WebView is requesting permission to access the specified resources and the permission currently isn't granted or denied.
///
///[permissionRequest] represents the permission request with an array of resources the web content wants to access
@ -626,6 +708,7 @@ abstract class WebView {
///- Android native WebView ([Official API - WebChromeClient.onPermissionRequest](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest)))
///- iOS
///- MacOS
///{@endtemplate}
final Future<PermissionResponse?> Function(InAppWebViewController controller,
PermissionRequest permissionRequest)? onPermissionRequest;
@ -635,6 +718,7 @@ abstract class WebView {
InAppWebViewController controller, String origin)?
androidOnGeolocationPermissionsShowPrompt;
///{@template flutter_inappwebview.WebView.onGeolocationPermissionsShowPrompt}
///Event that notifies the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin.
///Note that for applications targeting Android N and later SDKs (API level > `Build.VERSION_CODES.M`) this method is only called for requests originating from secure origins such as https.
///On non-secure origins geolocation requests are automatically denied.
@ -643,6 +727,7 @@ 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)))
///{@endtemplate}
final Future<GeolocationPermissionShowPromptResponse?> Function(
InAppWebViewController controller, String origin)?
onGeolocationPermissionsShowPrompt;
@ -652,11 +737,13 @@ abstract class WebView {
final void Function(InAppWebViewController controller)?
androidOnGeolocationPermissionsHidePrompt;
///{@template flutter_inappwebview.WebView.onGeolocationPermissionsHidePrompt}
///Notify the host application that a request for Geolocation permissions, made with a previous call to [onGeolocationPermissionsShowPrompt] has been canceled.
///Any related UI should therefore be hidden.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsHidePrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt()))
///{@endtemplate}
final void Function(InAppWebViewController controller)?
onGeolocationPermissionsHidePrompt;
@ -666,6 +753,7 @@ abstract class WebView {
InAppWebViewController controller, WebResourceRequest request)?
androidShouldInterceptRequest;
///{@template flutter_inappwebview.WebView.shouldInterceptRequest}
///Notify the host application of a resource request and allow the application to return the data.
///If the return value is `null`, the WebView will continue to load the resource as usual.
///Otherwise, the return response and data will be used.
@ -682,6 +770,7 @@ 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)))
///{@endtemplate}
final Future<WebResourceResponse?> Function(
InAppWebViewController controller, WebResourceRequest request)?
shouldInterceptRequest;
@ -692,6 +781,7 @@ abstract class WebView {
InAppWebViewController controller, Uri? url)?
androidOnRenderProcessUnresponsive;
///{@template flutter_inappwebview.WebView.onRenderProcessUnresponsive}
///Event called when the renderer currently associated with the WebView becomes unresponsive as a result of a long running blocking task such as the execution of JavaScript.
///
///If a WebView fails to process an input event, or successfully navigate to a new URL within a reasonable time frame, the renderer is considered to be unresponsive, and this callback will be called.
@ -711,6 +801,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)))
///{@endtemplate}
final Future<WebViewRenderProcessAction?> Function(
InAppWebViewController controller, WebUri? url)?
onRenderProcessUnresponsive;
@ -721,6 +812,7 @@ abstract class WebView {
InAppWebViewController controller, Uri? url)?
androidOnRenderProcessResponsive;
///{@template flutter_inappwebview.WebView.onRenderProcessResponsive}
///Event called once when an unresponsive renderer currently associated with the WebView becomes responsive.
///
///After a WebView renderer becomes unresponsive, which is notified to the application by [onRenderProcessUnresponsive],
@ -733,6 +825,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)))
///{@endtemplate}
final Future<WebViewRenderProcessAction?> Function(
InAppWebViewController controller, WebUri? url)?
onRenderProcessResponsive;
@ -743,6 +836,7 @@ abstract class WebView {
InAppWebViewController controller, RenderProcessGoneDetail detail)?
androidOnRenderProcessGone;
///{@template flutter_inappwebview.WebView.onRenderProcessGone}
///Event fired when the given WebView's render process has exited.
///The application's implementation of this callback should only attempt to clean up the WebView.
///The WebView should be removed from the view hierarchy, all references to it should be cleaned up.
@ -753,6 +847,7 @@ 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)))
///{@endtemplate}
final void Function(
InAppWebViewController controller, RenderProcessGoneDetail detail)?
onRenderProcessGone;
@ -762,10 +857,12 @@ abstract class WebView {
final Future<FormResubmissionAction?> Function(
InAppWebViewController controller, Uri? url)? androidOnFormResubmission;
///{@template flutter_inappwebview.WebView.onFormResubmission}
///As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onFormResubmission](https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)))
///{@endtemplate}
final Future<FormResubmissionAction?> Function(
InAppWebViewController controller, WebUri? url)? onFormResubmission;
@ -780,12 +877,14 @@ abstract class WebView {
final void Function(InAppWebViewController controller, Uint8List icon)?
androidOnReceivedIcon;
///{@template flutter_inappwebview.WebView.onReceivedIcon}
///Event fired when there is new favicon for the current page.
///
///[icon] represents the favicon for the current page.
///
///**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)))
///{@endtemplate}
final void Function(InAppWebViewController controller, Uint8List icon)?
onReceivedIcon;
@ -795,6 +894,7 @@ abstract class WebView {
InAppWebViewController controller, Uri url, bool precomposed)?
androidOnReceivedTouchIconUrl;
///{@template flutter_inappwebview.WebView.onReceivedTouchIconUrl}
///Event fired when there is an url for an apple-touch-icon.
///
///[url] represents the icon url.
@ -803,6 +903,7 @@ 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)))
///{@endtemplate}
final void Function(
InAppWebViewController controller, WebUri url, bool precomposed)?
onReceivedTouchIconUrl;
@ -813,6 +914,7 @@ abstract class WebView {
InAppWebViewController controller,
JsBeforeUnloadRequest jsBeforeUnloadRequest)? androidOnJsBeforeUnload;
///{@template flutter_inappwebview.WebView.onJsBeforeUnload}
///Event fired when the client should display a dialog to confirm navigation away from the current page.
///This is the result of the `onbeforeunload` javascript event.
///If [JsBeforeUnloadResponse.handledByClient] is `true`, WebView will assume that the client will handle the confirm dialog.
@ -825,6 +927,7 @@ abstract class WebView {
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsBeforeUnload](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsBeforeUnload(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///{@endtemplate}
final Future<JsBeforeUnloadResponse?> Function(
InAppWebViewController controller,
JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload;
@ -835,16 +938,19 @@ abstract class WebView {
InAppWebViewController controller, LoginRequest loginRequest)?
androidOnReceivedLoginRequest;
///{@template flutter_inappwebview.WebView.onReceivedLoginRequest}
///Event fired when a request to automatically log in the user has been processed.
///
///[loginRequest] contains the realm, account and args of the login request.
///
///**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)))
///{@endtemplate}
final void Function(
InAppWebViewController controller, LoginRequest loginRequest)?
onReceivedLoginRequest;
///{@template flutter_inappwebview.WebView.onPermissionRequestCanceled}
///Notify the host application that the given permission request has been canceled. Any related UI should therefore be hidden.
///
///[permissionRequest] represents the permission request that needs be canceled
@ -855,14 +961,17 @@ abstract class WebView {
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onPermissionRequestCanceled](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequestCanceled(android.webkit.PermissionRequest)))
///{@endtemplate}
final void Function(InAppWebViewController controller,
PermissionRequest permissionRequest)? onPermissionRequestCanceled;
///{@template flutter_inappwebview.WebView.onRequestFocus}
///Request display and focus for this WebView.
///This may happen due to another WebView opening a link in this WebView and requesting that this WebView be displayed.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onRequestFocus](https://developer.android.com/reference/android/webkit/WebChromeClient#onRequestFocus(android.webkit.WebView)))
///{@endtemplate}
final void Function(InAppWebViewController controller)? onRequestFocus;
///Use [onWebContentProcessDidTerminate] instead.
@ -870,11 +979,13 @@ abstract class WebView {
final void Function(InAppWebViewController controller)?
iosOnWebContentProcessDidTerminate;
///{@template flutter_inappwebview.WebView.onWebContentProcessDidTerminate}
///Invoked when the web view's web content process is terminated.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
///- MacOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
///{@endtemplate}
final void Function(InAppWebViewController controller)?
onWebContentProcessDidTerminate;
@ -883,11 +994,13 @@ abstract class WebView {
final void Function(InAppWebViewController controller)?
iosOnDidReceiveServerRedirectForProvisionalNavigation;
///{@template flutter_inappwebview.WebView.onDidReceiveServerRedirectForProvisionalNavigation}
///Called when a web view receives a server redirect.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
///{@endtemplate}
final void Function(InAppWebViewController controller)?
onDidReceiveServerRedirectForProvisionalNavigation;
@ -897,6 +1010,7 @@ abstract class WebView {
InAppWebViewController controller,
IOSWKNavigationResponse navigationResponse)? iosOnNavigationResponse;
///{@template flutter_inappwebview.WebView.onNavigationResponse}
///Called when a web view asks for permission to navigate to new content after the response to the navigation request is known.
///
///[navigationResponse] represents the navigation response.
@ -906,6 +1020,7 @@ abstract class WebView {
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///{@endtemplate}
final Future<NavigationResponseAction?> Function(
InAppWebViewController controller,
NavigationResponse navigationResponse)? onNavigationResponse;
@ -916,6 +1031,7 @@ abstract class WebView {
InAppWebViewController controller,
URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS;
///{@template flutter_inappwebview.WebView.shouldAllowDeprecatedTLS}
///Called when a web view asks whether to continue with a connection that uses a deprecated version of TLS (v1.0 and v1.1).
///
///[challenge] represents the authentication challenge.
@ -927,10 +1043,12 @@ abstract class WebView {
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview))
///{@endtemplate}
final Future<ShouldAllowDeprecatedTLSAction?> Function(
InAppWebViewController controller,
URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS;
///{@template flutter_inappwebview.WebView.onCameraCaptureStateChanged}
///Event fired when a change in the camera capture state occurred.
///
///**NOTE for iOS**: available only on iOS 15.0+.
@ -940,12 +1058,14 @@ abstract class WebView {
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
///{@endtemplate}
final Future<void> Function(
InAppWebViewController controller,
MediaCaptureState? oldState,
MediaCaptureState? newState,
)? onCameraCaptureStateChanged;
///{@template flutter_inappwebview.WebView.onMicrophoneCaptureStateChanged}
///Event fired when a change in the microphone capture state occurred.
///
///**NOTE for iOS**: available only on iOS 15.0+.
@ -955,12 +1075,14 @@ abstract class WebView {
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
///{@endtemplate}
final Future<void> Function(
InAppWebViewController controller,
MediaCaptureState? oldState,
MediaCaptureState? newState,
)? onMicrophoneCaptureStateChanged;
///{@template flutter_inappwebview.WebView.onContentSizeChanged}
///Event fired when the content size of the [WebView] changes.
///
///[oldContentSize] represents the old content size value.
@ -969,9 +1091,11 @@ abstract class WebView {
///
///**Supported Platforms/Implementations**:
///- iOS
///{@endtemplate}
final void Function(InAppWebViewController controller, Size oldContentSize,
Size newContentSize)? onContentSizeChanged;
///{@template flutter_inappwebview.WebView.initialUrlRequest}
///Initial url request that will be loaded.
///
///**NOTE for Android**: when loading an URL Request using "POST" method, headers are ignored.
@ -981,8 +1105,10 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web
///{@endtemplate}
final URLRequest? initialUrlRequest;
///{@template flutter_inappwebview.WebView.initialFile}
///Initial asset file that will be loaded. See [InAppWebViewController.loadFile] for explanation.
///
///**Supported Platforms/Implementations**:
@ -990,8 +1116,10 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web
///{@endtemplate}
final String? initialFile;
///{@template flutter_inappwebview.WebView.initialData}
///Initial [InAppWebViewInitialData] that will be loaded.
///
///**Supported Platforms/Implementations**:
@ -999,12 +1127,14 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web
///{@endtemplate}
final InAppWebViewInitialData? initialData;
///Use [initialSettings] instead.
@Deprecated('Use initialSettings instead')
final InAppWebViewGroupOptions? initialOptions;
///{@template flutter_inappwebview.WebView.initialSettings}
///Initial settings that will be used.
///
///**Supported Platforms/Implementations**:
@ -1012,15 +1142,19 @@ abstract class WebView {
///- iOS
///- MacOS
///- Web
///{@endtemplate}
final InAppWebViewSettings? initialSettings;
///{@template flutter_inappwebview.WebView.contextMenu}
///Context menu which contains custom menu items to be shown when [ContextMenu] is presented.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///{@endtemplate}
final ContextMenu? contextMenu;
///{@template flutter_inappwebview.WebView.initialUserScripts}
///Initial list of user scripts to be loaded at start or end of a page loading.
///To add or remove user scripts, you have to use the [InAppWebViewController]'s methods such as [InAppWebViewController.addUserScript],
///[InAppWebViewController.removeUserScript], [InAppWebViewController.removeAllUserScripts], etc.
@ -1033,8 +1167,10 @@ abstract class WebView {
///- Android native WebView
///- iOS
///- MacOS
///{@endtemplate}
final UnmodifiableListView<UserScript>? initialUserScripts;
///{@template flutter_inappwebview.WebView.pullToRefreshController}
///Represents the pull-to-refresh feature controller.
///
///**NOTE for Android**: to be able to use the "pull-to-refresh" feature, [InAppWebViewSettings.useHybridComposition] must be `true`.
@ -1042,20 +1178,26 @@ abstract class WebView {
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///{@endtemplate}
final PullToRefreshController? pullToRefreshController;
///{@template flutter_inappwebview.WebView.findInteractionController}
///Represents the find interaction feature controller.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
///{@endtemplate}
final FindInteractionController? findInteractionController;
///{@template flutter_inappwebview.WebView.implementation}
///Represents the WebView native implementation to be used.
///The default value is [WebViewImplementation.NATIVE].
///{@endtemplate}
final WebViewImplementation implementation;
///{@macro flutter_inappwebview.WebView}
WebView(
{this.windowId,
this.onWebViewCreated,

View File

@ -8,6 +8,78 @@ part of 'print_job_settings.dart';
///Class that represents the settings of a [PrintJobController].
class PrintJobSettings {
///`true` to animate the display of the sheet, `false` to display the sheet immediately.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? animated;
///Whether the print operation should spawn a separate thread in which to run itself.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? canSpawnSeparateThread;
///The color mode.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- MacOS
PrintJobColorMode? colorMode;
///How many copies to print.
///The default value is `1`.
///
///**Supported Platforms/Implementations**:
///- MacOS
int? copies;
///If `true`, produce detailed reports when an error occurs.
///The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? detailedErrorReporting;
///The duplex mode to use for the print job.
///
///**NOTE for Android native WebView**: available only on Android 23+.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
PrintJobDuplexMode? duplexMode;
///A fax number.
///
///**Supported Platforms/Implementations**:
///- MacOS
String? faxNumber;
///An integer value that specifies the first page in the print job.
///
///**Supported Platforms/Implementations**:
///- MacOS
int? firstPage;
///The height of the page footer.
///
///The footer is measured in points from the bottom of [printableRect] and is below the content area.
///The default footer height is `0.0`.
///
///**Supported Platforms/Implementations**:
///- iOS
double? footerHeight;
///Force rendering quality.
///
///**NOTE for iOS**: available only on iOS 14.5+.
///
///**Supported Platforms/Implementations**:
///- iOS
PrintJobRenderingQuality? forceRenderingQuality;
///Set this to `true` to handle the [PrintJobController].
///Otherwise, it will be handled and disposed automatically by the system.
///The default value is `false`.
@ -18,6 +90,48 @@ class PrintJobSettings {
///- MacOS
bool? handledByClient;
///If `true`, a standard header and footer are added outside the margins of each page.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? headerAndFooter;
///The height of the page header.
///
///The header is measured in points from the top of [printableRect] and is above the content area.
///The default header height is `0.0`.
///
///**Supported Platforms/Implementations**:
///- iOS
double? headerHeight;
///The horizontal pagination mode.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobPaginationMode? horizontalPagination;
///Indicates whether the image is centered horizontally.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? isHorizontallyCentered;
///Indicates whether the image is centered vertically.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? isVerticallyCentered;
///The action specified for the job.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobDisposition? jobDisposition;
///The name of the print job.
///An application should set this property to a name appropriate to the content being printed.
///The default job name is the current webpage title concatenated with the "Document" word at the end.
@ -28,34 +142,17 @@ class PrintJobSettings {
///- MacOS
String? jobName;
///`true` to animate the display of the sheet, `false` to display the sheet immediately.
///An URL containing the location to which the job file will be saved when the [jobDisposition] is [PrintJobDisposition.SAVE].
///
///**Supported Platforms/Implementations**:
///- iOS
bool? animated;
///The orientation of the printed content, portrait or landscape.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
PrintJobOrientation? orientation;
WebUri? jobSavingURL;
///The number of pages to render.
///An integer value that specifies the last page in the print job.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
int? numberOfPages;
///Force rendering quality.
///
///**NOTE for iOS**: available only on iOS 14.5+.
///
///**Supported Platforms/Implementations**:
///- iOS
PrintJobRenderingQuality? forceRenderingQuality;
int? lastPage;
///The margins for each printed page.
///Margins define the white space around the content where the left margin defines
@ -66,149 +163,6 @@ class PrintJobSettings {
///- MacOS
EdgeInsets? margins;
///The media size.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
PrintJobMediaSize? mediaSize;
///The color mode.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- MacOS
PrintJobColorMode? colorMode;
///The duplex mode to use for the print job.
///
///**NOTE for Android native WebView**: available only on Android 23+.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
PrintJobDuplexMode? duplexMode;
///The kind of printable content.
///
///**Supported Platforms/Implementations**:
///- iOS
PrintJobOutputType? outputType;
///The supported resolution in DPI (dots per inch).
///
///**Supported Platforms/Implementations**:
///- Android native WebView
PrintJobResolution? resolution;
///A Boolean value that determines whether the printing options include the number of copies.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
bool? showsNumberOfCopies;
///A Boolean value that determines whether the paper selection menu displays.
///The default value of this property is `false`.
///Setting the value to `true` enables a paper selection menu on printers that support different types of paper and have more than one paper type loaded.
///On printers where only one paper type is available, no paper selection menu is displayed, regardless of the value of this property.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? showsPaperSelectionForLoadedPapers;
///A Boolean value that determines whether the printing options include the paper orientation control when available.
///The default value is `true`.
///
///**NOTE for iOS**: available only on iOS 15.0+.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
bool? showsPaperOrientation;
///A Boolean value that determines whether the print panel includes a control for manipulating the paper size of the printer.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPaperSize;
///A Boolean value that determines whether the Print panel includes a control for scaling the printed output.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsScaling;
///A Boolean value that determines whether the Print panel includes a set of fields for manipulating the range of pages being printed.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPageRange;
///A Boolean value that determines whether the Print panel includes a separate accessory view for manipulating the paper size, orientation, and scaling attributes.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPageSetupAccessory;
///A Boolean value that determines whether the Print panel displays a built-in preview of the document contents.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPreview;
///A Boolean value that determines whether the Print panel includes an additional selection option for paper range.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPrintSelection;
///A Boolean value that determines whether the print operation displays a print panel.
///The default value is `true`.
///
///This property does not affect the display of a progress panel;
///that operation is controlled by the [showsProgressPanel] property.
///Operations that generate EPS or PDF data do no display a progress panel, regardless of the value in the flag parameter.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPrintPanel;
///A Boolean value that determines whether the print operation displays a progress panel.
///The default value is `true`.
///
///This property does not affect the display of a print panel;
///that operation is controlled by the [showsPrintPanel] property.
///Operations that generate EPS or PDF data do no display a progress panel, regardless of the value in the flag parameter.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsProgressPanel;
///The height of the page footer.
///
///The footer is measured in points from the bottom of [printableRect] and is below the content area.
///The default footer height is `0.0`.
///
///**Supported Platforms/Implementations**:
///- iOS
double? footerHeight;
///The height of the page header.
///
///The header is measured in points from the top of [printableRect] and is above the content area.
///The default header height is `0.0`.
///
///**Supported Platforms/Implementations**:
///- iOS
double? headerHeight;
///The maximum height of the content area.
///
///The Print Formatter uses this value to determine where the content rectangle begins on the first page.
@ -230,107 +184,11 @@ class PrintJobSettings {
///- iOS
double? maximumContentWidth;
///The current scaling factor. From `0.0` to `1.0`.
///The media size.
///
///**Supported Platforms/Implementations**:
///- MacOS
double? scalingFactor;
///The action specified for the job.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobDisposition? jobDisposition;
///An URL containing the location to which the job file will be saved when the [jobDisposition] is [PrintJobDisposition.SAVE].
///
///**Supported Platforms/Implementations**:
///- MacOS
WebUri? jobSavingURL;
///The name of the currently selected paper size.
///
///**Supported Platforms/Implementations**:
///- MacOS
String? paperName;
///The horizontal pagination mode.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobPaginationMode? horizontalPagination;
///The vertical pagination to the specified mode.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobPaginationMode? verticalPagination;
///Indicates whether the image is centered horizontally.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? isHorizontallyCentered;
///Indicates whether the image is centered vertically.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? isVerticallyCentered;
///The print order for the pages of the operation.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobPageOrder? pageOrder;
///Whether the print operation should spawn a separate thread in which to run itself.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? canSpawnSeparateThread;
///How many copies to print.
///The default value is `1`.
///
///**Supported Platforms/Implementations**:
///- MacOS
int? copies;
///An integer value that specifies the first page in the print job.
///
///**Supported Platforms/Implementations**:
///- MacOS
int? firstPage;
///An integer value that specifies the last page in the print job.
///
///**Supported Platforms/Implementations**:
///- MacOS
int? lastPage;
///If `true`, produce detailed reports when an error occurs.
///The default value is `false`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? detailedErrorReporting;
///A fax number.
///
///**Supported Platforms/Implementations**:
///- MacOS
String? faxNumber;
///If `true`, a standard header and footer are added outside the margins of each page.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? headerAndFooter;
///- Android native WebView
PrintJobMediaSize? mediaSize;
///If `true`, collates output.
///
@ -338,6 +196,33 @@ class PrintJobSettings {
///- MacOS
bool? mustCollate;
///The number of pages to render.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
int? numberOfPages;
///The orientation of the printed content, portrait or landscape.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
PrintJobOrientation? orientation;
///The kind of printable content.
///
///**Supported Platforms/Implementations**:
///- iOS
PrintJobOutputType? outputType;
///The print order for the pages of the operation.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobPageOrder? pageOrder;
///The number of logical pages to be tiled horizontally on a physical sheet of paper.
///
///**Supported Platforms/Implementations**:
@ -350,59 +235,174 @@ class PrintJobSettings {
///- MacOS
int? pagesDown;
///The name of the currently selected paper size.
///
///**Supported Platforms/Implementations**:
///- MacOS
String? paperName;
///The supported resolution in DPI (dots per inch).
///
///**Supported Platforms/Implementations**:
///- Android native WebView
PrintJobResolution? resolution;
///The current scaling factor. From `0.0` to `1.0`.
///
///**Supported Platforms/Implementations**:
///- MacOS
double? scalingFactor;
///A Boolean value that determines whether the printing options include the number of copies.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
bool? showsNumberOfCopies;
///A Boolean value that determines whether the Print panel includes a set of fields for manipulating the range of pages being printed.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPageRange;
///A Boolean value that determines whether the Print panel includes a separate accessory view for manipulating the paper size, orientation, and scaling attributes.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPageSetupAccessory;
///A Boolean value that determines whether the printing options include the paper orientation control when available.
///The default value is `true`.
///
///**NOTE for iOS**: available only on iOS 15.0+.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
bool? showsPaperOrientation;
///A Boolean value that determines whether the paper selection menu displays.
///The default value of this property is `false`.
///Setting the value to `true` enables a paper selection menu on printers that support different types of paper and have more than one paper type loaded.
///On printers where only one paper type is available, no paper selection menu is displayed, regardless of the value of this property.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? showsPaperSelectionForLoadedPapers;
///A Boolean value that determines whether the print panel includes a control for manipulating the paper size of the printer.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPaperSize;
///A Boolean value that determines whether the Print panel displays a built-in preview of the document contents.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPreview;
///A Boolean value that determines whether the print operation displays a print panel.
///The default value is `true`.
///
///This property does not affect the display of a progress panel;
///that operation is controlled by the [showsProgressPanel] property.
///Operations that generate EPS or PDF data do no display a progress panel, regardless of the value in the flag parameter.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPrintPanel;
///A Boolean value that determines whether the Print panel includes an additional selection option for paper range.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsPrintSelection;
///A Boolean value that determines whether the print operation displays a progress panel.
///The default value is `true`.
///
///This property does not affect the display of a print panel;
///that operation is controlled by the [showsPrintPanel] property.
///Operations that generate EPS or PDF data do no display a progress panel, regardless of the value in the flag parameter.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsProgressPanel;
///A Boolean value that determines whether the Print panel includes a control for scaling the printed output.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? showsScaling;
///A timestamp that specifies the time at which printing should begin.
///
///**Supported Platforms/Implementations**:
///- MacOS
int? time;
///The vertical pagination to the specified mode.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobPaginationMode? verticalPagination;
PrintJobSettings(
{this.handledByClient = false,
this.jobName,
this.animated = true,
this.orientation,
this.numberOfPages,
this.forceRenderingQuality,
this.margins,
this.mediaSize,
{this.animated = true,
this.canSpawnSeparateThread = true,
this.colorMode,
this.copies = 1,
this.detailedErrorReporting = false,
this.duplexMode,
this.outputType,
this.resolution,
this.showsNumberOfCopies = true,
this.showsPaperSelectionForLoadedPapers = false,
this.showsPaperOrientation = true,
this.showsPaperSize = true,
this.showsScaling = true,
this.showsPageRange = true,
this.showsPageSetupAccessory = true,
this.showsPreview = true,
this.showsPrintSelection = true,
this.showsPrintPanel = true,
this.showsProgressPanel = true,
this.faxNumber,
this.firstPage,
this.footerHeight,
this.forceRenderingQuality,
this.handledByClient = false,
this.headerAndFooter = true,
this.headerHeight,
this.maximumContentHeight,
this.maximumContentWidth,
this.scalingFactor,
this.jobDisposition,
this.jobSavingURL,
this.paperName,
this.horizontalPagination,
this.verticalPagination,
this.isHorizontallyCentered = true,
this.isVerticallyCentered = true,
this.pageOrder,
this.canSpawnSeparateThread = true,
this.copies = 1,
this.firstPage,
this.jobDisposition,
this.jobName,
this.jobSavingURL,
this.lastPage,
this.detailedErrorReporting = false,
this.faxNumber,
this.headerAndFooter = true,
this.margins,
this.maximumContentHeight,
this.maximumContentWidth,
this.mediaSize,
this.mustCollate,
this.numberOfPages,
this.orientation,
this.outputType,
this.pageOrder,
this.pagesAcross,
this.pagesDown,
this.time});
this.paperName,
this.resolution,
this.scalingFactor,
this.showsNumberOfCopies = true,
this.showsPageRange = true,
this.showsPageSetupAccessory = true,
this.showsPaperOrientation = true,
this.showsPaperSelectionForLoadedPapers = false,
this.showsPaperSize = true,
this.showsPreview = true,
this.showsPrintPanel = true,
this.showsPrintSelection = true,
this.showsProgressPanel = true,
this.showsScaling = true,
this.time,
this.verticalPagination});
///Gets a possible [PrintJobSettings] instance from a [Map] value.
static PrintJobSettings? fromMap(Map<String, dynamic>? map) {
@ -410,115 +410,115 @@ class PrintJobSettings {
return null;
}
final instance = PrintJobSettings(
jobName: map['jobName'],
orientation: PrintJobOrientation.fromNativeValue(map['orientation']),
numberOfPages: map['numberOfPages'],
forceRenderingQuality: PrintJobRenderingQuality.fromNativeValue(
map['forceRenderingQuality']),
margins: MapEdgeInsets.fromMap(map['margins']?.cast<String, dynamic>()),
mediaSize:
PrintJobMediaSize.fromMap(map['mediaSize']?.cast<String, dynamic>()),
colorMode: PrintJobColorMode.fromNativeValue(map['colorMode']),
duplexMode: PrintJobDuplexMode.fromNativeValue(map['duplexMode']),
outputType: PrintJobOutputType.fromNativeValue(map['outputType']),
resolution: PrintJobResolution.fromMap(
map['resolution']?.cast<String, dynamic>()),
faxNumber: map['faxNumber'],
firstPage: map['firstPage'],
footerHeight: map['footerHeight'],
forceRenderingQuality: PrintJobRenderingQuality.fromNativeValue(
map['forceRenderingQuality']),
headerHeight: map['headerHeight'],
maximumContentHeight: map['maximumContentHeight'],
maximumContentWidth: map['maximumContentWidth'],
scalingFactor: map['scalingFactor'],
jobDisposition:
PrintJobDisposition.fromNativeValue(map['jobDisposition']),
jobSavingURL:
map['jobSavingURL'] != null ? WebUri(map['jobSavingURL']) : null,
paperName: map['paperName'],
horizontalPagination:
PrintJobPaginationMode.fromNativeValue(map['horizontalPagination']),
verticalPagination:
PrintJobPaginationMode.fromNativeValue(map['verticalPagination']),
pageOrder: PrintJobPageOrder.fromNativeValue(map['pageOrder']),
firstPage: map['firstPage'],
jobDisposition:
PrintJobDisposition.fromNativeValue(map['jobDisposition']),
jobName: map['jobName'],
jobSavingURL:
map['jobSavingURL'] != null ? WebUri(map['jobSavingURL']) : null,
lastPage: map['lastPage'],
faxNumber: map['faxNumber'],
margins: MapEdgeInsets.fromMap(map['margins']?.cast<String, dynamic>()),
maximumContentHeight: map['maximumContentHeight'],
maximumContentWidth: map['maximumContentWidth'],
mediaSize:
PrintJobMediaSize.fromMap(map['mediaSize']?.cast<String, dynamic>()),
mustCollate: map['mustCollate'],
numberOfPages: map['numberOfPages'],
orientation: PrintJobOrientation.fromNativeValue(map['orientation']),
outputType: PrintJobOutputType.fromNativeValue(map['outputType']),
pageOrder: PrintJobPageOrder.fromNativeValue(map['pageOrder']),
pagesAcross: map['pagesAcross'],
pagesDown: map['pagesDown'],
paperName: map['paperName'],
resolution: PrintJobResolution.fromMap(
map['resolution']?.cast<String, dynamic>()),
scalingFactor: map['scalingFactor'],
time: map['time'],
verticalPagination:
PrintJobPaginationMode.fromNativeValue(map['verticalPagination']),
);
instance.handledByClient = map['handledByClient'];
instance.animated = map['animated'];
instance.showsNumberOfCopies = map['showsNumberOfCopies'];
instance.showsPaperSelectionForLoadedPapers =
map['showsPaperSelectionForLoadedPapers'];
instance.showsPaperOrientation = map['showsPaperOrientation'];
instance.showsPaperSize = map['showsPaperSize'];
instance.showsScaling = map['showsScaling'];
instance.showsPageRange = map['showsPageRange'];
instance.showsPageSetupAccessory = map['showsPageSetupAccessory'];
instance.showsPreview = map['showsPreview'];
instance.showsPrintSelection = map['showsPrintSelection'];
instance.showsPrintPanel = map['showsPrintPanel'];
instance.showsProgressPanel = map['showsProgressPanel'];
instance.isHorizontallyCentered = map['isHorizontallyCentered'];
instance.isVerticallyCentered = map['isVerticallyCentered'];
instance.canSpawnSeparateThread = map['canSpawnSeparateThread'];
instance.copies = map['copies'];
instance.detailedErrorReporting = map['detailedErrorReporting'];
instance.handledByClient = map['handledByClient'];
instance.headerAndFooter = map['headerAndFooter'];
instance.isHorizontallyCentered = map['isHorizontallyCentered'];
instance.isVerticallyCentered = map['isVerticallyCentered'];
instance.showsNumberOfCopies = map['showsNumberOfCopies'];
instance.showsPageRange = map['showsPageRange'];
instance.showsPageSetupAccessory = map['showsPageSetupAccessory'];
instance.showsPaperOrientation = map['showsPaperOrientation'];
instance.showsPaperSelectionForLoadedPapers =
map['showsPaperSelectionForLoadedPapers'];
instance.showsPaperSize = map['showsPaperSize'];
instance.showsPreview = map['showsPreview'];
instance.showsPrintPanel = map['showsPrintPanel'];
instance.showsPrintSelection = map['showsPrintSelection'];
instance.showsProgressPanel = map['showsProgressPanel'];
instance.showsScaling = map['showsScaling'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"handledByClient": handledByClient,
"jobName": jobName,
"animated": animated,
"orientation": orientation?.toNativeValue(),
"numberOfPages": numberOfPages,
"forceRenderingQuality": forceRenderingQuality?.toNativeValue(),
"margins": margins?.toMap(),
"mediaSize": mediaSize?.toMap(),
"canSpawnSeparateThread": canSpawnSeparateThread,
"colorMode": colorMode?.toNativeValue(),
"copies": copies,
"detailedErrorReporting": detailedErrorReporting,
"duplexMode": duplexMode?.toNativeValue(),
"outputType": outputType?.toNativeValue(),
"resolution": resolution?.toMap(),
"showsNumberOfCopies": showsNumberOfCopies,
"showsPaperSelectionForLoadedPapers": showsPaperSelectionForLoadedPapers,
"showsPaperOrientation": showsPaperOrientation,
"showsPaperSize": showsPaperSize,
"showsScaling": showsScaling,
"showsPageRange": showsPageRange,
"showsPageSetupAccessory": showsPageSetupAccessory,
"showsPreview": showsPreview,
"showsPrintSelection": showsPrintSelection,
"showsPrintPanel": showsPrintPanel,
"showsProgressPanel": showsProgressPanel,
"faxNumber": faxNumber,
"firstPage": firstPage,
"footerHeight": footerHeight,
"forceRenderingQuality": forceRenderingQuality?.toNativeValue(),
"handledByClient": handledByClient,
"headerAndFooter": headerAndFooter,
"headerHeight": headerHeight,
"maximumContentHeight": maximumContentHeight,
"maximumContentWidth": maximumContentWidth,
"scalingFactor": scalingFactor,
"jobDisposition": jobDisposition?.toNativeValue(),
"jobSavingURL": jobSavingURL?.toString(),
"paperName": paperName,
"horizontalPagination": horizontalPagination?.toNativeValue(),
"verticalPagination": verticalPagination?.toNativeValue(),
"isHorizontallyCentered": isHorizontallyCentered,
"isVerticallyCentered": isVerticallyCentered,
"pageOrder": pageOrder?.toNativeValue(),
"canSpawnSeparateThread": canSpawnSeparateThread,
"copies": copies,
"firstPage": firstPage,
"jobDisposition": jobDisposition?.toNativeValue(),
"jobName": jobName,
"jobSavingURL": jobSavingURL?.toString(),
"lastPage": lastPage,
"detailedErrorReporting": detailedErrorReporting,
"faxNumber": faxNumber,
"headerAndFooter": headerAndFooter,
"margins": margins?.toMap(),
"maximumContentHeight": maximumContentHeight,
"maximumContentWidth": maximumContentWidth,
"mediaSize": mediaSize?.toMap(),
"mustCollate": mustCollate,
"numberOfPages": numberOfPages,
"orientation": orientation?.toNativeValue(),
"outputType": outputType?.toNativeValue(),
"pageOrder": pageOrder?.toNativeValue(),
"pagesAcross": pagesAcross,
"pagesDown": pagesDown,
"paperName": paperName,
"resolution": resolution?.toMap(),
"scalingFactor": scalingFactor,
"showsNumberOfCopies": showsNumberOfCopies,
"showsPageRange": showsPageRange,
"showsPageSetupAccessory": showsPageSetupAccessory,
"showsPaperOrientation": showsPaperOrientation,
"showsPaperSelectionForLoadedPapers": showsPaperSelectionForLoadedPapers,
"showsPaperSize": showsPaperSize,
"showsPreview": showsPreview,
"showsPrintPanel": showsPrintPanel,
"showsPrintSelection": showsPrintSelection,
"showsProgressPanel": showsProgressPanel,
"showsScaling": showsScaling,
"time": time,
"verticalPagination": verticalPagination?.toNativeValue(),
};
}
@ -534,6 +534,6 @@ class PrintJobSettings {
@override
String toString() {
return 'PrintJobSettings{handledByClient: $handledByClient, jobName: $jobName, animated: $animated, orientation: $orientation, numberOfPages: $numberOfPages, forceRenderingQuality: $forceRenderingQuality, margins: $margins, mediaSize: $mediaSize, colorMode: $colorMode, duplexMode: $duplexMode, outputType: $outputType, resolution: $resolution, showsNumberOfCopies: $showsNumberOfCopies, showsPaperSelectionForLoadedPapers: $showsPaperSelectionForLoadedPapers, showsPaperOrientation: $showsPaperOrientation, showsPaperSize: $showsPaperSize, showsScaling: $showsScaling, showsPageRange: $showsPageRange, showsPageSetupAccessory: $showsPageSetupAccessory, showsPreview: $showsPreview, showsPrintSelection: $showsPrintSelection, showsPrintPanel: $showsPrintPanel, showsProgressPanel: $showsProgressPanel, footerHeight: $footerHeight, headerHeight: $headerHeight, maximumContentHeight: $maximumContentHeight, maximumContentWidth: $maximumContentWidth, scalingFactor: $scalingFactor, jobDisposition: $jobDisposition, jobSavingURL: $jobSavingURL, paperName: $paperName, horizontalPagination: $horizontalPagination, verticalPagination: $verticalPagination, isHorizontallyCentered: $isHorizontallyCentered, isVerticallyCentered: $isVerticallyCentered, pageOrder: $pageOrder, canSpawnSeparateThread: $canSpawnSeparateThread, copies: $copies, firstPage: $firstPage, lastPage: $lastPage, detailedErrorReporting: $detailedErrorReporting, faxNumber: $faxNumber, headerAndFooter: $headerAndFooter, mustCollate: $mustCollate, pagesAcross: $pagesAcross, pagesDown: $pagesDown, time: $time}';
return 'PrintJobSettings{animated: $animated, canSpawnSeparateThread: $canSpawnSeparateThread, colorMode: $colorMode, copies: $copies, detailedErrorReporting: $detailedErrorReporting, duplexMode: $duplexMode, faxNumber: $faxNumber, firstPage: $firstPage, footerHeight: $footerHeight, forceRenderingQuality: $forceRenderingQuality, handledByClient: $handledByClient, headerAndFooter: $headerAndFooter, headerHeight: $headerHeight, horizontalPagination: $horizontalPagination, isHorizontallyCentered: $isHorizontallyCentered, isVerticallyCentered: $isVerticallyCentered, jobDisposition: $jobDisposition, jobName: $jobName, jobSavingURL: $jobSavingURL, lastPage: $lastPage, margins: $margins, maximumContentHeight: $maximumContentHeight, maximumContentWidth: $maximumContentWidth, mediaSize: $mediaSize, mustCollate: $mustCollate, numberOfPages: $numberOfPages, orientation: $orientation, outputType: $outputType, pageOrder: $pageOrder, pagesAcross: $pagesAcross, pagesDown: $pagesDown, paperName: $paperName, resolution: $resolution, scalingFactor: $scalingFactor, showsNumberOfCopies: $showsNumberOfCopies, showsPageRange: $showsPageRange, showsPageSetupAccessory: $showsPageSetupAccessory, showsPaperOrientation: $showsPaperOrientation, showsPaperSelectionForLoadedPapers: $showsPaperSelectionForLoadedPapers, showsPaperSize: $showsPaperSize, showsPreview: $showsPreview, showsPrintPanel: $showsPrintPanel, showsPrintSelection: $showsPrintSelection, showsProgressPanel: $showsProgressPanel, showsScaling: $showsScaling, time: $time, verticalPagination: $verticalPagination}';
}
}

View File

@ -8,20 +8,11 @@ part of 'pull_to_refresh_settings.dart';
///Pull-To-Refresh Settings
class PullToRefreshSettings {
///Sets whether the pull-to-refresh feature is enabled or not.
///The default value is `true`.
///The title text to display in the refresh control.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
bool? enabled;
///The color of the refresh control.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
Color? color;
AttributedString? attributedTitle;
///The background color of the refresh control.
///
@ -30,17 +21,26 @@ class PullToRefreshSettings {
///- iOS
Color? backgroundColor;
///The color of the refresh control.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
Color? color;
///The distance to trigger a sync in dips.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
int? distanceToTriggerSync;
///The distance in pixels that the refresh indicator can be pulled beyond its resting position.
///Sets whether the pull-to-refresh feature is enabled or not.
///The default value is `true`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
int? slingshotDistance;
///- iOS
bool? enabled;
///The size of the refresh indicator.
///
@ -48,19 +48,19 @@ class PullToRefreshSettings {
///- Android native WebView
PullToRefreshSize? size;
///The title text to display in the refresh control.
///The distance in pixels that the refresh indicator can be pulled beyond its resting position.
///
///**Supported Platforms/Implementations**:
///- iOS
AttributedString? attributedTitle;
///- Android native WebView
int? slingshotDistance;
PullToRefreshSettings(
{this.enabled = true,
this.color,
{this.attributedTitle,
this.backgroundColor,
this.color,
this.distanceToTriggerSync,
this.slingshotDistance,
this.enabled = true,
this.size,
this.attributedTitle});
this.slingshotDistance});
///Gets a possible [PullToRefreshSettings] instance from a [Map] value.
static PullToRefreshSettings? fromMap(Map<String, dynamic>? map) {
@ -68,17 +68,17 @@ class PullToRefreshSettings {
return null;
}
final instance = PullToRefreshSettings(
color: map['color'] != null
? UtilColor.fromStringRepresentation(map['color'])
: null,
attributedTitle: AttributedString.fromMap(
map['attributedTitle']?.cast<String, dynamic>()),
backgroundColor: map['backgroundColor'] != null
? UtilColor.fromStringRepresentation(map['backgroundColor'])
: null,
color: map['color'] != null
? UtilColor.fromStringRepresentation(map['color'])
: null,
distanceToTriggerSync: map['distanceToTriggerSync'],
slingshotDistance: map['slingshotDistance'],
size: PullToRefreshSize.fromNativeValue(map['size']),
attributedTitle: AttributedString.fromMap(
map['attributedTitle']?.cast<String, dynamic>()),
slingshotDistance: map['slingshotDistance'],
);
instance.enabled = map['enabled'];
return instance;
@ -87,13 +87,13 @@ class PullToRefreshSettings {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"enabled": enabled,
"color": color?.toHex(),
"backgroundColor": backgroundColor?.toHex(),
"distanceToTriggerSync": distanceToTriggerSync,
"slingshotDistance": slingshotDistance,
"size": size?.toNativeValue(),
"attributedTitle": attributedTitle?.toMap(),
"backgroundColor": backgroundColor?.toHex(),
"color": color?.toHex(),
"distanceToTriggerSync": distanceToTriggerSync,
"enabled": enabled,
"size": size?.toNativeValue(),
"slingshotDistance": slingshotDistance,
};
}
@ -109,6 +109,6 @@ class PullToRefreshSettings {
@override
String toString() {
return 'PullToRefreshSettings{enabled: $enabled, color: $color, backgroundColor: $backgroundColor, distanceToTriggerSync: $distanceToTriggerSync, slingshotDistance: $slingshotDistance, size: $size, attributedTitle: $attributedTitle}';
return 'PullToRefreshSettings{attributedTitle: $attributedTitle, backgroundColor: $backgroundColor, color: $color, distanceToTriggerSync: $distanceToTriggerSync, enabled: $enabled, size: $size, slingshotDistance: $slingshotDistance}';
}
}

View File

@ -19,21 +19,21 @@ class ActionModeMenuItem {
///No menu items should be disabled.
static const MENU_ITEM_NONE = ActionModeMenuItem._internal(0, 0);
///Disable all the action mode menu items for text processing.
static const MENU_ITEM_PROCESS_TEXT = ActionModeMenuItem._internal(4, 4);
///Disable menu item "Share".
static const MENU_ITEM_SHARE = ActionModeMenuItem._internal(1, 1);
///Disable menu item "Web Search".
static const MENU_ITEM_WEB_SEARCH = ActionModeMenuItem._internal(2, 2);
///Disable all the action mode menu items for text processing.
static const MENU_ITEM_PROCESS_TEXT = ActionModeMenuItem._internal(4, 4);
///Set of all values of [ActionModeMenuItem].
static final Set<ActionModeMenuItem> values = [
ActionModeMenuItem.MENU_ITEM_NONE,
ActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
ActionModeMenuItem.MENU_ITEM_SHARE,
ActionModeMenuItem.MENU_ITEM_WEB_SEARCH,
ActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
].toSet();
///Gets a possible [ActionModeMenuItem] instance from [int] value.
@ -82,12 +82,12 @@ class ActionModeMenuItem {
switch (_value) {
case 0:
return 'MENU_ITEM_NONE';
case 4:
return 'MENU_ITEM_PROCESS_TEXT';
case 1:
return 'MENU_ITEM_SHARE';
case 2:
return 'MENU_ITEM_WEB_SEARCH';
case 4:
return 'MENU_ITEM_PROCESS_TEXT';
}
return _value.toString();
}
@ -111,22 +111,22 @@ class AndroidActionModeMenuItem {
///No menu items should be disabled.
static const MENU_ITEM_NONE = AndroidActionModeMenuItem._internal(0, 0);
///Disable all the action mode menu items for text processing.
static const MENU_ITEM_PROCESS_TEXT =
AndroidActionModeMenuItem._internal(4, 4);
///Disable menu item "Share".
static const MENU_ITEM_SHARE = AndroidActionModeMenuItem._internal(1, 1);
///Disable menu item "Web Search".
static const MENU_ITEM_WEB_SEARCH = AndroidActionModeMenuItem._internal(2, 2);
///Disable all the action mode menu items for text processing.
static const MENU_ITEM_PROCESS_TEXT =
AndroidActionModeMenuItem._internal(4, 4);
///Set of all values of [AndroidActionModeMenuItem].
static final Set<AndroidActionModeMenuItem> values = [
AndroidActionModeMenuItem.MENU_ITEM_NONE,
AndroidActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
AndroidActionModeMenuItem.MENU_ITEM_SHARE,
AndroidActionModeMenuItem.MENU_ITEM_WEB_SEARCH,
AndroidActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
].toSet();
///Gets a possible [AndroidActionModeMenuItem] instance from [int] value.
@ -175,12 +175,12 @@ class AndroidActionModeMenuItem {
switch (_value) {
case 0:
return 'MENU_ITEM_NONE';
case 4:
return 'MENU_ITEM_PROCESS_TEXT';
case 1:
return 'MENU_ITEM_SHARE';
case 2:
return 'MENU_ITEM_WEB_SEARCH';
case 4:
return 'MENU_ITEM_PROCESS_TEXT';
}
return _value.toString();
}

View File

@ -15,11 +15,11 @@ part of 'activity_button.dart';
///**Supported Platforms/Implementations**:
///- iOS
class ActivityButton {
///The name of the image asset or file.
UIImage templateImage;
///The name of the App or Share Extension to be called.
String extensionIdentifier;
///The name of the image asset or file.
UIImage templateImage;
ActivityButton(
{required this.templateImage, required this.extensionIdentifier});
@ -29,9 +29,9 @@ class ActivityButton {
return null;
}
final instance = ActivityButton(
extensionIdentifier: map['extensionIdentifier'],
templateImage:
UIImage.fromMap(map['templateImage']?.cast<String, dynamic>())!,
extensionIdentifier: map['extensionIdentifier'],
);
return instance;
}
@ -39,8 +39,8 @@ class ActivityButton {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"templateImage": templateImage.toMap(),
"extensionIdentifier": extensionIdentifier,
"templateImage": templateImage.toMap(),
};
}
@ -51,6 +51,6 @@ class ActivityButton {
@override
String toString() {
return 'ActivityButton{templateImage: $templateImage, extensionIdentifier: $extensionIdentifier}';
return 'ActivityButton{extensionIdentifier: $extensionIdentifier, templateImage: $templateImage}';
}
}

View File

@ -54,7 +54,7 @@ class AjaxRequest_ {
///If an empty string is set as the value of responseType, the default value of text is used.
String? responseType;
///The response's body content. The content-type depends on the [AjaxRequest.reponseType].
///The response's body content. The content-type depends on the [AjaxRequest.responseType].
dynamic response;
///The text received from a server following a request being sent.

View File

@ -8,92 +8,92 @@ part of 'ajax_request.dart';
///Class that represents a JavaScript [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object.
class AjaxRequest {
///Indicates the [AjaxRequestAction] that can be used to control the `XMLHttpRequest` request.
AjaxRequestAction? action;
///Data passed as a parameter to the `XMLHttpRequest.send()` method.
dynamic data;
///The HTTP request method of the `XMLHttpRequest` request.
String? method;
///The URL of the `XMLHttpRequest` request.
WebUri? url;
///An optional Boolean parameter, defaulting to true, indicating whether or not the request is performed asynchronously.
bool? isAsync;
///The optional user name to use for authentication purposes; by default, this is the null value.
String? user;
///The optional password to use for authentication purposes; by default, this is the null value.
String? password;
///The XMLHttpRequest.withCredentials property is a Boolean that indicates whether or not cross-site Access-Control requests
///should be made using credentials such as cookies, authorization headers or TLS client certificates.
///Setting withCredentials has no effect on same-site requests.
///In addition, this flag is also used to indicate when cookies are to be ignored in the response. The default is false.
bool? withCredentials;
///Event type of the `XMLHttpRequest` request.
AjaxRequestEvent? event;
///The HTTP request headers.
AjaxRequestHeaders? headers;
///An optional Boolean parameter, defaulting to true, indicating whether or not the request is performed asynchronously.
bool? isAsync;
///The HTTP request method of the `XMLHttpRequest` request.
String? method;
///The optional password to use for authentication purposes; by default, this is the null value.
String? password;
///The state of the `XMLHttpRequest` request.
AjaxRequestReadyState? readyState;
///The numerical HTTP [status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) of the `XMLHttpRequest`'s response.
int? status;
///The response's body content. The content-type depends on the [AjaxRequest.responseType].
dynamic response;
///The serialized URL of the response or the empty string if the URL is null.
///If the URL is returned, any URL fragment present in the URL will be stripped away.
///The value of responseURL will be the final URL obtained after any redirects.
WebUri? responseURL;
///All the response headers or returns null if no response has been received. If a network error happened, an empty string is returned.
Map<String, dynamic>? responseHeaders;
///The text received from a server following a request being sent.
String? responseText;
///It is an enumerated string value specifying the type of data contained in the response.
///It also lets the author change the [response type](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType).
///If an empty string is set as the value of responseType, the default value of text is used.
String? responseType;
///The response's body content. The content-type depends on the [AjaxRequest.reponseType].
dynamic response;
///The text received from a server following a request being sent.
String? responseText;
///The serialized URL of the response or the empty string if the URL is null.
///If the URL is returned, any URL fragment present in the URL will be stripped away.
///The value of responseURL will be the final URL obtained after any redirects.
WebUri? responseURL;
///The HTML or XML string retrieved by the request or null if the request was unsuccessful, has not yet been sent, or if the data can't be parsed as XML or HTML.
String? responseXML;
///The numerical HTTP [status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) of the `XMLHttpRequest`'s response.
int? status;
///A String containing the response's status message as returned by the HTTP server.
///Unlike [AjaxRequest.status] which indicates a numerical status code, this property contains the text of the response status, such as "OK" or "Not Found".
///If the request's readyState is in [AjaxRequestReadyState.UNSENT] or [AjaxRequestReadyState.OPENED] state, the value of statusText will be an empty string.
///If the server response doesn't explicitly specify a status text, statusText will assume the default value "OK".
String? statusText;
///All the response headers or returns null if no response has been received. If a network error happened, an empty string is returned.
Map<String, dynamic>? responseHeaders;
///The URL of the `XMLHttpRequest` request.
WebUri? url;
///Event type of the `XMLHttpRequest` request.
AjaxRequestEvent? event;
///The optional user name to use for authentication purposes; by default, this is the null value.
String? user;
///Indicates the [AjaxRequestAction] that can be used to control the `XMLHttpRequest` request.
AjaxRequestAction? action;
///The XMLHttpRequest.withCredentials property is a Boolean that indicates whether or not cross-site Access-Control requests
///should be made using credentials such as cookies, authorization headers or TLS client certificates.
///Setting withCredentials has no effect on same-site requests.
///In addition, this flag is also used to indicate when cookies are to be ignored in the response. The default is false.
bool? withCredentials;
AjaxRequest(
{this.data,
this.method,
this.url,
this.isAsync,
this.user,
this.password,
this.withCredentials,
this.headers,
this.readyState,
this.status,
this.responseURL,
this.responseType,
this.response,
this.responseText,
this.responseXML,
this.statusText,
this.responseHeaders,
{this.action = AjaxRequestAction.PROCEED,
this.data,
this.event,
this.action = AjaxRequestAction.PROCEED});
this.headers,
this.isAsync,
this.method,
this.password,
this.readyState,
this.response,
this.responseHeaders,
this.responseText,
this.responseType,
this.responseURL,
this.responseXML,
this.status,
this.statusText,
this.url,
this.user,
this.withCredentials});
///Gets a possible [AjaxRequest] instance from a [Map] value.
static AjaxRequest? fromMap(Map<String, dynamic>? map) {
@ -102,25 +102,25 @@ class AjaxRequest {
}
final instance = AjaxRequest(
data: map['data'],
method: map['method'],
url: map['url'] != null ? WebUri(map['url']) : null,
isAsync: map['isAsync'],
user: map['user'],
password: map['password'],
withCredentials: map['withCredentials'],
event: AjaxRequestEvent.fromMap(map['event']?.cast<String, dynamic>()),
headers:
AjaxRequestHeaders.fromMap(map['headers']?.cast<String, dynamic>()),
isAsync: map['isAsync'],
method: map['method'],
password: map['password'],
readyState: AjaxRequestReadyState.fromNativeValue(map['readyState']),
status: map['status'],
response: map['response'],
responseHeaders: map['responseHeaders']?.cast<String, dynamic>(),
responseText: map['responseText'],
responseType: map['responseType'],
responseURL:
map['responseURL'] != null ? WebUri(map['responseURL']) : null,
responseType: map['responseType'],
response: map['response'],
responseText: map['responseText'],
responseXML: map['responseXML'],
status: map['status'],
statusText: map['statusText'],
responseHeaders: map['responseHeaders']?.cast<String, dynamic>(),
event: AjaxRequestEvent.fromMap(map['event']?.cast<String, dynamic>()),
url: map['url'] != null ? WebUri(map['url']) : null,
user: map['user'],
withCredentials: map['withCredentials'],
);
instance.action = AjaxRequestAction.fromNativeValue(map['action']);
return instance;
@ -129,25 +129,25 @@ class AjaxRequest {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"data": data,
"method": method,
"url": url?.toString(),
"isAsync": isAsync,
"user": user,
"password": password,
"withCredentials": withCredentials,
"headers": headers?.toMap(),
"readyState": readyState?.toNativeValue(),
"status": status,
"responseURL": responseURL?.toString(),
"responseType": responseType,
"response": response,
"responseText": responseText,
"responseXML": responseXML,
"statusText": statusText,
"responseHeaders": responseHeaders,
"event": event?.toMap(),
"action": action?.toNativeValue(),
"data": data,
"event": event?.toMap(),
"headers": headers?.toMap(),
"isAsync": isAsync,
"method": method,
"password": password,
"readyState": readyState?.toNativeValue(),
"response": response,
"responseHeaders": responseHeaders,
"responseText": responseText,
"responseType": responseType,
"responseURL": responseURL?.toString(),
"responseXML": responseXML,
"status": status,
"statusText": statusText,
"url": url?.toString(),
"user": user,
"withCredentials": withCredentials,
};
}
@ -158,6 +158,6 @@ class AjaxRequest {
@override
String toString() {
return 'AjaxRequest{data: $data, method: $method, url: $url, isAsync: $isAsync, user: $user, password: $password, withCredentials: $withCredentials, headers: $headers, readyState: $readyState, status: $status, responseURL: $responseURL, responseType: $responseType, response: $response, responseText: $responseText, responseXML: $responseXML, statusText: $statusText, responseHeaders: $responseHeaders, event: $event, action: $action}';
return 'AjaxRequest{action: $action, data: $data, event: $event, headers: $headers, isAsync: $isAsync, method: $method, password: $password, readyState: $readyState, response: $response, responseHeaders: $responseHeaders, responseText: $responseText, responseType: $responseType, responseURL: $responseURL, responseXML: $responseXML, status: $status, statusText: $statusText, url: $url, user: $user, withCredentials: $withCredentials}';
}
}

View File

@ -8,9 +8,6 @@ part of 'ajax_request_event.dart';
///Class used by [AjaxRequest] class. It represents events measuring progress of an [AjaxRequest].
class AjaxRequestEvent {
///Event type.
AjaxRequestEventType? type;
///Is a Boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable.
///In other words, it tells if the progress is measurable or not.
bool? lengthComputable;
@ -23,7 +20,10 @@ class AjaxRequestEvent {
///Is an integer representing the total amount of work that the underlying process is in the progress of performing.
///When downloading a resource using HTTP, this only represent the content itself, not headers and other overhead.
int? total;
AjaxRequestEvent({this.type, this.lengthComputable, this.loaded, this.total});
///Event type.
AjaxRequestEventType? type;
AjaxRequestEvent({this.lengthComputable, this.loaded, this.total, this.type});
///Gets a possible [AjaxRequestEvent] instance from a [Map] value.
static AjaxRequestEvent? fromMap(Map<String, dynamic>? map) {
@ -31,10 +31,10 @@ class AjaxRequestEvent {
return null;
}
final instance = AjaxRequestEvent(
type: AjaxRequestEventType.fromNativeValue(map['type']),
lengthComputable: map['lengthComputable'],
loaded: map['loaded'],
total: map['total'],
type: AjaxRequestEventType.fromNativeValue(map['type']),
);
return instance;
}
@ -42,10 +42,10 @@ class AjaxRequestEvent {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type?.toNativeValue(),
"lengthComputable": lengthComputable,
"loaded": loaded,
"total": total,
"type": type?.toNativeValue(),
};
}
@ -56,6 +56,6 @@ class AjaxRequestEvent {
@override
String toString() {
return 'AjaxRequestEvent{type: $type, lengthComputable: $lengthComputable, loaded: $loaded, total: $total}';
return 'AjaxRequestEvent{lengthComputable: $lengthComputable, loaded: $loaded, total: $total, type: $type}';
}
}

View File

@ -16,9 +16,11 @@ class AjaxRequestEventType {
String value, Function nativeValue) =>
AjaxRequestEventType._internal(value, nativeValue());
///The LOADSTART event is fired when a request has started to load data.
static const LOADSTART =
AjaxRequestEventType._internal('loadstart', 'loadstart');
///The ABORT event is fired when a request has been aborted.
static const ABORT = AjaxRequestEventType._internal('abort', 'abort');
///The ERROR event is fired when the request encountered an error.
static const ERROR = AjaxRequestEventType._internal('error', 'error');
///The LOAD event is fired when an `XMLHttpRequest` transaction completes successfully.
static const LOAD = AjaxRequestEventType._internal('load', 'load');
@ -27,27 +29,25 @@ class AjaxRequestEventType {
///unsuccessfully (after [AjaxRequestEventType.ABORT] or [AjaxRequestEventType.ERROR]).
static const LOADEND = AjaxRequestEventType._internal('loadend', 'loadend');
///The LOADSTART event is fired when a request has started to load data.
static const LOADSTART =
AjaxRequestEventType._internal('loadstart', 'loadstart');
///The PROGRESS event is fired periodically when a request receives more data.
static const PROGRESS =
AjaxRequestEventType._internal('progress', 'progress');
///The ERROR event is fired when the request encountered an error.
static const ERROR = AjaxRequestEventType._internal('error', 'error');
///The ABORT event is fired when a request has been aborted.
static const ABORT = AjaxRequestEventType._internal('abort', 'abort');
///The TIMEOUT event is fired when progression is terminated due to preset time expiring.
static const TIMEOUT = AjaxRequestEventType._internal('timeout', 'timeout');
///Set of all values of [AjaxRequestEventType].
static final Set<AjaxRequestEventType> values = [
AjaxRequestEventType.LOADSTART,
AjaxRequestEventType.ABORT,
AjaxRequestEventType.ERROR,
AjaxRequestEventType.LOAD,
AjaxRequestEventType.LOADEND,
AjaxRequestEventType.LOADSTART,
AjaxRequestEventType.PROGRESS,
AjaxRequestEventType.ERROR,
AjaxRequestEventType.ABORT,
AjaxRequestEventType.TIMEOUT,
].toSet();

View File

@ -16,11 +16,8 @@ class AjaxRequestReadyState {
int value, Function nativeValue) =>
AjaxRequestReadyState._internal(value, nativeValue());
///Client has been created. `XMLHttpRequest.open()` not called yet.
static const UNSENT = AjaxRequestReadyState._internal(0, 0);
///`XMLHttpRequest.open()` has been called.
static const OPENED = AjaxRequestReadyState._internal(1, 1);
///The operation is complete.
static const DONE = AjaxRequestReadyState._internal(4, 4);
///`XMLHttpRequest.send()` has been called, and [AjaxRequest.headers] and [AjaxRequest.status] are available.
static const HEADERS_RECEIVED = AjaxRequestReadyState._internal(2, 2);
@ -28,16 +25,19 @@ class AjaxRequestReadyState {
///Downloading; [AjaxRequest.responseText] holds partial data.
static const LOADING = AjaxRequestReadyState._internal(3, 3);
///The operation is complete.
static const DONE = AjaxRequestReadyState._internal(4, 4);
///`XMLHttpRequest.open()` has been called.
static const OPENED = AjaxRequestReadyState._internal(1, 1);
///Client has been created. `XMLHttpRequest.open()` not called yet.
static const UNSENT = AjaxRequestReadyState._internal(0, 0);
///Set of all values of [AjaxRequestReadyState].
static final Set<AjaxRequestReadyState> values = [
AjaxRequestReadyState.UNSENT,
AjaxRequestReadyState.OPENED,
AjaxRequestReadyState.DONE,
AjaxRequestReadyState.HEADERS_RECEIVED,
AjaxRequestReadyState.LOADING,
AjaxRequestReadyState.DONE,
AjaxRequestReadyState.OPENED,
AjaxRequestReadyState.UNSENT,
].toSet();
///Gets a possible [AjaxRequestReadyState] instance from [int] value.
@ -81,16 +81,16 @@ class AjaxRequestReadyState {
@override
String toString() {
switch (_value) {
case 0:
return 'UNSENT';
case 1:
return 'OPENED';
case 4:
return 'DONE';
case 2:
return 'HEADERS_RECEIVED';
case 3:
return 'LOADING';
case 4:
return 'DONE';
case 1:
return 'OPENED';
case 0:
return 'UNSENT';
}
return _value.toString();
}

View File

@ -8,6 +8,18 @@ part of 'android_resource.dart';
///Class that represents an Android resource file.
class AndroidResource {
///Optional default package to find, if "package:" is not included in the name.
///Can be `null` to require an explicit package.
///
///Example: "android" if you want use resources from `android.R.`
String? defPackage;
///Optional default resource type to find, if "type/" is not included in the name.
///Can be `null` to require an explicit type.
///
///Example: "anim"
String? defType;
///Android resource name.
///
///A list of available `android.R.anim` can be found
@ -18,19 +30,7 @@ class AndroidResource {
///(abc_*.xml files).
///In this case, [defPackage] must match your App Android package name.
String name;
///Optional default resource type to find, if "type/" is not included in the name.
///Can be `null` to require an explicit type.
///
///Example: "anim"
String? defType;
///Optional default package to find, if "package:" is not included in the name.
///Can be `null` to require an explicit package.
///
///Example: "android" if you want use resources from `android.R.`
String? defPackage;
AndroidResource({required this.name, this.defType, this.defPackage});
AndroidResource({this.defPackage, this.defType, required this.name});
///Gets a possible [AndroidResource] instance from a [Map] value.
static AndroidResource? fromMap(Map<String, dynamic>? map) {
@ -38,9 +38,9 @@ class AndroidResource {
return null;
}
final instance = AndroidResource(
name: map['name'],
defType: map['defType'],
defPackage: map['defPackage'],
defType: map['defType'],
name: map['name'],
);
return instance;
}
@ -61,9 +61,9 @@ class AndroidResource {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"name": name,
"defType": defType,
"defPackage": defPackage,
"defType": defType,
"name": name,
};
}
@ -74,6 +74,6 @@ class AndroidResource {
@override
String toString() {
return 'AndroidResource{name: $name, defType: $defType, defPackage: $defPackage}';
return 'AndroidResource{defPackage: $defPackage, defType: $defType, name: $name}';
}
}

View File

@ -9,9 +9,6 @@ part of 'attributed_string.dart';
///Class that represents a string with associated attributes
///used by the [PullToRefreshController] and [PullToRefreshSettings] classes.
class AttributedString {
///The characters for the new object.
String string;
///The color of the background behind the text.
///
///The value of this attribute is a [Color] object.
@ -72,6 +69,9 @@ class AttributedString {
///The default value for this attribute is [UnderlineStyle.STYLE_NONE].
UnderlineStyle? strikethroughStyle;
///The characters for the new object.
String string;
///The color of the stroke.
///
///The value of this parameter is a [Color] object.
@ -107,8 +107,7 @@ class AttributedString {
///The default value for this attribute is [UnderlineStyle.STYLE_NONE].
UnderlineStyle? underlineStyle;
AttributedString(
{required this.string,
this.backgroundColor,
{this.backgroundColor,
this.baselineOffset,
this.expansion,
this.foregroundColor,
@ -117,6 +116,7 @@ class AttributedString {
this.obliqueness,
this.strikethroughColor,
this.strikethroughStyle,
required this.string,
this.strokeColor,
this.strokeWidth,
this.textEffect,
@ -129,7 +129,6 @@ class AttributedString {
return null;
}
final instance = AttributedString(
string: map['string'],
backgroundColor: map['backgroundColor'] != null
? UtilColor.fromStringRepresentation(map['backgroundColor'])
: null,
@ -146,6 +145,7 @@ class AttributedString {
: null,
strikethroughStyle:
UnderlineStyle.fromNativeValue(map['strikethroughStyle']),
string: map['string'],
strokeColor: map['strokeColor'] != null
? UtilColor.fromStringRepresentation(map['strokeColor'])
: null,
@ -163,7 +163,6 @@ class AttributedString {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"string": string,
"backgroundColor": backgroundColor?.toHex(),
"baselineOffset": baselineOffset,
"expansion": expansion,
@ -173,6 +172,7 @@ class AttributedString {
"obliqueness": obliqueness,
"strikethroughColor": strikethroughColor?.toHex(),
"strikethroughStyle": strikethroughStyle?.toNativeValue(),
"string": string,
"strokeColor": strokeColor?.toHex(),
"strokeWidth": strokeWidth,
"textEffect": textEffect?.toNativeValue(),
@ -188,7 +188,7 @@ class AttributedString {
@override
String toString() {
return 'AttributedString{string: $string, backgroundColor: $backgroundColor, baselineOffset: $baselineOffset, expansion: $expansion, foregroundColor: $foregroundColor, kern: $kern, ligature: $ligature, obliqueness: $obliqueness, strikethroughColor: $strikethroughColor, strikethroughStyle: $strikethroughStyle, strokeColor: $strokeColor, strokeWidth: $strokeWidth, textEffect: $textEffect, underlineColor: $underlineColor, underlineStyle: $underlineStyle}';
return 'AttributedString{backgroundColor: $backgroundColor, baselineOffset: $baselineOffset, expansion: $expansion, foregroundColor: $foregroundColor, kern: $kern, ligature: $ligature, obliqueness: $obliqueness, strikethroughColor: $strikethroughColor, strikethroughStyle: $strikethroughStyle, string: $string, strokeColor: $strokeColor, strokeWidth: $strokeWidth, textEffect: $textEffect, underlineColor: $underlineColor, underlineStyle: $underlineStyle}';
}
}
@ -197,9 +197,6 @@ class AttributedString {
///Use [AttributedString] instead.
@Deprecated('Use AttributedString instead')
class IOSNSAttributedString {
///The characters for the new object.
String string;
///The color of the background behind the text.
///
///The value of this attribute is a [Color] object.
@ -260,6 +257,9 @@ class IOSNSAttributedString {
///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE].
IOSNSUnderlineStyle? strikethroughStyle;
///The characters for the new object.
String string;
///The color of the stroke.
///
///The value of this parameter is a [Color] object.
@ -295,8 +295,7 @@ class IOSNSAttributedString {
///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE].
IOSNSUnderlineStyle? underlineStyle;
IOSNSAttributedString(
{required this.string,
this.backgroundColor,
{this.backgroundColor,
this.baselineOffset,
this.expansion,
this.foregroundColor,
@ -305,6 +304,7 @@ class IOSNSAttributedString {
this.obliqueness,
this.strikethroughColor,
this.strikethroughStyle,
required this.string,
this.strokeColor,
this.strokeWidth,
this.textEffect,
@ -317,7 +317,6 @@ class IOSNSAttributedString {
return null;
}
final instance = IOSNSAttributedString(
string: map['string'],
backgroundColor: map['backgroundColor'] != null
? UtilColor.fromStringRepresentation(map['backgroundColor'])
: null,
@ -334,6 +333,7 @@ class IOSNSAttributedString {
: null,
strikethroughStyle:
IOSNSUnderlineStyle.fromNativeValue(map['strikethroughStyle']),
string: map['string'],
strokeColor: map['strokeColor'] != null
? UtilColor.fromStringRepresentation(map['strokeColor'])
: null,
@ -352,7 +352,6 @@ class IOSNSAttributedString {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"string": string,
"backgroundColor": backgroundColor?.toHex(),
"baselineOffset": baselineOffset,
"expansion": expansion,
@ -362,6 +361,7 @@ class IOSNSAttributedString {
"obliqueness": obliqueness,
"strikethroughColor": strikethroughColor?.toHex(),
"strikethroughStyle": strikethroughStyle?.toNativeValue(),
"string": string,
"strokeColor": strokeColor?.toHex(),
"strokeWidth": strokeWidth,
"textEffect": textEffect?.toNativeValue(),
@ -377,6 +377,6 @@ class IOSNSAttributedString {
@override
String toString() {
return 'IOSNSAttributedString{string: $string, backgroundColor: $backgroundColor, baselineOffset: $baselineOffset, expansion: $expansion, foregroundColor: $foregroundColor, kern: $kern, ligature: $ligature, obliqueness: $obliqueness, strikethroughColor: $strikethroughColor, strikethroughStyle: $strikethroughStyle, strokeColor: $strokeColor, strokeWidth: $strokeWidth, textEffect: $textEffect, underlineColor: $underlineColor, underlineStyle: $underlineStyle}';
return 'IOSNSAttributedString{backgroundColor: $backgroundColor, baselineOffset: $baselineOffset, expansion: $expansion, foregroundColor: $foregroundColor, kern: $kern, ligature: $ligature, obliqueness: $obliqueness, strikethroughColor: $strikethroughColor, strikethroughStyle: $strikethroughStyle, string: $string, strokeColor: $strokeColor, strokeWidth: $strokeWidth, textEffect: $textEffect, underlineColor: $underlineColor, underlineStyle: $underlineStyle}';
}
}

View File

@ -15,25 +15,25 @@ class CacheMode {
factory CacheMode._internalMultiPlatform(int value, Function nativeValue) =>
CacheMode._internal(value, nativeValue());
///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 = CacheMode._internal(-1, -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 = CacheMode._internal(1, 1);
///Don't use the cache, load from the network.
static const LOAD_NO_CACHE = CacheMode._internal(2, 2);
///Don't use the network, load from the cache.
static const LOAD_CACHE_ONLY = CacheMode._internal(3, 3);
///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 = CacheMode._internal(-1, -1);
///Don't use the cache, load from the network.
static const LOAD_NO_CACHE = CacheMode._internal(2, 2);
///Set of all values of [CacheMode].
static final Set<CacheMode> values = [
CacheMode.LOAD_DEFAULT,
CacheMode.LOAD_CACHE_ELSE_NETWORK,
CacheMode.LOAD_NO_CACHE,
CacheMode.LOAD_CACHE_ONLY,
CacheMode.LOAD_DEFAULT,
CacheMode.LOAD_NO_CACHE,
].toSet();
///Gets a possible [CacheMode] instance from [int] value.
@ -77,14 +77,14 @@ class CacheMode {
@override
String toString() {
switch (_value) {
case -1:
return 'LOAD_DEFAULT';
case 1:
return 'LOAD_CACHE_ELSE_NETWORK';
case 2:
return 'LOAD_NO_CACHE';
case 3:
return 'LOAD_CACHE_ONLY';
case -1:
return 'LOAD_DEFAULT';
case 2:
return 'LOAD_NO_CACHE';
}
return _value.toString();
}
@ -102,25 +102,25 @@ class AndroidCacheMode {
int value, Function nativeValue) =>
AndroidCacheMode._internal(value, nativeValue());
///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 = AndroidCacheMode._internal(-1, -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 = AndroidCacheMode._internal(1, 1);
///Don't use the cache, load from the network.
static const LOAD_NO_CACHE = AndroidCacheMode._internal(2, 2);
///Don't use the network, load from the cache.
static const LOAD_CACHE_ONLY = AndroidCacheMode._internal(3, 3);
///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 = AndroidCacheMode._internal(-1, -1);
///Don't use the cache, load from the network.
static const LOAD_NO_CACHE = AndroidCacheMode._internal(2, 2);
///Set of all values of [AndroidCacheMode].
static final Set<AndroidCacheMode> values = [
AndroidCacheMode.LOAD_DEFAULT,
AndroidCacheMode.LOAD_CACHE_ELSE_NETWORK,
AndroidCacheMode.LOAD_NO_CACHE,
AndroidCacheMode.LOAD_CACHE_ONLY,
AndroidCacheMode.LOAD_DEFAULT,
AndroidCacheMode.LOAD_NO_CACHE,
].toSet();
///Gets a possible [AndroidCacheMode] instance from [int] value.
@ -164,14 +164,14 @@ class AndroidCacheMode {
@override
String toString() {
switch (_value) {
case -1:
return 'LOAD_DEFAULT';
case 1:
return 'LOAD_CACHE_ELSE_NETWORK';
case 2:
return 'LOAD_NO_CACHE';
case 3:
return 'LOAD_CACHE_ONLY';
case -1:
return 'LOAD_DEFAULT';
case 2:
return 'LOAD_NO_CACHE';
}
return _value.toString();
}

View File

@ -8,12 +8,12 @@ part of 'call_async_javascript_result.dart';
///Class that represents either a success or a failure, including an associated value in each case for [InAppWebViewController.callAsyncJavaScript].
class CallAsyncJavaScriptResult {
///It contains the success value.
dynamic value;
///It contains the failure value.
String? error;
CallAsyncJavaScriptResult({this.value, this.error});
///It contains the success value.
dynamic value;
CallAsyncJavaScriptResult({this.error, this.value});
///Gets a possible [CallAsyncJavaScriptResult] instance from a [Map] value.
static CallAsyncJavaScriptResult? fromMap(Map<String, dynamic>? map) {
@ -21,8 +21,8 @@ class CallAsyncJavaScriptResult {
return null;
}
final instance = CallAsyncJavaScriptResult(
value: map['value'],
error: map['error'],
value: map['value'],
);
return instance;
}
@ -30,8 +30,8 @@ class CallAsyncJavaScriptResult {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"value": value,
"error": error,
"value": value,
};
}
@ -42,6 +42,6 @@ class CallAsyncJavaScriptResult {
@override
String toString() {
return 'CallAsyncJavaScriptResult{value: $value, error: $error}';
return 'CallAsyncJavaScriptResult{error: $error, value: $value}';
}
}

View File

@ -9,34 +9,34 @@ part of 'client_cert_challenge.dart';
///Class that represents the challenge of the [WebView.onReceivedClientCertRequest] event.
///It provides all the information about the challenge.
class ClientCertChallenge extends URLAuthenticationChallenge {
///Use [principals] instead.
@Deprecated('Use principals instead')
List<String>? androidPrincipals;
///The acceptable certificate issuers for the certificate matching the private key.
///
///**Supported Platforms/Implementations**:
///- Android native WebView 21+ ([Official API - ClientCertRequest.getPrincipals](https://developer.android.com/reference/android/webkit/ClientCertRequest#getPrincipals()))
List<String>? principals;
///Use [keyTypes] instead.
@Deprecated('Use keyTypes instead')
List<String>? androidKeyTypes;
///Use [principals] instead.
@Deprecated('Use principals instead')
List<String>? androidPrincipals;
///Returns the acceptable types of asymmetric keys.
///
///**Supported Platforms/Implementations**:
///- Android native WebView 21+ ([Official API - ClientCertRequest.getKeyTypes](https://developer.android.com/reference/android/webkit/ClientCertRequest#getKeyTypes()))
List<String>? keyTypes;
///The acceptable certificate issuers for the certificate matching the private key.
///
///**Supported Platforms/Implementations**:
///- Android native WebView 21+ ([Official API - ClientCertRequest.getPrincipals](https://developer.android.com/reference/android/webkit/ClientCertRequest#getPrincipals()))
List<String>? principals;
ClientCertChallenge(
{@Deprecated('Use principals instead') this.androidPrincipals,
this.principals,
@Deprecated('Use keyTypes instead') this.androidKeyTypes,
{@Deprecated('Use keyTypes instead') this.androidKeyTypes,
@Deprecated('Use principals instead') this.androidPrincipals,
this.keyTypes,
this.principals,
required URLProtectionSpace protectionSpace})
: super(protectionSpace: protectionSpace) {
principals = principals ?? androidPrincipals;
keyTypes = keyTypes ?? androidKeyTypes;
principals = principals ?? androidPrincipals;
}
///Gets a possible [ClientCertChallenge] instance from a [Map] value.
@ -47,10 +47,10 @@ class ClientCertChallenge extends URLAuthenticationChallenge {
final instance = ClientCertChallenge(
protectionSpace: URLProtectionSpace.fromMap(
map['protectionSpace']?.cast<String, dynamic>())!,
androidPrincipals: map['principals']?.cast<String>(),
principals: map['principals']?.cast<String>(),
androidKeyTypes: map['keyTypes']?.cast<String>(),
androidPrincipals: map['principals']?.cast<String>(),
keyTypes: map['keyTypes']?.cast<String>(),
principals: map['principals']?.cast<String>(),
);
return instance;
}
@ -59,8 +59,8 @@ class ClientCertChallenge extends URLAuthenticationChallenge {
Map<String, dynamic> toMap() {
return {
"protectionSpace": protectionSpace.toMap(),
"principals": principals,
"keyTypes": keyTypes,
"principals": principals,
};
}
@ -71,6 +71,6 @@ class ClientCertChallenge extends URLAuthenticationChallenge {
@override
String toString() {
return 'ClientCertChallenge{protectionSpace: $protectionSpace, principals: $principals, keyTypes: $keyTypes}';
return 'ClientCertChallenge{protectionSpace: $protectionSpace, keyTypes: $keyTypes, principals: $principals}';
}
}

View File

@ -8,24 +8,24 @@ part of 'client_cert_response.dart';
///Class that represents the response used by the [WebView.onReceivedClientCertRequest] event.
class ClientCertResponse {
///The file path of the certificate to use.
String certificatePath;
///The certificate password.
String? certificatePassword;
///Indicate the [ClientCertResponseAction] to take in response of the client certificate challenge.
ClientCertResponseAction? action;
///Use [keyStoreType] instead.
@Deprecated('Use keyStoreType instead')
String? androidKeyStoreType;
///The certificate password.
String? certificatePassword;
///The file path of the certificate to use.
String certificatePath;
///An Android-specific property used by Java [KeyStore](https://developer.android.com/reference/java/security/KeyStore) class to get the instance.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
String? keyStoreType;
///Indicate the [ClientCertResponseAction] to take in response of the client certificate challenge.
ClientCertResponseAction? action;
ClientCertResponse(
{required this.certificatePath,
this.certificatePassword = "",
@ -47,20 +47,20 @@ class ClientCertResponse {
final instance = ClientCertResponse(
certificatePath: map['certificatePath'],
);
instance.certificatePassword = map['certificatePassword'];
instance.androidKeyStoreType = map['keyStoreType'];
instance.keyStoreType = map['keyStoreType'];
instance.action = ClientCertResponseAction.fromNativeValue(map['action']);
instance.androidKeyStoreType = map['keyStoreType'];
instance.certificatePassword = map['certificatePassword'];
instance.keyStoreType = map['keyStoreType'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"certificatePath": certificatePath,
"certificatePassword": certificatePassword,
"keyStoreType": keyStoreType,
"action": action?.toNativeValue(),
"certificatePassword": certificatePassword,
"certificatePath": certificatePath,
"keyStoreType": keyStoreType,
};
}
@ -71,6 +71,6 @@ class ClientCertResponse {
@override
String toString() {
return 'ClientCertResponse{certificatePath: $certificatePath, certificatePassword: $certificatePassword, keyStoreType: $keyStoreType, action: $action}';
return 'ClientCertResponse{action: $action, certificatePassword: $certificatePassword, certificatePath: $certificatePath, keyStoreType: $keyStoreType}';
}
}

View File

@ -19,17 +19,17 @@ class ClientCertResponseAction {
///Cancel this request.
static const CANCEL = ClientCertResponseAction._internal(0, 0);
///Proceed with the specified certificate.
static const PROCEED = ClientCertResponseAction._internal(1, 1);
///Ignore the request for now.
static const IGNORE = ClientCertResponseAction._internal(2, 2);
///Proceed with the specified certificate.
static const PROCEED = ClientCertResponseAction._internal(1, 1);
///Set of all values of [ClientCertResponseAction].
static final Set<ClientCertResponseAction> values = [
ClientCertResponseAction.CANCEL,
ClientCertResponseAction.PROCEED,
ClientCertResponseAction.IGNORE,
ClientCertResponseAction.PROCEED,
].toSet();
///Gets a possible [ClientCertResponseAction] instance from [int] value.
@ -75,10 +75,10 @@ class ClientCertResponseAction {
switch (_value) {
case 0:
return 'CANCEL';
case 1:
return 'PROCEED';
case 2:
return 'IGNORE';
case 1:
return 'PROCEED';
}
return _value.toString();
}

View File

@ -16,15 +16,15 @@ class CompressFormat {
String value, Function nativeValue) =>
CompressFormat._internal(value, nativeValue());
///Compress to the `PNG` format.
///PNG is lossless, so `quality` is ignored.
static const PNG = CompressFormat._internal('PNG', 'PNG');
///Compress to the `JPEG` format.
///Quality of `0` means compress for the smallest size.
///`100` means compress for max visual quality.
static const JPEG = CompressFormat._internal('JPEG', 'JPEG');
///Compress to the `PNG` format.
///PNG is lossless, so `quality` is ignored.
static const PNG = CompressFormat._internal('PNG', 'PNG');
///Compress to the `WEBP` lossy format.
///Quality of `0` means compress for the smallest size.
///`100` means compress for max visual quality.
@ -32,16 +32,6 @@ class CompressFormat {
///**NOTE**: available only on Android.
static const WEBP = CompressFormat._internal('WEBP', 'WEBP');
///Compress to the `WEBP` lossy format.
///Quality of `0` means compress for the smallest size.
///`100` means compress for max visual quality.
///
///**NOTE**: available only on Android.
///
///**NOTE for Android**: available on Android 30+.
static const WEBP_LOSSY =
CompressFormat._internal('WEBP_LOSSY', 'WEBP_LOSSY');
///Compress to the `WEBP` lossless format.
///Quality refers to how much effort to put into compression.
///A value of `0` means to compress quickly, resulting in a relatively large file size.
@ -53,13 +43,23 @@ class CompressFormat {
static const WEBP_LOSSLESS =
CompressFormat._internal('WEBP_LOSSLESS', 'WEBP_LOSSLESS');
///Compress to the `WEBP` lossy format.
///Quality of `0` means compress for the smallest size.
///`100` means compress for max visual quality.
///
///**NOTE**: available only on Android.
///
///**NOTE for Android**: available on Android 30+.
static const WEBP_LOSSY =
CompressFormat._internal('WEBP_LOSSY', 'WEBP_LOSSY');
///Set of all values of [CompressFormat].
static final Set<CompressFormat> values = [
CompressFormat.PNG,
CompressFormat.JPEG,
CompressFormat.PNG,
CompressFormat.WEBP,
CompressFormat.WEBP_LOSSY,
CompressFormat.WEBP_LOSSLESS,
CompressFormat.WEBP_LOSSY,
].toSet();
///Gets a possible [CompressFormat] instance from [String] value.

View File

@ -16,28 +16,28 @@ class ConsoleMessageLevel {
int value, Function nativeValue) =>
ConsoleMessageLevel._internal(value, nativeValue());
///Console TIP level
static const TIP = ConsoleMessageLevel._internal(0, 0);
///Console LOG level
static const LOG = ConsoleMessageLevel._internal(1, 1);
///Console WARNING level
static const WARNING = ConsoleMessageLevel._internal(2, 2);
///Console DEBUG level
static const DEBUG = ConsoleMessageLevel._internal(4, 4);
///Console ERROR level
static const ERROR = ConsoleMessageLevel._internal(3, 3);
///Console DEBUG level
static const DEBUG = ConsoleMessageLevel._internal(4, 4);
///Console LOG level
static const LOG = ConsoleMessageLevel._internal(1, 1);
///Console TIP level
static const TIP = ConsoleMessageLevel._internal(0, 0);
///Console WARNING level
static const WARNING = ConsoleMessageLevel._internal(2, 2);
///Set of all values of [ConsoleMessageLevel].
static final Set<ConsoleMessageLevel> values = [
ConsoleMessageLevel.TIP,
ConsoleMessageLevel.LOG,
ConsoleMessageLevel.WARNING,
ConsoleMessageLevel.ERROR,
ConsoleMessageLevel.DEBUG,
ConsoleMessageLevel.ERROR,
ConsoleMessageLevel.LOG,
ConsoleMessageLevel.TIP,
ConsoleMessageLevel.WARNING,
].toSet();
///Gets a possible [ConsoleMessageLevel] instance from [int] value.
@ -81,16 +81,16 @@ class ConsoleMessageLevel {
@override
String toString() {
switch (_value) {
case 0:
return 'TIP';
case 1:
return 'LOG';
case 2:
return 'WARNING';
case 3:
return 'ERROR';
case 4:
return 'DEBUG';
case 3:
return 'ERROR';
case 1:
return 'LOG';
case 0:
return 'TIP';
case 2:
return 'WARNING';
}
return _value.toString();
}

View File

@ -37,6 +37,26 @@ class ContentBlockerActionType {
return null;
});
///Strips cookies from the header before sending it to the server.
///This only blocks cookies otherwise acceptable to WebView's privacy policy.
///Combining with [IGNORE_PREVIOUS_RULES] doesn't override the browsers privacy settings.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
static final BLOCK_COOKIES =
ContentBlockerActionType._internalMultiPlatform('block-cookies', () {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 'block-cookies';
case TargetPlatform.macOS:
return 'block-cookies';
default:
break;
}
return null;
});
///Hides elements of the page based on a CSS selector.
///A selector field contains the selector list.
///Any matching element has its display property set to none, which hides it.
@ -62,6 +82,25 @@ class ContentBlockerActionType {
return null;
});
///Ignores previously triggered actions.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
static final IGNORE_PREVIOUS_RULES =
ContentBlockerActionType._internalMultiPlatform('ignore-previous-rules',
() {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 'ignore-previous-rules';
case TargetPlatform.macOS:
return 'ignore-previous-rules';
default:
break;
}
return null;
});
///Changes a URL from http to https.
///URLs with a specified (nondefault) port and links using other protocols are unaffected.
///
@ -84,52 +123,13 @@ class ContentBlockerActionType {
return null;
});
///Strips cookies from the header before sending it to the server.
///This only blocks cookies otherwise acceptable to WebView's privacy policy.
///Combining with [IGNORE_PREVIOUS_RULES] doesn't override the browsers privacy settings.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
static final BLOCK_COOKIES =
ContentBlockerActionType._internalMultiPlatform('block-cookies', () {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 'block-cookies';
case TargetPlatform.macOS:
return 'block-cookies';
default:
break;
}
return null;
});
///Ignores previously triggered actions.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
static final IGNORE_PREVIOUS_RULES =
ContentBlockerActionType._internalMultiPlatform('ignore-previous-rules',
() {
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
return 'ignore-previous-rules';
case TargetPlatform.macOS:
return 'ignore-previous-rules';
default:
break;
}
return null;
});
///Set of all values of [ContentBlockerActionType].
static final Set<ContentBlockerActionType> values = [
ContentBlockerActionType.BLOCK,
ContentBlockerActionType.CSS_DISPLAY_NONE,
ContentBlockerActionType.MAKE_HTTPS,
ContentBlockerActionType.BLOCK_COOKIES,
ContentBlockerActionType.CSS_DISPLAY_NONE,
ContentBlockerActionType.IGNORE_PREVIOUS_RULES,
ContentBlockerActionType.MAKE_HTTPS,
].toSet();
///Gets a possible [ContentBlockerActionType] instance from [String] value.

View File

@ -17,18 +17,18 @@ class ContentBlockerTriggerLoadContext {
String value, Function nativeValue) =>
ContentBlockerTriggerLoadContext._internal(value, nativeValue());
///Top frame load context
static const TOP_FRAME =
ContentBlockerTriggerLoadContext._internal('top-frame', 'top-frame');
///Child frame load context
static const CHILD_FRAME =
ContentBlockerTriggerLoadContext._internal('child-frame', 'child-frame');
///Top frame load context
static const TOP_FRAME =
ContentBlockerTriggerLoadContext._internal('top-frame', 'top-frame');
///Set of all values of [ContentBlockerTriggerLoadContext].
static final Set<ContentBlockerTriggerLoadContext> values = [
ContentBlockerTriggerLoadContext.TOP_FRAME,
ContentBlockerTriggerLoadContext.CHILD_FRAME,
ContentBlockerTriggerLoadContext.TOP_FRAME,
].toSet();
///Gets a possible [ContentBlockerTriggerLoadContext] instance from [String] value.

View File

@ -18,32 +18,32 @@ class ContentBlockerTriggerResourceType {
ContentBlockerTriggerResourceType._internal(value, nativeValue());
static const DOCUMENT =
ContentBlockerTriggerResourceType._internal('document', 'document');
static const IMAGE =
ContentBlockerTriggerResourceType._internal('image', 'image');
static const STYLE_SHEET =
ContentBlockerTriggerResourceType._internal('style-sheet', 'style-sheet');
static const SCRIPT =
ContentBlockerTriggerResourceType._internal('script', 'script');
static const FONT =
ContentBlockerTriggerResourceType._internal('font', 'font');
static const IMAGE =
ContentBlockerTriggerResourceType._internal('image', 'image');
static const MEDIA =
ContentBlockerTriggerResourceType._internal('media', 'media');
static const SVG_DOCUMENT = ContentBlockerTriggerResourceType._internal(
'svg-document', 'svg-document');
///Any untyped load
static const RAW = ContentBlockerTriggerResourceType._internal('raw', 'raw');
static const SCRIPT =
ContentBlockerTriggerResourceType._internal('script', 'script');
static const STYLE_SHEET =
ContentBlockerTriggerResourceType._internal('style-sheet', 'style-sheet');
static const SVG_DOCUMENT = ContentBlockerTriggerResourceType._internal(
'svg-document', 'svg-document');
///Set of all values of [ContentBlockerTriggerResourceType].
static final Set<ContentBlockerTriggerResourceType> values = [
ContentBlockerTriggerResourceType.DOCUMENT,
ContentBlockerTriggerResourceType.IMAGE,
ContentBlockerTriggerResourceType.STYLE_SHEET,
ContentBlockerTriggerResourceType.SCRIPT,
ContentBlockerTriggerResourceType.FONT,
ContentBlockerTriggerResourceType.IMAGE,
ContentBlockerTriggerResourceType.MEDIA,
ContentBlockerTriggerResourceType.SVG_DOCUMENT,
ContentBlockerTriggerResourceType.RAW,
ContentBlockerTriggerResourceType.SCRIPT,
ContentBlockerTriggerResourceType.STYLE_SHEET,
ContentBlockerTriggerResourceType.SVG_DOCUMENT,
].toSet();
///Gets a possible [ContentBlockerTriggerResourceType] instance from [String] value.

View File

@ -8,56 +8,56 @@ part of 'cookie.dart';
///Class that represents a cookie returned by the [CookieManager].
class Cookie {
///The cookie name.
String name;
///The cookie value.
dynamic value;
///The cookie domain.
///
///**NOTE**: on Android it will be always `null`.
String? domain;
///The cookie expiration date in milliseconds.
///
///**NOTE**: on Android it will be always `null`.
int? expiresDate;
///Indicates if the cookie is a session only cookie.
///Indicates if the cookie is a http only cookie.
///
///**NOTE**: on Android it will be always `null`.
bool? isSessionOnly;
///The cookie domain.
///
///**NOTE**: on Android it will be always `null`.
String? domain;
///The cookie same site policy.
///
///**NOTE**: on Android it will be always `null`.
HTTPCookieSameSitePolicy? sameSite;
bool? isHttpOnly;
///Indicates if the cookie is secure or not.
///
///**NOTE**: on Android it will be always `null`.
bool? isSecure;
///Indicates if the cookie is a http only cookie.
///Indicates if the cookie is a session only cookie.
///
///**NOTE**: on Android it will be always `null`.
bool? isHttpOnly;
bool? isSessionOnly;
///The cookie name.
String name;
///The cookie path.
///
///**NOTE**: on Android it will be always `null`.
String? path;
///The cookie same site policy.
///
///**NOTE**: on Android it will be always `null`.
HTTPCookieSameSitePolicy? sameSite;
///The cookie value.
dynamic value;
Cookie(
{required this.name,
this.value,
{this.domain,
this.expiresDate,
this.isSessionOnly,
this.domain,
this.sameSite,
this.isSecure,
this.isHttpOnly,
this.path});
this.isSecure,
this.isSessionOnly,
required this.name,
this.path,
this.sameSite,
this.value});
///Gets a possible [Cookie] instance from a [Map] value.
static Cookie? fromMap(Map<String, dynamic>? map) {
@ -65,15 +65,15 @@ class Cookie {
return null;
}
final instance = Cookie(
name: map['name'],
value: map['value'],
expiresDate: map['expiresDate'],
isSessionOnly: map['isSessionOnly'],
domain: map['domain'],
sameSite: HTTPCookieSameSitePolicy.fromNativeValue(map['sameSite']),
isSecure: map['isSecure'],
expiresDate: map['expiresDate'],
isHttpOnly: map['isHttpOnly'],
isSecure: map['isSecure'],
isSessionOnly: map['isSessionOnly'],
name: map['name'],
path: map['path'],
sameSite: HTTPCookieSameSitePolicy.fromNativeValue(map['sameSite']),
value: map['value'],
);
return instance;
}
@ -81,15 +81,15 @@ class Cookie {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"name": name,
"value": value,
"expiresDate": expiresDate,
"isSessionOnly": isSessionOnly,
"domain": domain,
"sameSite": sameSite?.toNativeValue(),
"isSecure": isSecure,
"expiresDate": expiresDate,
"isHttpOnly": isHttpOnly,
"isSecure": isSecure,
"isSessionOnly": isSessionOnly,
"name": name,
"path": path,
"sameSite": sameSite?.toNativeValue(),
"value": value,
};
}
@ -100,6 +100,6 @@ class Cookie {
@override
String toString() {
return 'Cookie{name: $name, value: $value, expiresDate: $expiresDate, isSessionOnly: $isSessionOnly, domain: $domain, sameSite: $sameSite, isSecure: $isSecure, isHttpOnly: $isHttpOnly, path: $path}';
return 'Cookie{domain: $domain, expiresDate: $expiresDate, isHttpOnly: $isHttpOnly, isSecure: $isSecure, isSessionOnly: $isSessionOnly, name: $name, path: $path, sameSite: $sameSite, value: $value}';
}
}

View File

@ -8,37 +8,37 @@ part of 'create_window_action.dart';
///Class that represents the navigation request used by the [WebView.onCreateWindow] event.
class CreateWindowAction extends NavigationAction {
///The window id. Used by [WebView] to create a new WebView.
int windowId;
///Use [isDialog] instead.
@Deprecated('Use isDialog instead')
bool? androidIsDialog;
///Use [windowFeatures] instead.
@Deprecated('Use windowFeatures instead')
IOSWKWindowFeatures? iosWindowFeatures;
///Indicates if the new window should be a dialog, rather than a full-size window.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? isDialog;
///Use [windowFeatures] instead.
@Deprecated('Use windowFeatures instead')
IOSWKWindowFeatures? iosWindowFeatures;
///Window features requested by the webpage.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWindowFeatures](https://developer.apple.com/documentation/webkit/wkwindowfeatures))
///- MacOS ([Official API - WKWindowFeatures](https://developer.apple.com/documentation/webkit/wkwindowfeatures))
WindowFeatures? windowFeatures;
///The window id. Used by [WebView] to create a new WebView.
int windowId;
CreateWindowAction(
{required this.windowId,
@Deprecated('Use isDialog instead')
{@Deprecated('Use isDialog instead')
this.androidIsDialog,
this.isDialog,
@Deprecated('Use windowFeatures instead')
this.iosWindowFeatures,
this.isDialog,
this.windowFeatures,
required this.windowId,
required URLRequest request,
required bool isForMainFrame,
@Deprecated('Use hasGesture instead')
@ -84,13 +84,13 @@ class CreateWindowAction extends NavigationAction {
final instance = CreateWindowAction(
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>())!,
isForMainFrame: map['isForMainFrame'],
windowId: map['windowId'],
androidIsDialog: map['isDialog'],
isDialog: map['isDialog'],
iosWindowFeatures: IOSWKWindowFeatures.fromMap(
map['windowFeatures']?.cast<String, dynamic>()),
isDialog: map['isDialog'],
windowFeatures: WindowFeatures.fromMap(
map['windowFeatures']?.cast<String, dynamic>()),
windowId: map['windowId'],
);
instance.androidHasGesture = map['hasGesture'];
instance.hasGesture = map['hasGesture'];
@ -123,9 +123,9 @@ class CreateWindowAction extends NavigationAction {
"sourceFrame": sourceFrame?.toMap(),
"targetFrame": targetFrame?.toMap(),
"shouldPerformDownload": shouldPerformDownload,
"windowId": windowId,
"isDialog": isDialog,
"windowFeatures": windowFeatures?.toMap(),
"windowId": windowId,
};
}
@ -136,6 +136,6 @@ class CreateWindowAction extends NavigationAction {
@override
String toString() {
return 'CreateWindowAction{request: $request, isForMainFrame: $isForMainFrame, hasGesture: $hasGesture, isRedirect: $isRedirect, navigationType: $navigationType, sourceFrame: $sourceFrame, targetFrame: $targetFrame, shouldPerformDownload: $shouldPerformDownload, windowId: $windowId, isDialog: $isDialog, windowFeatures: $windowFeatures}';
return 'CreateWindowAction{request: $request, isForMainFrame: $isForMainFrame, hasGesture: $hasGesture, isRedirect: $isRedirect, navigationType: $navigationType, sourceFrame: $sourceFrame, targetFrame: $targetFrame, shouldPerformDownload: $shouldPerformDownload, isDialog: $isDialog, windowFeatures: $windowFeatures, windowId: $windowId}';
}
}

View File

@ -8,23 +8,13 @@ part of 'css_link_html_tag_attributes.dart';
///Class that represents the possible CSS stylesheet `<link>` HTML attributes to be set used by [InAppWebViewController.injectCSSFileFromUrl].
class CSSLinkHtmlTagAttributes {
///The HTML [id] attribute is used to specify a unique id for the `<link>` HTML element.
String? id;
///This attribute specifies the media that the linked resource applies to. Its value must be a media type / media query.
///This attribute is mainly useful when linking to external stylesheets it allows the user agent to pick the best adapted one for the device it runs on.
String? media;
///Specify alternative style sheets.
bool? alternate;
///Normal script elements pass minimal information to the `window.onerror` for scripts which do not pass the standard CORS checks.
///To allow error logging for sites which use a separate domain for static media, use this attribute.
CrossOrigin? crossOrigin;
///This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation.
String? integrity;
///Indicates which referrer to send when fetching the script, or resources fetched by the script.
ReferrerPolicy? referrerPolicy;
///The [disabled] Boolean attribute indicates whether or not the described stylesheet should be loaded and applied to the document.
///If [disabled] is specified in the HTML when it is loaded, the stylesheet will not be loaded during page load.
///Instead, the stylesheet will be loaded on-demand, if and when the [disabled] attribute is changed to `false` or removed.
@ -32,21 +22,31 @@ class CSSLinkHtmlTagAttributes {
///Setting the [disabled] property in the DOM causes the stylesheet to be removed from the document's `DocumentOrShadowRoot.styleSheets` list.
bool? disabled;
///Specify alternative style sheets.
bool? alternate;
///The HTML [id] attribute is used to specify a unique id for the `<link>` HTML element.
String? id;
///This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation.
String? integrity;
///This attribute specifies the media that the linked resource applies to. Its value must be a media type / media query.
///This attribute is mainly useful when linking to external stylesheets it allows the user agent to pick the best adapted one for the device it runs on.
String? media;
///Indicates which referrer to send when fetching the script, or resources fetched by the script.
ReferrerPolicy? referrerPolicy;
///The title attribute has special semantics on the `<link>` element.
///When used on a `<link rel="stylesheet">` it defines a preferred or an alternate stylesheet.
///Incorrectly using it may cause the stylesheet to be ignored.
String? title;
CSSLinkHtmlTagAttributes(
{this.id,
this.media,
{this.alternate,
this.crossOrigin,
this.integrity,
this.referrerPolicy,
this.disabled,
this.alternate,
this.id,
this.integrity,
this.media,
this.referrerPolicy,
this.title});
///Gets a possible [CSSLinkHtmlTagAttributes] instance from a [Map] value.
@ -55,13 +55,13 @@ class CSSLinkHtmlTagAttributes {
return null;
}
final instance = CSSLinkHtmlTagAttributes(
id: map['id'],
media: map['media'],
crossOrigin: CrossOrigin.fromNativeValue(map['crossOrigin']),
integrity: map['integrity'],
referrerPolicy: ReferrerPolicy.fromNativeValue(map['referrerPolicy']),
disabled: map['disabled'],
alternate: map['alternate'],
crossOrigin: CrossOrigin.fromNativeValue(map['crossOrigin']),
disabled: map['disabled'],
id: map['id'],
integrity: map['integrity'],
media: map['media'],
referrerPolicy: ReferrerPolicy.fromNativeValue(map['referrerPolicy']),
title: map['title'],
);
return instance;
@ -70,13 +70,13 @@ class CSSLinkHtmlTagAttributes {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"id": id,
"media": media,
"crossOrigin": crossOrigin?.toNativeValue(),
"integrity": integrity,
"referrerPolicy": referrerPolicy?.toNativeValue(),
"disabled": disabled,
"alternate": alternate,
"crossOrigin": crossOrigin?.toNativeValue(),
"disabled": disabled,
"id": id,
"integrity": integrity,
"media": media,
"referrerPolicy": referrerPolicy?.toNativeValue(),
"title": title,
};
}
@ -88,6 +88,6 @@ class CSSLinkHtmlTagAttributes {
@override
String toString() {
return 'CSSLinkHtmlTagAttributes{id: $id, media: $media, crossOrigin: $crossOrigin, integrity: $integrity, referrerPolicy: $referrerPolicy, disabled: $disabled, alternate: $alternate, title: $title}';
return 'CSSLinkHtmlTagAttributes{alternate: $alternate, crossOrigin: $crossOrigin, disabled: $disabled, id: $id, integrity: $integrity, media: $media, referrerPolicy: $referrerPolicy, title: $title}';
}
}

View File

@ -9,18 +9,18 @@ part of 'custom_scheme_response.dart';
///Class representing the response returned by the [WebView.onLoadResourceWithCustomScheme] event.
///It allows to load a specific resource. The resource data must be encoded to `base64`.
class CustomSchemeResponse {
///Data enconded to 'base64'.
Uint8List data;
///Content-Encoding of the data, such as `utf-8`.
String contentEncoding;
///Content-Type of the data, such as `image/png`.
String contentType;
///Content-Encoding of the data, such as `utf-8`.
String contentEncoding;
///Data enconded to 'base64'.
Uint8List data;
CustomSchemeResponse(
{required this.data,
{this.contentEncoding = 'utf-8',
required this.contentType,
this.contentEncoding = 'utf-8'});
required this.data});
///Gets a possible [CustomSchemeResponse] instance from a [Map] value.
static CustomSchemeResponse? fromMap(Map<String, dynamic>? map) {
@ -28,8 +28,8 @@ class CustomSchemeResponse {
return null;
}
final instance = CustomSchemeResponse(
data: map['data'],
contentType: map['contentType'],
data: map['data'],
);
instance.contentEncoding = map['contentEncoding'];
return instance;
@ -38,9 +38,9 @@ class CustomSchemeResponse {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"data": data,
"contentType": contentType,
"contentEncoding": contentEncoding,
"contentType": contentType,
"data": data,
};
}
@ -51,6 +51,6 @@ class CustomSchemeResponse {
@override
String toString() {
return 'CustomSchemeResponse{data: $data, contentType: $contentType, contentEncoding: $contentEncoding}';
return 'CustomSchemeResponse{contentEncoding: $contentEncoding, contentType: $contentType, data: $data}';
}
}

View File

@ -16,30 +16,15 @@ class CustomTabsNavigationEventType {
int value, Function nativeValue) =>
CustomTabsNavigationEventType._internal(value, nativeValue());
///Sent when the tab has started loading a page.
///Sent when loading was aborted by a user action before it finishes like clicking on a link or refreshing the page.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
static final STARTED =
CustomTabsNavigationEventType._internalMultiPlatform(1, () {
static final ABORTED =
CustomTabsNavigationEventType._internalMultiPlatform(4, () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 1;
default:
break;
}
return null;
});
///Sent when the tab has finished loading a page.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
static final FINISHED =
CustomTabsNavigationEventType._internalMultiPlatform(2, () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 2;
return 4;
default:
break;
}
@ -61,30 +46,30 @@ class CustomTabsNavigationEventType {
return null;
});
///Sent when loading was aborted by a user action before it finishes like clicking on a link or refreshing the page.
///Sent when the tab has finished loading a page.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
static final ABORTED =
CustomTabsNavigationEventType._internalMultiPlatform(4, () {
static final FINISHED =
CustomTabsNavigationEventType._internalMultiPlatform(2, () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 4;
return 2;
default:
break;
}
return null;
});
///Sent when the tab becomes visible.
///Sent when the tab has started loading a page.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
static final TAB_SHOWN =
CustomTabsNavigationEventType._internalMultiPlatform(5, () {
static final STARTED =
CustomTabsNavigationEventType._internalMultiPlatform(1, () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 5;
return 1;
default:
break;
}
@ -106,14 +91,29 @@ class CustomTabsNavigationEventType {
return null;
});
///Sent when the tab becomes visible.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
static final TAB_SHOWN =
CustomTabsNavigationEventType._internalMultiPlatform(5, () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 5;
default:
break;
}
return null;
});
///Set of all values of [CustomTabsNavigationEventType].
static final Set<CustomTabsNavigationEventType> values = [
CustomTabsNavigationEventType.STARTED,
CustomTabsNavigationEventType.FINISHED,
CustomTabsNavigationEventType.FAILED,
CustomTabsNavigationEventType.ABORTED,
CustomTabsNavigationEventType.TAB_SHOWN,
CustomTabsNavigationEventType.FAILED,
CustomTabsNavigationEventType.FINISHED,
CustomTabsNavigationEventType.STARTED,
CustomTabsNavigationEventType.TAB_HIDDEN,
CustomTabsNavigationEventType.TAB_SHOWN,
].toSet();
///Gets a possible [CustomTabsNavigationEventType] instance from [int] value.
@ -157,18 +157,18 @@ class CustomTabsNavigationEventType {
@override
String toString() {
switch (_value) {
case 1:
return 'STARTED';
case 2:
return 'FINISHED';
case 3:
return 'FAILED';
case 4:
return 'ABORTED';
case 5:
return 'TAB_SHOWN';
case 3:
return 'FAILED';
case 2:
return 'FINISHED';
case 1:
return 'STARTED';
case 6:
return 'TAB_HIDDEN';
case 5:
return 'TAB_SHOWN';
}
return _value.toString();
}

View File

@ -16,21 +16,6 @@ class CustomTabsRelationType {
int value, Function nativeValue) =>
CustomTabsRelationType._internal(value, nativeValue());
///For App -> Web transitions, requests the app to use the declared origin to be used as origin for the client app in the web APIs context.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
static final USE_AS_ORIGIN =
CustomTabsRelationType._internalMultiPlatform(1, () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 1;
default:
break;
}
return null;
});
///Requests the ability to handle all URLs from a given origin.
///
///**Supported Platforms/Implementations**:
@ -46,10 +31,25 @@ class CustomTabsRelationType {
return null;
});
///For App -> Web transitions, requests the app to use the declared origin to be used as origin for the client app in the web APIs context.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
static final USE_AS_ORIGIN =
CustomTabsRelationType._internalMultiPlatform(1, () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 1;
default:
break;
}
return null;
});
///Set of all values of [CustomTabsRelationType].
static final Set<CustomTabsRelationType> values = [
CustomTabsRelationType.USE_AS_ORIGIN,
CustomTabsRelationType.HANDLE_ALL_URLS,
CustomTabsRelationType.USE_AS_ORIGIN,
].toSet();
///Gets a possible [CustomTabsRelationType] instance from [int] value.
@ -93,10 +93,10 @@ class CustomTabsRelationType {
@override
String toString() {
switch (_value) {
case 1:
return 'USE_AS_ORIGIN';
case 2:
return 'HANDLE_ALL_URLS';
case 1:
return 'USE_AS_ORIGIN';
}
return _value.toString();
}

View File

@ -19,17 +19,17 @@ class CustomTabsShareState {
///Applies the default share settings depending on the browser.
static const SHARE_STATE_DEFAULT = CustomTabsShareState._internal(0, 0);
///Shows a share option in the tab.
static const SHARE_STATE_ON = CustomTabsShareState._internal(1, 1);
///Explicitly does not show a share option in the tab.
static const SHARE_STATE_OFF = CustomTabsShareState._internal(2, 2);
///Shows a share option in the tab.
static const SHARE_STATE_ON = CustomTabsShareState._internal(1, 1);
///Set of all values of [CustomTabsShareState].
static final Set<CustomTabsShareState> values = [
CustomTabsShareState.SHARE_STATE_DEFAULT,
CustomTabsShareState.SHARE_STATE_ON,
CustomTabsShareState.SHARE_STATE_OFF,
CustomTabsShareState.SHARE_STATE_ON,
].toSet();
///Gets a possible [CustomTabsShareState] instance from [int] value.
@ -75,10 +75,10 @@ class CustomTabsShareState {
switch (_value) {
case 0:
return 'SHARE_STATE_DEFAULT';
case 1:
return 'SHARE_STATE_ON';
case 2:
return 'SHARE_STATE_OFF';
case 1:
return 'SHARE_STATE_ON';
}
return _value.toString();
}

View File

@ -16,6 +16,27 @@ class DataDetectorTypes {
String value, Function nativeValue) =>
DataDetectorTypes._internal(value, nativeValue());
///Addresses are detected and turned into links.
static const ADDRESS = DataDetectorTypes._internal('ADDRESS', 'ADDRESS');
///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 = DataDetectorTypes._internal('ALL', 'ALL');
///Dates and times that are in the future are detected and turned into links.
static const CALENDAR_EVENT =
DataDetectorTypes._internal('CALENDAR_EVENT', 'CALENDAR_EVENT');
///Flight numbers are detected and turned into links.
static const FLIGHT_NUMBER =
DataDetectorTypes._internal('FLIGHT_NUMBER', 'FLIGHT_NUMBER');
///URLs in text are detected and turned into links.
static const LINK = DataDetectorTypes._internal('LINK', 'LINK');
///Lookup suggestions are detected and turned into links.
static const LOOKUP_SUGGESTION =
DataDetectorTypes._internal('LOOKUP_SUGGESTION', 'LOOKUP_SUGGESTION');
///No detection is performed.
static const NONE = DataDetectorTypes._internal('NONE', 'NONE');
@ -23,47 +44,26 @@ class DataDetectorTypes {
static const PHONE_NUMBER =
DataDetectorTypes._internal('PHONE_NUMBER', 'PHONE_NUMBER');
///URLs in text are detected and turned into links.
static const LINK = DataDetectorTypes._internal('LINK', 'LINK');
///Addresses are detected and turned into links.
static const ADDRESS = DataDetectorTypes._internal('ADDRESS', 'ADDRESS');
///Dates and times that are in the future are detected and turned into links.
static const CALENDAR_EVENT =
DataDetectorTypes._internal('CALENDAR_EVENT', 'CALENDAR_EVENT');
///Spotlight suggestions are detected and turned into links.
static const SPOTLIGHT_SUGGESTION = DataDetectorTypes._internal(
'SPOTLIGHT_SUGGESTION', 'SPOTLIGHT_SUGGESTION');
///Tracking numbers are detected and turned into links.
static const TRACKING_NUMBER =
DataDetectorTypes._internal('TRACKING_NUMBER', 'TRACKING_NUMBER');
///Flight numbers are detected and turned into links.
static const FLIGHT_NUMBER =
DataDetectorTypes._internal('FLIGHT_NUMBER', 'FLIGHT_NUMBER');
///Lookup suggestions are detected and turned into links.
static const LOOKUP_SUGGESTION =
DataDetectorTypes._internal('LOOKUP_SUGGESTION', 'LOOKUP_SUGGESTION');
///Spotlight suggestions are detected and turned into links.
static const SPOTLIGHT_SUGGESTION = DataDetectorTypes._internal(
'SPOTLIGHT_SUGGESTION', '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 = DataDetectorTypes._internal('ALL', 'ALL');
///Set of all values of [DataDetectorTypes].
static final Set<DataDetectorTypes> values = [
DataDetectorTypes.ADDRESS,
DataDetectorTypes.ALL,
DataDetectorTypes.CALENDAR_EVENT,
DataDetectorTypes.FLIGHT_NUMBER,
DataDetectorTypes.LINK,
DataDetectorTypes.LOOKUP_SUGGESTION,
DataDetectorTypes.NONE,
DataDetectorTypes.PHONE_NUMBER,
DataDetectorTypes.LINK,
DataDetectorTypes.ADDRESS,
DataDetectorTypes.CALENDAR_EVENT,
DataDetectorTypes.TRACKING_NUMBER,
DataDetectorTypes.FLIGHT_NUMBER,
DataDetectorTypes.LOOKUP_SUGGESTION,
DataDetectorTypes.SPOTLIGHT_SUGGESTION,
DataDetectorTypes.ALL,
DataDetectorTypes.TRACKING_NUMBER,
].toSet();
///Gets a possible [DataDetectorTypes] instance from [String] value.
@ -125,6 +125,27 @@ class IOSWKDataDetectorTypes {
String value, Function nativeValue) =>
IOSWKDataDetectorTypes._internal(value, nativeValue());
///Addresses are detected and turned into links.
static const ADDRESS = IOSWKDataDetectorTypes._internal('ADDRESS', 'ADDRESS');
///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 = IOSWKDataDetectorTypes._internal('ALL', 'ALL');
///Dates and times that are in the future are detected and turned into links.
static const CALENDAR_EVENT =
IOSWKDataDetectorTypes._internal('CALENDAR_EVENT', 'CALENDAR_EVENT');
///Flight numbers are detected and turned into links.
static const FLIGHT_NUMBER =
IOSWKDataDetectorTypes._internal('FLIGHT_NUMBER', 'FLIGHT_NUMBER');
///URLs in text are detected and turned into links.
static const LINK = IOSWKDataDetectorTypes._internal('LINK', 'LINK');
///Lookup suggestions are detected and turned into links.
static const LOOKUP_SUGGESTION = IOSWKDataDetectorTypes._internal(
'LOOKUP_SUGGESTION', 'LOOKUP_SUGGESTION');
///No detection is performed.
static const NONE = IOSWKDataDetectorTypes._internal('NONE', 'NONE');
@ -132,47 +153,26 @@ class IOSWKDataDetectorTypes {
static const PHONE_NUMBER =
IOSWKDataDetectorTypes._internal('PHONE_NUMBER', 'PHONE_NUMBER');
///URLs in text are detected and turned into links.
static const LINK = IOSWKDataDetectorTypes._internal('LINK', 'LINK');
///Addresses are detected and turned into links.
static const ADDRESS = IOSWKDataDetectorTypes._internal('ADDRESS', 'ADDRESS');
///Dates and times that are in the future are detected and turned into links.
static const CALENDAR_EVENT =
IOSWKDataDetectorTypes._internal('CALENDAR_EVENT', 'CALENDAR_EVENT');
///Spotlight suggestions are detected and turned into links.
static const SPOTLIGHT_SUGGESTION = IOSWKDataDetectorTypes._internal(
'SPOTLIGHT_SUGGESTION', 'SPOTLIGHT_SUGGESTION');
///Tracking numbers are detected and turned into links.
static const TRACKING_NUMBER =
IOSWKDataDetectorTypes._internal('TRACKING_NUMBER', 'TRACKING_NUMBER');
///Flight numbers are detected and turned into links.
static const FLIGHT_NUMBER =
IOSWKDataDetectorTypes._internal('FLIGHT_NUMBER', 'FLIGHT_NUMBER');
///Lookup suggestions are detected and turned into links.
static const LOOKUP_SUGGESTION = IOSWKDataDetectorTypes._internal(
'LOOKUP_SUGGESTION', 'LOOKUP_SUGGESTION');
///Spotlight suggestions are detected and turned into links.
static const SPOTLIGHT_SUGGESTION = IOSWKDataDetectorTypes._internal(
'SPOTLIGHT_SUGGESTION', '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 = IOSWKDataDetectorTypes._internal('ALL', 'ALL');
///Set of all values of [IOSWKDataDetectorTypes].
static final Set<IOSWKDataDetectorTypes> values = [
IOSWKDataDetectorTypes.ADDRESS,
IOSWKDataDetectorTypes.ALL,
IOSWKDataDetectorTypes.CALENDAR_EVENT,
IOSWKDataDetectorTypes.FLIGHT_NUMBER,
IOSWKDataDetectorTypes.LINK,
IOSWKDataDetectorTypes.LOOKUP_SUGGESTION,
IOSWKDataDetectorTypes.NONE,
IOSWKDataDetectorTypes.PHONE_NUMBER,
IOSWKDataDetectorTypes.LINK,
IOSWKDataDetectorTypes.ADDRESS,
IOSWKDataDetectorTypes.CALENDAR_EVENT,
IOSWKDataDetectorTypes.TRACKING_NUMBER,
IOSWKDataDetectorTypes.FLIGHT_NUMBER,
IOSWKDataDetectorTypes.LOOKUP_SUGGESTION,
IOSWKDataDetectorTypes.SPOTLIGHT_SUGGESTION,
IOSWKDataDetectorTypes.ALL,
IOSWKDataDetectorTypes.TRACKING_NUMBER,
].toSet();
///Gets a possible [IOSWKDataDetectorTypes] instance from [String] value.

View File

@ -16,20 +16,20 @@ class DismissButtonStyle {
int value, Function nativeValue) =>
DismissButtonStyle._internal(value, nativeValue());
///Makes the button title the localized string "Done".
static const DONE = DismissButtonStyle._internal(0, 0);
///Makes the button title the localized string "Cancel".
static const CANCEL = DismissButtonStyle._internal(2, 2);
///Makes the button title the localized string "Close".
static const CLOSE = DismissButtonStyle._internal(1, 1);
///Makes the button title the localized string "Cancel".
static const CANCEL = DismissButtonStyle._internal(2, 2);
///Makes the button title the localized string "Done".
static const DONE = DismissButtonStyle._internal(0, 0);
///Set of all values of [DismissButtonStyle].
static final Set<DismissButtonStyle> values = [
DismissButtonStyle.DONE,
DismissButtonStyle.CLOSE,
DismissButtonStyle.CANCEL,
DismissButtonStyle.CLOSE,
DismissButtonStyle.DONE,
].toSet();
///Gets a possible [DismissButtonStyle] instance from [int] value.
@ -73,12 +73,12 @@ class DismissButtonStyle {
@override
String toString() {
switch (_value) {
case 0:
return 'DONE';
case 1:
return 'CLOSE';
case 2:
return 'CANCEL';
case 1:
return 'CLOSE';
case 0:
return 'DONE';
}
return _value.toString();
}
@ -99,20 +99,20 @@ class IOSSafariDismissButtonStyle {
int value, Function nativeValue) =>
IOSSafariDismissButtonStyle._internal(value, nativeValue());
///Makes the button title the localized string "Done".
static const DONE = IOSSafariDismissButtonStyle._internal(0, 0);
///Makes the button title the localized string "Cancel".
static const CANCEL = IOSSafariDismissButtonStyle._internal(2, 2);
///Makes the button title the localized string "Close".
static const CLOSE = IOSSafariDismissButtonStyle._internal(1, 1);
///Makes the button title the localized string "Cancel".
static const CANCEL = IOSSafariDismissButtonStyle._internal(2, 2);
///Makes the button title the localized string "Done".
static const DONE = IOSSafariDismissButtonStyle._internal(0, 0);
///Set of all values of [IOSSafariDismissButtonStyle].
static final Set<IOSSafariDismissButtonStyle> values = [
IOSSafariDismissButtonStyle.DONE,
IOSSafariDismissButtonStyle.CLOSE,
IOSSafariDismissButtonStyle.CANCEL,
IOSSafariDismissButtonStyle.CLOSE,
IOSSafariDismissButtonStyle.DONE,
].toSet();
///Gets a possible [IOSSafariDismissButtonStyle] instance from [int] value.
@ -156,12 +156,12 @@ class IOSSafariDismissButtonStyle {
@override
String toString() {
switch (_value) {
case 0:
return 'DONE';
case 1:
return 'CLOSE';
case 2:
return 'CANCEL';
case 1:
return 'CLOSE';
case 0:
return 'DONE';
}
return _value.toString();
}

View File

@ -8,34 +8,34 @@ part of 'download_start_request.dart';
///Class representing a download request of the WebView used by the event [WebView.onDownloadStartRequest].
class DownloadStartRequest {
///The full url to the content that should be downloaded.
WebUri url;
///the user agent to be used for the download.
String? userAgent;
///Content-disposition http header, if present.
String? contentDisposition;
///The mimetype of the content reported by the server.
String? mimeType;
///The file size reported by the server.
int contentLength;
///The mimetype of the content reported by the server.
String? mimeType;
///A suggested filename to use if saving the resource to disk.
String? suggestedFilename;
///The name of the text encoding of the receiver, or `null` if no text encoding was specified.
String? textEncodingName;
///The full url to the content that should be downloaded.
WebUri url;
///the user agent to be used for the download.
String? userAgent;
DownloadStartRequest(
{required this.url,
this.userAgent,
this.contentDisposition,
this.mimeType,
{this.contentDisposition,
required this.contentLength,
this.mimeType,
this.suggestedFilename,
this.textEncodingName});
this.textEncodingName,
required this.url,
this.userAgent});
///Gets a possible [DownloadStartRequest] instance from a [Map] value.
static DownloadStartRequest? fromMap(Map<String, dynamic>? map) {
@ -43,13 +43,13 @@ class DownloadStartRequest {
return null;
}
final instance = DownloadStartRequest(
url: WebUri(map['url']),
userAgent: map['userAgent'],
contentDisposition: map['contentDisposition'],
mimeType: map['mimeType'],
contentLength: map['contentLength'],
mimeType: map['mimeType'],
suggestedFilename: map['suggestedFilename'],
textEncodingName: map['textEncodingName'],
url: WebUri(map['url']),
userAgent: map['userAgent'],
);
return instance;
}
@ -57,13 +57,13 @@ class DownloadStartRequest {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url.toString(),
"userAgent": userAgent,
"contentDisposition": contentDisposition,
"mimeType": mimeType,
"contentLength": contentLength,
"mimeType": mimeType,
"suggestedFilename": suggestedFilename,
"textEncodingName": textEncodingName,
"url": url.toString(),
"userAgent": userAgent,
};
}
@ -74,6 +74,6 @@ class DownloadStartRequest {
@override
String toString() {
return 'DownloadStartRequest{url: $url, userAgent: $userAgent, contentDisposition: $contentDisposition, mimeType: $mimeType, contentLength: $contentLength, suggestedFilename: $suggestedFilename, textEncodingName: $textEncodingName}';
return 'DownloadStartRequest{contentDisposition: $contentDisposition, contentLength: $contentLength, mimeType: $mimeType, suggestedFilename: $suggestedFilename, textEncodingName: $textEncodingName, url: $url, userAgent: $userAgent}';
}
}

View File

@ -8,18 +8,18 @@ part of 'favicon.dart';
///Class that represents a favicon of a website. It is used by [InAppWebViewController.getFavicons] method.
class Favicon {
///The url of the favicon image.
WebUri url;
///The height of the favicon image.
int? height;
///The relationship between the current web page and the favicon image.
String? rel;
///The url of the favicon image.
WebUri url;
///The width of the favicon image.
int? width;
///The height of the favicon image.
int? height;
Favicon({required this.url, this.rel, this.width, this.height});
Favicon({this.height, this.rel, required this.url, this.width});
///Gets a possible [Favicon] instance from a [Map] value.
static Favicon? fromMap(Map<String, dynamic>? map) {
@ -27,10 +27,10 @@ class Favicon {
return null;
}
final instance = Favicon(
url: WebUri(map['url']),
rel: map['rel'],
width: map['width'],
height: map['height'],
rel: map['rel'],
url: WebUri(map['url']),
width: map['width'],
);
return instance;
}
@ -38,10 +38,10 @@ class Favicon {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url.toString(),
"rel": rel,
"width": width,
"height": height,
"rel": rel,
"url": url.toString(),
"width": width,
};
}
@ -52,6 +52,6 @@ class Favicon {
@override
String toString() {
return 'Favicon{url: $url, rel: $rel, width: $width, height: $height}';
return 'Favicon{height: $height, rel: $rel, url: $url, width: $width}';
}
}

View File

@ -8,26 +8,32 @@ part of 'fetch_request.dart';
///Class that represents a HTTP request created with JavaScript using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).
class FetchRequest {
///The URL of the request.
WebUri? url;
///The HTTP request method used of the request.
String? method;
///The HTTP request headers.
Map<String, dynamic>? headers;
///Indicates the [FetchRequestAction] that can be used to control the request.
FetchRequestAction? action;
///Body of the request.
dynamic body;
///The mode used by the request.
String? mode;
///The cache mode used by the request.
String? cache;
///The request credentials used by the request.
FetchRequestCredential? credentials;
///The cache mode used by the request.
String? cache;
///The HTTP request headers.
Map<String, dynamic>? headers;
///Contains the subresource integrity value of the request.
String? integrity;
///The keepalive option used to allow the request to outlive the page.
bool? keepalive;
///The HTTP request method used of the request.
String? method;
///The mode used by the request.
String? mode;
///The redirect mode used by the request.
String? redirect;
@ -38,28 +44,22 @@ class FetchRequest {
///The value of the referer HTTP header.
ReferrerPolicy? referrerPolicy;
///Contains the subresource integrity value of the request.
String? integrity;
///The keepalive option used to allow the request to outlive the page.
bool? keepalive;
///Indicates the [FetchRequestAction] that can be used to control the request.
FetchRequestAction? action;
///The URL of the request.
WebUri? url;
FetchRequest(
{this.url,
this.method,
this.headers,
{this.action = FetchRequestAction.PROCEED,
this.body,
this.mode,
this.credentials,
this.cache,
this.credentials,
this.headers,
this.integrity,
this.keepalive,
this.method,
this.mode,
this.redirect,
this.referrer,
this.referrerPolicy,
this.integrity,
this.keepalive,
this.action = FetchRequestAction.PROCEED});
this.url});
///Gets a possible [FetchRequest] instance from a [Map] value.
static FetchRequest? fromMap(Map<String, dynamic>? map) {
@ -67,18 +67,18 @@ class FetchRequest {
return null;
}
final instance = FetchRequest(
url: map['url'] != null ? WebUri(map['url']) : null,
method: map['method'],
headers: map['headers']?.cast<String, dynamic>(),
body: map['body'],
mode: map['mode'],
credentials: _fetchRequestCredentialDeserializer(map['credentials']),
cache: map['cache'],
credentials: _fetchRequestCredentialDeserializer(map['credentials']),
headers: map['headers']?.cast<String, dynamic>(),
integrity: map['integrity'],
keepalive: map['keepalive'],
method: map['method'],
mode: map['mode'],
redirect: map['redirect'],
referrer: map['referrer'],
referrerPolicy: ReferrerPolicy.fromNativeValue(map['referrerPolicy']),
integrity: map['integrity'],
keepalive: map['keepalive'],
url: map['url'] != null ? WebUri(map['url']) : null,
);
instance.action = FetchRequestAction.fromNativeValue(map['action']);
return instance;
@ -87,19 +87,19 @@ class FetchRequest {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"method": method,
"headers": headers,
"action": action?.toNativeValue(),
"body": body,
"mode": mode,
"credentials": credentials?.toMap(),
"cache": cache,
"credentials": credentials?.toMap(),
"headers": headers,
"integrity": integrity,
"keepalive": keepalive,
"method": method,
"mode": mode,
"redirect": redirect,
"referrer": referrer,
"referrerPolicy": referrerPolicy?.toNativeValue(),
"integrity": integrity,
"keepalive": keepalive,
"action": action?.toNativeValue(),
"url": url?.toString(),
};
}
@ -110,6 +110,6 @@ class FetchRequest {
@override
String toString() {
return 'FetchRequest{url: $url, method: $method, headers: $headers, body: $body, mode: $mode, credentials: $credentials, cache: $cache, redirect: $redirect, referrer: $referrer, referrerPolicy: $referrerPolicy, integrity: $integrity, keepalive: $keepalive, action: $action}';
return 'FetchRequest{action: $action, body: $body, cache: $cache, credentials: $credentials, headers: $headers, integrity: $integrity, keepalive: $keepalive, method: $method, mode: $mode, redirect: $redirect, referrer: $referrer, referrerPolicy: $referrerPolicy, url: $url}';
}
}

View File

@ -8,6 +8,9 @@ part of 'fetch_request_federated_credential.dart';
///Class that represents a [FederatedCredential](https://developer.mozilla.org/en-US/docs/Web/API/FederatedCredential) type of credentials.
class FetchRequestFederatedCredential extends FetchRequestCredential {
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
WebUri? iconURL;
///Credential's identifier.
dynamic id;
@ -19,15 +22,12 @@ class FetchRequestFederatedCredential extends FetchRequestCredential {
///Credential's federated identity provider.
String? provider;
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
WebUri? iconURL;
FetchRequestFederatedCredential(
{this.id,
{this.iconURL,
this.id,
this.name,
this.protocol,
this.provider,
this.iconURL,
String? type})
: super(type: type);
@ -37,11 +37,11 @@ class FetchRequestFederatedCredential extends FetchRequestCredential {
return null;
}
final instance = FetchRequestFederatedCredential(
iconURL: map['iconURL'] != null ? WebUri(map['iconURL']) : null,
id: map['id'],
name: map['name'],
protocol: map['protocol'],
provider: map['provider'],
iconURL: map['iconURL'] != null ? WebUri(map['iconURL']) : null,
);
instance.type = map['type'];
return instance;
@ -51,11 +51,11 @@ class FetchRequestFederatedCredential extends FetchRequestCredential {
Map<String, dynamic> toMap() {
return {
"type": type,
"iconURL": iconURL?.toString(),
"id": id,
"name": name,
"protocol": protocol,
"provider": provider,
"iconURL": iconURL?.toString(),
};
}
@ -66,6 +66,6 @@ class FetchRequestFederatedCredential extends FetchRequestCredential {
@override
String toString() {
return 'FetchRequestFederatedCredential{type: $type, id: $id, name: $name, protocol: $protocol, provider: $provider, iconURL: $iconURL}';
return 'FetchRequestFederatedCredential{type: $type, iconURL: $iconURL, id: $id, name: $name, protocol: $protocol, provider: $provider}';
}
}

View File

@ -8,6 +8,9 @@ part of 'fetch_request_password_credential.dart';
///Class that represents a [PasswordCredential](https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential) type of credentials.
class FetchRequestPasswordCredential extends FetchRequestCredential {
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
WebUri? iconURL;
///Credential's identifier.
dynamic id;
@ -16,11 +19,8 @@ class FetchRequestPasswordCredential extends FetchRequestCredential {
///The password of the credential.
String? password;
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
WebUri? iconURL;
FetchRequestPasswordCredential(
{this.id, this.name, this.password, this.iconURL, String? type})
{this.iconURL, this.id, this.name, this.password, String? type})
: super(type: type);
///Gets a possible [FetchRequestPasswordCredential] instance from a [Map] value.
@ -29,10 +29,10 @@ class FetchRequestPasswordCredential extends FetchRequestCredential {
return null;
}
final instance = FetchRequestPasswordCredential(
iconURL: map['iconURL'] != null ? WebUri(map['iconURL']) : null,
id: map['id'],
name: map['name'],
password: map['password'],
iconURL: map['iconURL'] != null ? WebUri(map['iconURL']) : null,
);
instance.type = map['type'];
return instance;
@ -42,10 +42,10 @@ class FetchRequestPasswordCredential extends FetchRequestCredential {
Map<String, dynamic> toMap() {
return {
"type": type,
"iconURL": iconURL?.toString(),
"id": id,
"name": name,
"password": password,
"iconURL": iconURL?.toString(),
};
}
@ -56,6 +56,6 @@ class FetchRequestPasswordCredential extends FetchRequestCredential {
@override
String toString() {
return 'FetchRequestPasswordCredential{type: $type, id: $id, name: $name, password: $password, iconURL: $iconURL}';
return 'FetchRequestPasswordCredential{type: $type, iconURL: $iconURL, id: $id, name: $name, password: $password}';
}
}

View File

@ -7,18 +7,18 @@ part of 'find_session.dart';
// **************************************************************************
class FindSession {
///Returns the total number of results.
int resultCount;
///Returns the index of the currently highlighted result.
///If no result is currently highlighted.
int highlightedResultIndex;
///Returns the total number of results.
int resultCount;
/// Defines how results are reported through the find panel's UI.
SearchResultDisplayStyle searchResultDisplayStyle;
FindSession(
{required this.resultCount,
required this.highlightedResultIndex,
{required this.highlightedResultIndex,
required this.resultCount,
required this.searchResultDisplayStyle});
///Gets a possible [FindSession] instance from a [Map] value.
@ -27,8 +27,8 @@ class FindSession {
return null;
}
final instance = FindSession(
resultCount: map['resultCount'],
highlightedResultIndex: map['highlightedResultIndex'],
resultCount: map['resultCount'],
searchResultDisplayStyle: SearchResultDisplayStyle.fromNativeValue(
map['searchResultDisplayStyle'])!,
);
@ -38,8 +38,8 @@ class FindSession {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"resultCount": resultCount,
"highlightedResultIndex": highlightedResultIndex,
"resultCount": resultCount,
"searchResultDisplayStyle": searchResultDisplayStyle.toNativeValue(),
};
}
@ -51,6 +51,6 @@ class FindSession {
@override
String toString() {
return 'FindSession{resultCount: $resultCount, highlightedResultIndex: $highlightedResultIndex, searchResultDisplayStyle: $searchResultDisplayStyle}';
return 'FindSession{highlightedResultIndex: $highlightedResultIndex, resultCount: $resultCount, searchResultDisplayStyle: $searchResultDisplayStyle}';
}
}

View File

@ -15,20 +15,20 @@ class ForceDark {
factory ForceDark._internalMultiPlatform(int value, Function nativeValue) =>
ForceDark._internal(value, nativeValue());
///Enable force dark dependent on the state of the WebView parent view.
static const AUTO = ForceDark._internal(1, 1);
///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 OFF = ForceDark._internal(0, 0);
///Enable force dark dependent on the state of the WebView parent view.
static const AUTO = ForceDark._internal(1, 1);
///Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.
static const ON = ForceDark._internal(2, 2);
///Set of all values of [ForceDark].
static final Set<ForceDark> values = [
ForceDark.OFF,
ForceDark.AUTO,
ForceDark.OFF,
ForceDark.ON,
].toSet();
@ -73,10 +73,10 @@ class ForceDark {
@override
String toString() {
switch (_value) {
case 0:
return 'OFF';
case 1:
return 'AUTO';
case 0:
return 'OFF';
case 2:
return 'ON';
}
@ -99,20 +99,20 @@ class AndroidForceDark {
int value, Function nativeValue) =>
AndroidForceDark._internal(value, nativeValue());
///Enable force dark dependent on the state of the WebView parent view.
static const FORCE_DARK_AUTO = AndroidForceDark._internal(1, 1);
///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 = AndroidForceDark._internal(0, 0);
///Enable force dark dependent on the state of the WebView parent view.
static const FORCE_DARK_AUTO = AndroidForceDark._internal(1, 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 = AndroidForceDark._internal(2, 2);
///Set of all values of [AndroidForceDark].
static final Set<AndroidForceDark> values = [
AndroidForceDark.FORCE_DARK_OFF,
AndroidForceDark.FORCE_DARK_AUTO,
AndroidForceDark.FORCE_DARK_OFF,
AndroidForceDark.FORCE_DARK_ON,
].toSet();
@ -157,10 +157,10 @@ class AndroidForceDark {
@override
String toString() {
switch (_value) {
case 0:
return 'FORCE_DARK_OFF';
case 1:
return 'FORCE_DARK_AUTO';
case 0:
return 'FORCE_DARK_OFF';
case 2:
return 'FORCE_DARK_ON';
}

View File

@ -16,6 +16,15 @@ class ForceDarkStrategy {
int value, Function nativeValue) =>
ForceDarkStrategy._internal(value, nativeValue());
///In this mode [WebView] content will be darkened by a user agent unless web page supports dark theme.
///[WebView] determines whether web pages supports dark theme by the presence of `color-scheme` metadata containing `"dark"` value.
///For example, `<meta name="color-scheme" content="dark light">`.
///If the metadata is not presented [WebView] content will be darkened by a user agent and `prefers-color-scheme` media query will evaluate to light.
///
///See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.
static const PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING =
ForceDarkStrategy._internal(2, 2);
///In this mode [WebView] content will be darkened by a user agent and it will ignore the web page's dark theme if it exists.
///To avoid mixing two different darkening strategies, the `prefers-color-scheme` media query will evaluate to light.
///
@ -28,20 +37,11 @@ class ForceDarkStrategy {
///See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.
static const WEB_THEME_DARKENING_ONLY = ForceDarkStrategy._internal(1, 1);
///In this mode [WebView] content will be darkened by a user agent unless web page supports dark theme.
///[WebView] determines whether web pages supports dark theme by the presence of `color-scheme` metadata containing `"dark"` value.
///For example, `<meta name="color-scheme" content="dark light">`.
///If the metadata is not presented [WebView] content will be darkened by a user agent and `prefers-color-scheme` media query will evaluate to light.
///
///See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.
static const PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING =
ForceDarkStrategy._internal(2, 2);
///Set of all values of [ForceDarkStrategy].
static final Set<ForceDarkStrategy> values = [
ForceDarkStrategy.PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING,
ForceDarkStrategy.USER_AGENT_DARKENING_ONLY,
ForceDarkStrategy.WEB_THEME_DARKENING_ONLY,
ForceDarkStrategy.PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING,
].toSet();
///Gets a possible [ForceDarkStrategy] instance from [int] value.
@ -85,12 +85,12 @@ class ForceDarkStrategy {
@override
String toString() {
switch (_value) {
case 2:
return 'PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING';
case 0:
return 'USER_AGENT_DARKENING_ONLY';
case 1:
return 'WEB_THEME_DARKENING_ONLY';
case 2:
return 'PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING';
}
return _value.toString();
}

View File

@ -16,16 +16,16 @@ class FormResubmissionAction {
int value, Function nativeValue) =>
FormResubmissionAction._internal(value, nativeValue());
///Resend data
static const RESEND = FormResubmissionAction._internal(0, 0);
///Don't resend data
static const DONT_RESEND = FormResubmissionAction._internal(1, 1);
///Resend data
static const RESEND = FormResubmissionAction._internal(0, 0);
///Set of all values of [FormResubmissionAction].
static final Set<FormResubmissionAction> values = [
FormResubmissionAction.RESEND,
FormResubmissionAction.DONT_RESEND,
FormResubmissionAction.RESEND,
].toSet();
///Gets a possible [FormResubmissionAction] instance from [int] value.
@ -69,10 +69,10 @@ class FormResubmissionAction {
@override
String toString() {
switch (_value) {
case 0:
return 'RESEND';
case 1:
return 'DONT_RESEND';
case 0:
return 'RESEND';
}
return _value.toString();
}

View File

@ -8,17 +8,17 @@ part of 'geolocation_permission_show_prompt_response.dart';
///Class used by the host application to set the Geolocation permission state for an origin during the [WebView.onGeolocationPermissionsShowPrompt] event.
class GeolocationPermissionShowPromptResponse {
///The origin for which permissions are set.
String origin;
///Whether or not the origin should be allowed to use the Geolocation API.
bool allow;
///The origin for which permissions are set.
String origin;
///Whether the permission should be retained beyond the lifetime of a page currently being displayed by a WebView
///The default value is `false`.
bool retain;
GeolocationPermissionShowPromptResponse(
{required this.origin, required this.allow, this.retain = false});
{required this.allow, required this.origin, this.retain = false});
///Gets a possible [GeolocationPermissionShowPromptResponse] instance from a [Map] value.
static GeolocationPermissionShowPromptResponse? fromMap(
@ -27,8 +27,8 @@ class GeolocationPermissionShowPromptResponse {
return null;
}
final instance = GeolocationPermissionShowPromptResponse(
origin: map['origin'],
allow: map['allow'],
origin: map['origin'],
);
instance.retain = map['retain'];
return instance;
@ -37,8 +37,8 @@ class GeolocationPermissionShowPromptResponse {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"origin": origin,
"allow": allow,
"origin": origin,
"retain": retain,
};
}
@ -50,6 +50,6 @@ class GeolocationPermissionShowPromptResponse {
@override
String toString() {
return 'GeolocationPermissionShowPromptResponse{origin: $origin, allow: $allow, retain: $retain}';
return 'GeolocationPermissionShowPromptResponse{allow: $allow, origin: $origin, retain: $retain}';
}
}

View File

@ -8,8 +8,8 @@ part of 'http_auth_response.dart';
///Class that represents the response used by the [WebView.onReceivedHttpAuthRequest] event.
class HttpAuthResponse {
///Represents the username used for the authentication if the [action] corresponds to [HttpAuthResponseAction.PROCEED]
String username;
///Indicate the [HttpAuthResponseAction] to take in response of the authentication challenge.
HttpAuthResponseAction? action;
///Represents the password used for the authentication if the [action] corresponds to [HttpAuthResponseAction.PROCEED]
String password;
@ -17,13 +17,13 @@ class HttpAuthResponse {
///Indicate if the given credentials need to be saved permanently.
bool permanentPersistence;
///Indicate the [HttpAuthResponseAction] to take in response of the authentication challenge.
HttpAuthResponseAction? action;
///Represents the username used for the authentication if the [action] corresponds to [HttpAuthResponseAction.PROCEED]
String username;
HttpAuthResponse(
{this.username = "",
{this.action = HttpAuthResponseAction.CANCEL,
this.password = "",
this.permanentPersistence = false,
this.action = HttpAuthResponseAction.CANCEL});
this.username = ""});
///Gets a possible [HttpAuthResponse] instance from a [Map] value.
static HttpAuthResponse? fromMap(Map<String, dynamic>? map) {
@ -31,20 +31,20 @@ class HttpAuthResponse {
return null;
}
final instance = HttpAuthResponse();
instance.username = map['username'];
instance.action = HttpAuthResponseAction.fromNativeValue(map['action']);
instance.password = map['password'];
instance.permanentPersistence = map['permanentPersistence'];
instance.action = HttpAuthResponseAction.fromNativeValue(map['action']);
instance.username = map['username'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"username": username,
"action": action?.toNativeValue(),
"password": password,
"permanentPersistence": permanentPersistence,
"action": action?.toNativeValue(),
"username": username,
};
}
@ -55,6 +55,6 @@ class HttpAuthResponse {
@override
String toString() {
return 'HttpAuthResponse{username: $username, password: $password, permanentPersistence: $permanentPersistence, action: $action}';
return 'HttpAuthResponse{action: $action, password: $password, permanentPersistence: $permanentPersistence, username: $username}';
}
}

View File

@ -9,20 +9,11 @@ part of 'http_authentication_challenge.dart';
///Class that represents the challenge of the [WebView.onReceivedHttpAuthRequest] event.
///It provides all the information about the challenge.
class HttpAuthenticationChallenge extends URLAuthenticationChallenge {
///A count of previous failed authentication attempts.
int previousFailureCount;
///The proposed credential for this challenge.
///This method returns `null` if there is no default credential for this challenge.
///If you have previously attempted to authenticate and failed, this method returns the most recent failed credential.
///If the proposed credential is not nil and returns true when you call its hasPassword method, then the credential is ready to use as-is.
///If the proposed credentials hasPassword method returns false, then the credential provides a default user name,
///and the client must prompt the user for a corresponding password.
URLCredential? proposedCredential;
///Use [failureResponse] instead.
@Deprecated('Use failureResponse instead')
IOSURLResponse? iosFailureResponse;
///The error object representing the last authentication failure.
///This value is `null` if the protocol doesnt use errors to indicate an authentication failure.
///
///**NOTE**: available only on iOS.
String? error;
///The URL response object representing the last authentication failure.
///This value is `null` if the protocol doesnt use responses to indicate an authentication failure.
@ -34,23 +25,32 @@ class HttpAuthenticationChallenge extends URLAuthenticationChallenge {
@Deprecated('Use error instead')
String? iosError;
///The error object representing the last authentication failure.
///This value is `null` if the protocol doesnt use errors to indicate an authentication failure.
///
///**NOTE**: available only on iOS.
String? error;
///Use [failureResponse] instead.
@Deprecated('Use failureResponse instead')
IOSURLResponse? iosFailureResponse;
///A count of previous failed authentication attempts.
int previousFailureCount;
///The proposed credential for this challenge.
///This method returns `null` if there is no default credential for this challenge.
///If you have previously attempted to authenticate and failed, this method returns the most recent failed credential.
///If the proposed credential is not nil and returns true when you call its hasPassword method, then the credential is ready to use as-is.
///If the proposed credentials hasPassword method returns false, then the credential provides a default user name,
///and the client must prompt the user for a corresponding password.
URLCredential? proposedCredential;
HttpAuthenticationChallenge(
{required this.previousFailureCount,
this.proposedCredential,
@Deprecated('Use failureResponse instead') this.iosFailureResponse,
{this.error,
this.failureResponse,
@Deprecated('Use error instead') this.iosError,
this.error,
@Deprecated('Use failureResponse instead') this.iosFailureResponse,
required this.previousFailureCount,
this.proposedCredential,
required URLProtectionSpace protectionSpace})
: super(protectionSpace: protectionSpace) {
error = error ?? iosError;
failureResponse =
failureResponse ?? URLResponse.fromMap(iosFailureResponse?.toMap());
error = error ?? iosError;
}
///Gets a possible [HttpAuthenticationChallenge] instance from a [Map] value.
@ -61,15 +61,15 @@ class HttpAuthenticationChallenge extends URLAuthenticationChallenge {
final instance = HttpAuthenticationChallenge(
protectionSpace: URLProtectionSpace.fromMap(
map['protectionSpace']?.cast<String, dynamic>())!,
previousFailureCount: map['previousFailureCount'],
proposedCredential: URLCredential.fromMap(
map['proposedCredential']?.cast<String, dynamic>()),
iosFailureResponse: IOSURLResponse.fromMap(
map['failureResponse']?.cast<String, dynamic>()),
error: map['error'],
failureResponse:
URLResponse.fromMap(map['failureResponse']?.cast<String, dynamic>()),
iosError: map['error'],
error: map['error'],
iosFailureResponse: IOSURLResponse.fromMap(
map['failureResponse']?.cast<String, dynamic>()),
previousFailureCount: map['previousFailureCount'],
proposedCredential: URLCredential.fromMap(
map['proposedCredential']?.cast<String, dynamic>()),
);
return instance;
}
@ -78,10 +78,10 @@ class HttpAuthenticationChallenge extends URLAuthenticationChallenge {
Map<String, dynamic> toMap() {
return {
"protectionSpace": protectionSpace.toMap(),
"error": error,
"failureResponse": failureResponse?.toMap(),
"previousFailureCount": previousFailureCount,
"proposedCredential": proposedCredential?.toMap(),
"failureResponse": failureResponse?.toMap(),
"error": error,
};
}
@ -92,6 +92,6 @@ class HttpAuthenticationChallenge extends URLAuthenticationChallenge {
@override
String toString() {
return 'HttpAuthenticationChallenge{protectionSpace: $protectionSpace, previousFailureCount: $previousFailureCount, proposedCredential: $proposedCredential, failureResponse: $failureResponse, error: $error}';
return 'HttpAuthenticationChallenge{protectionSpace: $protectionSpace, error: $error, failureResponse: $failureResponse, previousFailureCount: $previousFailureCount, proposedCredential: $proposedCredential}';
}
}

View File

@ -22,22 +22,22 @@ class HTTPCookieSameSitePolicy {
///request initiated by third party website. This is the default value in modern browsers.
static const LAX = HTTPCookieSameSitePolicy._internal('Lax', 'Lax');
///SameSite=Strict;
///
///Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites.
static const STRICT = HTTPCookieSameSitePolicy._internal('Strict', 'Strict');
///SameSite=None;
///
///Cookies will be sent in all contexts, i.e sending cross-origin is allowed.
///`None` requires the `Secure` attribute in latest browser versions.
static const NONE = HTTPCookieSameSitePolicy._internal('None', 'None');
///SameSite=Strict;
///
///Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites.
static const STRICT = HTTPCookieSameSitePolicy._internal('Strict', 'Strict');
///Set of all values of [HTTPCookieSameSitePolicy].
static final Set<HTTPCookieSameSitePolicy> values = [
HTTPCookieSameSitePolicy.LAX,
HTTPCookieSameSitePolicy.STRICT,
HTTPCookieSameSitePolicy.NONE,
HTTPCookieSameSitePolicy.STRICT,
].toSet();
///Gets a possible [HTTPCookieSameSitePolicy] instance from [String] value.

View File

@ -8,12 +8,12 @@ part of 'in_app_webview_hit_test_result.dart';
///Class that represents the hit result for hitting an HTML elements.
class InAppWebViewHitTestResult {
///The type of the hit test result.
InAppWebViewHitTestResultType? type;
///Additional type-dependant information about the result.
String? extra;
InAppWebViewHitTestResult({this.type, this.extra});
///The type of the hit test result.
InAppWebViewHitTestResultType? type;
InAppWebViewHitTestResult({this.extra, this.type});
///Gets a possible [InAppWebViewHitTestResult] instance from a [Map] value.
static InAppWebViewHitTestResult? fromMap(Map<String, dynamic>? map) {
@ -21,8 +21,8 @@ class InAppWebViewHitTestResult {
return null;
}
final instance = InAppWebViewHitTestResult(
type: InAppWebViewHitTestResultType.fromNativeValue(map['type']),
extra: map['extra'],
type: InAppWebViewHitTestResultType.fromNativeValue(map['type']),
);
return instance;
}
@ -30,8 +30,8 @@ class InAppWebViewHitTestResult {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type?.toNativeValue(),
"extra": extra,
"type": type?.toNativeValue(),
};
}
@ -42,6 +42,6 @@ class InAppWebViewHitTestResult {
@override
String toString() {
return 'InAppWebViewHitTestResult{type: $type, extra: $extra}';
return 'InAppWebViewHitTestResult{extra: $extra, type: $type}';
}
}

View File

@ -16,21 +16,21 @@ class InAppWebViewHitTestResultType {
int value, Function nativeValue) =>
InAppWebViewHitTestResultType._internal(value, nativeValue());
///Default [InAppWebViewHitTestResult], where the target is unknown.
static const UNKNOWN_TYPE = InAppWebViewHitTestResultType._internal(0, 0);
///[InAppWebViewHitTestResult] for hitting a phone number.
static const PHONE_TYPE = InAppWebViewHitTestResultType._internal(2, 2);
///[InAppWebViewHitTestResult] for hitting a map address.
static const GEO_TYPE = InAppWebViewHitTestResultType._internal(3, 3);
///[InAppWebViewHitTestResult] for hitting an edit text area.
static const EDIT_TEXT_TYPE = InAppWebViewHitTestResultType._internal(9, 9);
///[InAppWebViewHitTestResult] for hitting an email address.
static const EMAIL_TYPE = InAppWebViewHitTestResultType._internal(4, 4);
///[InAppWebViewHitTestResult] for hitting a map address.
static const GEO_TYPE = InAppWebViewHitTestResultType._internal(3, 3);
///[InAppWebViewHitTestResult] for hitting an HTML::img tag.
static const IMAGE_TYPE = InAppWebViewHitTestResultType._internal(5, 5);
///[InAppWebViewHitTestResult] for hitting a phone number.
static const PHONE_TYPE = InAppWebViewHitTestResultType._internal(2, 2);
///[InAppWebViewHitTestResult] for hitting a HTML::a tag with src=http.
static const SRC_ANCHOR_TYPE = InAppWebViewHitTestResultType._internal(7, 7);
@ -38,19 +38,19 @@ class InAppWebViewHitTestResultType {
static const SRC_IMAGE_ANCHOR_TYPE =
InAppWebViewHitTestResultType._internal(8, 8);
///[InAppWebViewHitTestResult] for hitting an edit text area.
static const EDIT_TEXT_TYPE = InAppWebViewHitTestResultType._internal(9, 9);
///Default [InAppWebViewHitTestResult], where the target is unknown.
static const UNKNOWN_TYPE = InAppWebViewHitTestResultType._internal(0, 0);
///Set of all values of [InAppWebViewHitTestResultType].
static final Set<InAppWebViewHitTestResultType> values = [
InAppWebViewHitTestResultType.UNKNOWN_TYPE,
InAppWebViewHitTestResultType.PHONE_TYPE,
InAppWebViewHitTestResultType.GEO_TYPE,
InAppWebViewHitTestResultType.EDIT_TEXT_TYPE,
InAppWebViewHitTestResultType.EMAIL_TYPE,
InAppWebViewHitTestResultType.GEO_TYPE,
InAppWebViewHitTestResultType.IMAGE_TYPE,
InAppWebViewHitTestResultType.PHONE_TYPE,
InAppWebViewHitTestResultType.SRC_ANCHOR_TYPE,
InAppWebViewHitTestResultType.SRC_IMAGE_ANCHOR_TYPE,
InAppWebViewHitTestResultType.EDIT_TEXT_TYPE,
InAppWebViewHitTestResultType.UNKNOWN_TYPE,
].toSet();
///Gets a possible [InAppWebViewHitTestResultType] instance from [int] value.
@ -94,22 +94,22 @@ class InAppWebViewHitTestResultType {
@override
String toString() {
switch (_value) {
case 0:
return 'UNKNOWN_TYPE';
case 2:
return 'PHONE_TYPE';
case 3:
return 'GEO_TYPE';
case 9:
return 'EDIT_TEXT_TYPE';
case 4:
return 'EMAIL_TYPE';
case 3:
return 'GEO_TYPE';
case 5:
return 'IMAGE_TYPE';
case 2:
return 'PHONE_TYPE';
case 7:
return 'SRC_ANCHOR_TYPE';
case 8:
return 'SRC_IMAGE_ANCHOR_TYPE';
case 9:
return 'EDIT_TEXT_TYPE';
case 0:
return 'UNKNOWN_TYPE';
}
return _value.toString();
}

View File

@ -8,34 +8,34 @@ part of 'in_app_webview_initial_data.dart';
///Initial [data] as a content for an [WebView] instance, using [baseUrl] as the base URL for it.
class InAppWebViewInitialData {
///A String of data in the given encoding.
String data;
///The MIME type of the data, e.g. "text/html". The default value is `"text/html"`.
String mimeType;
///The encoding of the data. The default value is `"utf8"`.
String encoding;
///Use [historyUrl] instead.
@Deprecated('Use historyUrl instead')
Uri? androidHistoryUrl;
///The URL to use as the page's base URL. If `null` defaults to `about:blank`.
WebUri? baseUrl;
///Use [historyUrl] instead.
@Deprecated('Use historyUrl instead')
Uri? androidHistoryUrl;
///A String of data in the given encoding.
String data;
///The encoding of the data. The default value is `"utf8"`.
String encoding;
///The URL to use as the history entry. If `null` defaults to `about:blank`. If non-null, this must be a valid URL.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
WebUri? historyUrl;
///The MIME type of the data, e.g. "text/html". The default value is `"text/html"`.
String mimeType;
InAppWebViewInitialData(
{required this.data,
this.mimeType = "text/html",
this.encoding = "utf8",
{@Deprecated('Use historyUrl instead') this.androidHistoryUrl,
this.baseUrl,
@Deprecated('Use historyUrl instead') this.androidHistoryUrl,
this.historyUrl}) {
required this.data,
this.encoding = "utf8",
this.historyUrl,
this.mimeType = "text/html"}) {
historyUrl = historyUrl ??
(androidHistoryUrl != null ? WebUri.uri(androidHistoryUrl!) : null);
}
@ -46,25 +46,25 @@ class InAppWebViewInitialData {
return null;
}
final instance = InAppWebViewInitialData(
data: map['data'],
baseUrl: map['baseUrl'] != null ? WebUri(map['baseUrl']) : null,
androidHistoryUrl:
map['historyUrl'] != null ? Uri.tryParse(map['historyUrl']) : null,
baseUrl: map['baseUrl'] != null ? WebUri(map['baseUrl']) : null,
data: map['data'],
historyUrl: map['historyUrl'] != null ? WebUri(map['historyUrl']) : null,
);
instance.mimeType = map['mimeType'];
instance.encoding = map['encoding'];
instance.mimeType = map['mimeType'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"data": data,
"mimeType": mimeType,
"encoding": encoding,
"baseUrl": baseUrl?.toString(),
"data": data,
"encoding": encoding,
"historyUrl": historyUrl?.toString(),
"mimeType": mimeType,
};
}
@ -75,6 +75,6 @@ class InAppWebViewInitialData {
@override
String toString() {
return 'InAppWebViewInitialData{data: $data, mimeType: $mimeType, encoding: $encoding, baseUrl: $baseUrl, historyUrl: $historyUrl}';
return 'InAppWebViewInitialData{baseUrl: $baseUrl, data: $data, encoding: $encoding, historyUrl: $historyUrl, mimeType: $mimeType}';
}
}

View File

@ -8,17 +8,17 @@ part of 'in_app_webview_rect.dart';
///A class that represents a structure that contains the location and dimensions of a rectangle.
class InAppWebViewRect {
///rect height
double height;
///rect width
double width;
///x position
double x;
///y position
double y;
///rect width
double width;
///rect height
double height;
InAppWebViewRect(
{required this.x,
required this.y,
@ -33,10 +33,10 @@ class InAppWebViewRect {
return null;
}
final instance = InAppWebViewRect(
height: map['height'],
width: map['width'],
x: map['x'],
y: map['y'],
width: map['width'],
height: map['height'],
);
return instance;
}
@ -44,10 +44,10 @@ class InAppWebViewRect {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"height": height,
"width": width,
"x": x,
"y": y,
"width": width,
"height": height,
};
}
@ -58,6 +58,6 @@ class InAppWebViewRect {
@override
String toString() {
return 'InAppWebViewRect{x: $x, y: $y, width: $width, height: $height}';
return 'InAppWebViewRect{height: $height, width: $width, x: $x, y: $y}';
}
}

View File

@ -8,12 +8,6 @@ part of 'js_alert_request.dart';
///Class that represents the request of the [WebView.onJsAlert] event.
class JsAlertRequest {
///The url of the page requesting the dialog.
WebUri? url;
///Message to be displayed in the window.
String? message;
///Use [isMainFrame] instead.
@Deprecated('Use isMainFrame instead')
bool? iosIsMainFrame;
@ -24,11 +18,17 @@ class JsAlertRequest {
///- iOS
///- MacOS
bool? isMainFrame;
///Message to be displayed in the window.
String? message;
///The url of the page requesting the dialog.
WebUri? url;
JsAlertRequest(
{this.url,
{@Deprecated('Use isMainFrame instead') this.iosIsMainFrame,
this.isMainFrame,
this.message,
@Deprecated('Use isMainFrame instead') this.iosIsMainFrame,
this.isMainFrame}) {
this.url}) {
isMainFrame = isMainFrame ?? iosIsMainFrame;
}
@ -38,10 +38,10 @@ class JsAlertRequest {
return null;
}
final instance = JsAlertRequest(
url: map['url'] != null ? WebUri(map['url']) : null,
message: map['message'],
iosIsMainFrame: map['isMainFrame'],
isMainFrame: map['isMainFrame'],
message: map['message'],
url: map['url'] != null ? WebUri(map['url']) : null,
);
return instance;
}
@ -49,9 +49,9 @@ class JsAlertRequest {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
"isMainFrame": isMainFrame,
"message": message,
"url": url?.toString(),
};
}
@ -62,6 +62,6 @@ class JsAlertRequest {
@override
String toString() {
return 'JsAlertRequest{url: $url, message: $message, isMainFrame: $isMainFrame}';
return 'JsAlertRequest{isMainFrame: $isMainFrame, message: $message, url: $url}';
}
}

View File

@ -8,8 +8,8 @@ part of 'js_alert_response.dart';
///Class that represents the response used by the [WebView.onJsAlert] event to control a JavaScript alert dialog.
class JsAlertResponse {
///Message to be displayed in the window.
String message;
///Action used to confirm that the user hit confirm button.
JsAlertResponseAction? action;
///Title of the confirm button.
String confirmButtonTitle;
@ -17,13 +17,13 @@ class JsAlertResponse {
///Whether the client will handle the alert dialog.
bool handledByClient;
///Action used to confirm that the user hit confirm button.
JsAlertResponseAction? action;
///Message to be displayed in the window.
String message;
JsAlertResponse(
{this.message = "",
{this.action = JsAlertResponseAction.CONFIRM,
this.confirmButtonTitle = "",
this.handledByClient = false,
this.action = JsAlertResponseAction.CONFIRM});
this.message = ""});
///Gets a possible [JsAlertResponse] instance from a [Map] value.
static JsAlertResponse? fromMap(Map<String, dynamic>? map) {
@ -31,20 +31,20 @@ class JsAlertResponse {
return null;
}
final instance = JsAlertResponse();
instance.message = map['message'];
instance.action = JsAlertResponseAction.fromNativeValue(map['action']);
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.action = JsAlertResponseAction.fromNativeValue(map['action']);
instance.message = map['message'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"action": action?.toNativeValue(),
"confirmButtonTitle": confirmButtonTitle,
"handledByClient": handledByClient,
"action": action?.toNativeValue(),
"message": message,
};
}
@ -55,6 +55,6 @@ class JsAlertResponse {
@override
String toString() {
return 'JsAlertResponse{message: $message, confirmButtonTitle: $confirmButtonTitle, handledByClient: $handledByClient, action: $action}';
return 'JsAlertResponse{action: $action, confirmButtonTitle: $confirmButtonTitle, handledByClient: $handledByClient, message: $message}';
}
}

View File

@ -8,12 +8,12 @@ part of 'js_before_unload_request.dart';
///Class that represents the request of the [WebView.onJsBeforeUnload] event.
class JsBeforeUnloadRequest {
///The url of the page requesting the dialog.
WebUri? url;
///Message to be displayed in the window.
String? message;
JsBeforeUnloadRequest({this.url, this.message});
///The url of the page requesting the dialog.
WebUri? url;
JsBeforeUnloadRequest({this.message, this.url});
///Gets a possible [JsBeforeUnloadRequest] instance from a [Map] value.
static JsBeforeUnloadRequest? fromMap(Map<String, dynamic>? map) {
@ -21,8 +21,8 @@ class JsBeforeUnloadRequest {
return null;
}
final instance = JsBeforeUnloadRequest(
url: map['url'] != null ? WebUri(map['url']) : null,
message: map['message'],
url: map['url'] != null ? WebUri(map['url']) : null,
);
return instance;
}
@ -30,8 +30,8 @@ class JsBeforeUnloadRequest {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
"url": url?.toString(),
};
}
@ -42,6 +42,6 @@ class JsBeforeUnloadRequest {
@override
String toString() {
return 'JsBeforeUnloadRequest{url: $url, message: $message}';
return 'JsBeforeUnloadRequest{message: $message, url: $url}';
}
}

View File

@ -8,26 +8,26 @@ part of 'js_before_unload_response.dart';
///Class that represents the response used by the [WebView.onJsBeforeUnload] event to control a JavaScript alert dialog.
class JsBeforeUnloadResponse {
///Message to be displayed in the window.
String message;
///Title of the confirm button.
String confirmButtonTitle;
///Action used to confirm that the user hit confirm or cancel button.
JsBeforeUnloadResponseAction? action;
///Title of the cancel button.
String cancelButtonTitle;
///Title of the confirm button.
String confirmButtonTitle;
///Whether the client will handle the alert dialog.
bool handledByClient;
///Action used to confirm that the user hit confirm or cancel button.
JsBeforeUnloadResponseAction? action;
///Message to be displayed in the window.
String message;
JsBeforeUnloadResponse(
{this.message = "",
this.confirmButtonTitle = "",
{this.action = JsBeforeUnloadResponseAction.CONFIRM,
this.cancelButtonTitle = "",
this.confirmButtonTitle = "",
this.handledByClient = false,
this.action = JsBeforeUnloadResponseAction.CONFIRM});
this.message = ""});
///Gets a possible [JsBeforeUnloadResponse] instance from a [Map] value.
static JsBeforeUnloadResponse? fromMap(Map<String, dynamic>? map) {
@ -35,23 +35,23 @@ class JsBeforeUnloadResponse {
return null;
}
final instance = JsBeforeUnloadResponse();
instance.message = map['message'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.cancelButtonTitle = map['cancelButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.action =
JsBeforeUnloadResponseAction.fromNativeValue(map['action']);
instance.cancelButtonTitle = map['cancelButtonTitle'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.message = map['message'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"confirmButtonTitle": confirmButtonTitle,
"cancelButtonTitle": cancelButtonTitle,
"handledByClient": handledByClient,
"action": action?.toNativeValue(),
"cancelButtonTitle": cancelButtonTitle,
"confirmButtonTitle": confirmButtonTitle,
"handledByClient": handledByClient,
"message": message,
};
}
@ -62,6 +62,6 @@ class JsBeforeUnloadResponse {
@override
String toString() {
return 'JsBeforeUnloadResponse{message: $message, confirmButtonTitle: $confirmButtonTitle, cancelButtonTitle: $cancelButtonTitle, handledByClient: $handledByClient, action: $action}';
return 'JsBeforeUnloadResponse{action: $action, cancelButtonTitle: $cancelButtonTitle, confirmButtonTitle: $confirmButtonTitle, handledByClient: $handledByClient, message: $message}';
}
}

View File

@ -16,16 +16,16 @@ class JsBeforeUnloadResponseAction {
int value, Function nativeValue) =>
JsBeforeUnloadResponseAction._internal(value, nativeValue());
///Confirm that the user hit confirm button.
static const CONFIRM = JsBeforeUnloadResponseAction._internal(0, 0);
///Confirm that the user hit cancel button.
static const CANCEL = JsBeforeUnloadResponseAction._internal(1, 1);
///Confirm that the user hit confirm button.
static const CONFIRM = JsBeforeUnloadResponseAction._internal(0, 0);
///Set of all values of [JsBeforeUnloadResponseAction].
static final Set<JsBeforeUnloadResponseAction> values = [
JsBeforeUnloadResponseAction.CONFIRM,
JsBeforeUnloadResponseAction.CANCEL,
JsBeforeUnloadResponseAction.CONFIRM,
].toSet();
///Gets a possible [JsBeforeUnloadResponseAction] instance from [int] value.
@ -69,10 +69,10 @@ class JsBeforeUnloadResponseAction {
@override
String toString() {
switch (_value) {
case 0:
return 'CONFIRM';
case 1:
return 'CANCEL';
case 0:
return 'CONFIRM';
}
return _value.toString();
}

View File

@ -8,12 +8,6 @@ part of 'js_confirm_request.dart';
///Class that represents the request of the [WebView.onJsConfirm] event.
class JsConfirmRequest {
///The url of the page requesting the dialog.
WebUri? url;
///Message to be displayed in the window.
String? message;
///Use [isMainFrame] instead.
@Deprecated('Use isMainFrame instead')
bool? iosIsMainFrame;
@ -24,11 +18,17 @@ class JsConfirmRequest {
///- iOS
///- MacOS
bool? isMainFrame;
///Message to be displayed in the window.
String? message;
///The url of the page requesting the dialog.
WebUri? url;
JsConfirmRequest(
{this.url,
{@Deprecated('Use isMainFrame instead') this.iosIsMainFrame,
this.isMainFrame,
this.message,
@Deprecated('Use isMainFrame instead') this.iosIsMainFrame,
this.isMainFrame}) {
this.url}) {
isMainFrame = isMainFrame ?? iosIsMainFrame;
}
@ -38,10 +38,10 @@ class JsConfirmRequest {
return null;
}
final instance = JsConfirmRequest(
url: map['url'] != null ? WebUri(map['url']) : null,
message: map['message'],
iosIsMainFrame: map['isMainFrame'],
isMainFrame: map['isMainFrame'],
message: map['message'],
url: map['url'] != null ? WebUri(map['url']) : null,
);
return instance;
}
@ -49,9 +49,9 @@ class JsConfirmRequest {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
"isMainFrame": isMainFrame,
"message": message,
"url": url?.toString(),
};
}
@ -62,6 +62,6 @@ class JsConfirmRequest {
@override
String toString() {
return 'JsConfirmRequest{url: $url, message: $message, isMainFrame: $isMainFrame}';
return 'JsConfirmRequest{isMainFrame: $isMainFrame, message: $message, url: $url}';
}
}

View File

@ -8,26 +8,26 @@ part of 'js_confirm_response.dart';
///Class that represents the response used by the [WebView.onJsConfirm] event to control a JavaScript confirm dialog.
class JsConfirmResponse {
///Message to be displayed in the window.
String message;
///Title of the confirm button.
String confirmButtonTitle;
///Action used to confirm that the user hit confirm or cancel button.
JsConfirmResponseAction? action;
///Title of the cancel button.
String cancelButtonTitle;
///Title of the confirm button.
String confirmButtonTitle;
///Whether the client will handle the confirm dialog.
bool handledByClient;
///Action used to confirm that the user hit confirm or cancel button.
JsConfirmResponseAction? action;
///Message to be displayed in the window.
String message;
JsConfirmResponse(
{this.message = "",
this.confirmButtonTitle = "",
{this.action = JsConfirmResponseAction.CANCEL,
this.cancelButtonTitle = "",
this.confirmButtonTitle = "",
this.handledByClient = false,
this.action = JsConfirmResponseAction.CANCEL});
this.message = ""});
///Gets a possible [JsConfirmResponse] instance from a [Map] value.
static JsConfirmResponse? fromMap(Map<String, dynamic>? map) {
@ -35,22 +35,22 @@ class JsConfirmResponse {
return null;
}
final instance = JsConfirmResponse();
instance.message = map['message'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.cancelButtonTitle = map['cancelButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.action = JsConfirmResponseAction.fromNativeValue(map['action']);
instance.cancelButtonTitle = map['cancelButtonTitle'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.message = map['message'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"confirmButtonTitle": confirmButtonTitle,
"cancelButtonTitle": cancelButtonTitle,
"handledByClient": handledByClient,
"action": action?.toNativeValue(),
"cancelButtonTitle": cancelButtonTitle,
"confirmButtonTitle": confirmButtonTitle,
"handledByClient": handledByClient,
"message": message,
};
}
@ -61,6 +61,6 @@ class JsConfirmResponse {
@override
String toString() {
return 'JsConfirmResponse{message: $message, confirmButtonTitle: $confirmButtonTitle, cancelButtonTitle: $cancelButtonTitle, handledByClient: $handledByClient, action: $action}';
return 'JsConfirmResponse{action: $action, cancelButtonTitle: $cancelButtonTitle, confirmButtonTitle: $confirmButtonTitle, handledByClient: $handledByClient, message: $message}';
}
}

View File

@ -16,16 +16,16 @@ class JsConfirmResponseAction {
int value, Function nativeValue) =>
JsConfirmResponseAction._internal(value, nativeValue());
///Confirm that the user hit confirm button.
static const CONFIRM = JsConfirmResponseAction._internal(0, 0);
///Confirm that the user hit cancel button.
static const CANCEL = JsConfirmResponseAction._internal(1, 1);
///Confirm that the user hit confirm button.
static const CONFIRM = JsConfirmResponseAction._internal(0, 0);
///Set of all values of [JsConfirmResponseAction].
static final Set<JsConfirmResponseAction> values = [
JsConfirmResponseAction.CONFIRM,
JsConfirmResponseAction.CANCEL,
JsConfirmResponseAction.CONFIRM,
].toSet();
///Gets a possible [JsConfirmResponseAction] instance from [int] value.
@ -69,10 +69,10 @@ class JsConfirmResponseAction {
@override
String toString() {
switch (_value) {
case 0:
return 'CONFIRM';
case 1:
return 'CANCEL';
case 0:
return 'CONFIRM';
}
return _value.toString();
}

View File

@ -8,12 +8,6 @@ part of 'js_prompt_request.dart';
///Class that represents the request of the [WebView.onJsPrompt] event.
class JsPromptRequest {
///The url of the page requesting the dialog.
WebUri? url;
///Message to be displayed in the window.
String? message;
///The default value displayed in the prompt dialog.
String? defaultValue;
@ -27,12 +21,18 @@ class JsPromptRequest {
///- iOS
///- MacOS
bool? isMainFrame;
///Message to be displayed in the window.
String? message;
///The url of the page requesting the dialog.
WebUri? url;
JsPromptRequest(
{this.url,
this.message,
this.defaultValue,
{this.defaultValue,
@Deprecated('Use isMainFrame instead') this.iosIsMainFrame,
this.isMainFrame}) {
this.isMainFrame,
this.message,
this.url}) {
isMainFrame = isMainFrame ?? iosIsMainFrame;
}
@ -42,11 +42,11 @@ class JsPromptRequest {
return null;
}
final instance = JsPromptRequest(
url: map['url'] != null ? WebUri(map['url']) : null,
message: map['message'],
defaultValue: map['defaultValue'],
iosIsMainFrame: map['isMainFrame'],
isMainFrame: map['isMainFrame'],
message: map['message'],
url: map['url'] != null ? WebUri(map['url']) : null,
);
return instance;
}
@ -54,10 +54,10 @@ class JsPromptRequest {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
"defaultValue": defaultValue,
"isMainFrame": isMainFrame,
"message": message,
"url": url?.toString(),
};
}
@ -68,6 +68,6 @@ class JsPromptRequest {
@override
String toString() {
return 'JsPromptRequest{url: $url, message: $message, defaultValue: $defaultValue, isMainFrame: $isMainFrame}';
return 'JsPromptRequest{defaultValue: $defaultValue, isMainFrame: $isMainFrame, message: $message, url: $url}';
}
}

View File

@ -8,34 +8,34 @@ part of 'js_prompt_response.dart';
///Class that represents the response used by the [WebView.onJsPrompt] event to control a JavaScript prompt dialog.
class JsPromptResponse {
///Message to be displayed in the window.
String message;
///The default value displayed in the prompt dialog.
String defaultValue;
///Title of the confirm button.
String confirmButtonTitle;
///Action used to confirm that the user hit confirm or cancel button.
JsPromptResponseAction? action;
///Title of the cancel button.
String cancelButtonTitle;
///Title of the confirm button.
String confirmButtonTitle;
///The default value displayed in the prompt dialog.
String defaultValue;
///Whether the client will handle the prompt dialog.
bool handledByClient;
///Message to be displayed in the window.
String message;
///Value of the prompt dialog.
String? value;
///Action used to confirm that the user hit confirm or cancel button.
JsPromptResponseAction? action;
JsPromptResponse(
{this.message = "",
this.defaultValue = "",
this.confirmButtonTitle = "",
{this.action = JsPromptResponseAction.CANCEL,
this.cancelButtonTitle = "",
this.confirmButtonTitle = "",
this.defaultValue = "",
this.handledByClient = false,
this.value,
this.action = JsPromptResponseAction.CANCEL});
this.message = "",
this.value});
///Gets a possible [JsPromptResponse] instance from a [Map] value.
static JsPromptResponse? fromMap(Map<String, dynamic>? map) {
@ -45,25 +45,25 @@ class JsPromptResponse {
final instance = JsPromptResponse(
value: map['value'],
);
instance.message = map['message'];
instance.defaultValue = map['defaultValue'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.cancelButtonTitle = map['cancelButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.action = JsPromptResponseAction.fromNativeValue(map['action']);
instance.cancelButtonTitle = map['cancelButtonTitle'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.defaultValue = map['defaultValue'];
instance.handledByClient = map['handledByClient'];
instance.message = map['message'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"defaultValue": defaultValue,
"confirmButtonTitle": confirmButtonTitle,
"cancelButtonTitle": cancelButtonTitle,
"handledByClient": handledByClient,
"value": value,
"action": action?.toNativeValue(),
"cancelButtonTitle": cancelButtonTitle,
"confirmButtonTitle": confirmButtonTitle,
"defaultValue": defaultValue,
"handledByClient": handledByClient,
"message": message,
"value": value,
};
}
@ -74,6 +74,6 @@ class JsPromptResponse {
@override
String toString() {
return 'JsPromptResponse{message: $message, defaultValue: $defaultValue, confirmButtonTitle: $confirmButtonTitle, cancelButtonTitle: $cancelButtonTitle, handledByClient: $handledByClient, value: $value, action: $action}';
return 'JsPromptResponse{action: $action, cancelButtonTitle: $cancelButtonTitle, confirmButtonTitle: $confirmButtonTitle, defaultValue: $defaultValue, handledByClient: $handledByClient, message: $message, value: $value}';
}
}

View File

@ -16,16 +16,16 @@ class JsPromptResponseAction {
int value, Function nativeValue) =>
JsPromptResponseAction._internal(value, nativeValue());
///Confirm that the user hit confirm button.
static const CONFIRM = JsPromptResponseAction._internal(0, 0);
///Confirm that the user hit cancel button.
static const CANCEL = JsPromptResponseAction._internal(1, 1);
///Confirm that the user hit confirm button.
static const CONFIRM = JsPromptResponseAction._internal(0, 0);
///Set of all values of [JsPromptResponseAction].
static final Set<JsPromptResponseAction> values = [
JsPromptResponseAction.CONFIRM,
JsPromptResponseAction.CANCEL,
JsPromptResponseAction.CONFIRM,
].toSet();
///Gets a possible [JsPromptResponseAction] instance from [int] value.
@ -69,10 +69,10 @@ class JsPromptResponseAction {
@override
String toString() {
switch (_value) {
case 0:
return 'CONFIRM';
case 1:
return 'CANCEL';
case 0:
return 'CONFIRM';
}
return _value.toString();
}

View File

@ -1,7 +1,6 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/in_app_webview_settings.dart';
import '../in_app_webview/android/in_app_webview_options.dart';
part 'layout_algorithm.g.dart';
@ -40,7 +39,7 @@ class AndroidLayoutAlgorithm_ {
static const 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.
///It is recommended to enable zoom support [InAppWebViewOptions.supportZoom] when using this mode.
///
///**NOTE**: available on Android 19+.
static const TEXT_AUTOSIZING =

View File

@ -16,6 +16,10 @@ class LayoutAlgorithm {
String value, Function nativeValue) =>
LayoutAlgorithm._internal(value, nativeValue());
///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 =
LayoutAlgorithm._internal('NARROW_COLUMNS', 'NARROW_COLUMNS');
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
static const NORMAL = LayoutAlgorithm._internal('NORMAL', 'NORMAL');
@ -26,15 +30,11 @@ class LayoutAlgorithm {
static const TEXT_AUTOSIZING =
LayoutAlgorithm._internal('TEXT_AUTOSIZING', '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 =
LayoutAlgorithm._internal('NARROW_COLUMNS', 'NARROW_COLUMNS');
///Set of all values of [LayoutAlgorithm].
static final Set<LayoutAlgorithm> values = [
LayoutAlgorithm.NARROW_COLUMNS,
LayoutAlgorithm.NORMAL,
LayoutAlgorithm.TEXT_AUTOSIZING,
LayoutAlgorithm.NARROW_COLUMNS,
].toSet();
///Gets a possible [LayoutAlgorithm] instance from [String] value.
@ -93,25 +93,25 @@ class AndroidLayoutAlgorithm {
String value, Function nativeValue) =>
AndroidLayoutAlgorithm._internal(value, nativeValue());
///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 =
AndroidLayoutAlgorithm._internal('NARROW_COLUMNS', 'NARROW_COLUMNS');
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
static const NORMAL = AndroidLayoutAlgorithm._internal('NORMAL', '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.
///It is recommended to enable zoom support [InAppWebViewOptions.supportZoom] when using this mode.
///
///**NOTE**: available on Android 19+.
static const TEXT_AUTOSIZING =
AndroidLayoutAlgorithm._internal('TEXT_AUTOSIZING', '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 =
AndroidLayoutAlgorithm._internal('NARROW_COLUMNS', 'NARROW_COLUMNS');
///Set of all values of [AndroidLayoutAlgorithm].
static final Set<AndroidLayoutAlgorithm> values = [
AndroidLayoutAlgorithm.NARROW_COLUMNS,
AndroidLayoutAlgorithm.NORMAL,
AndroidLayoutAlgorithm.TEXT_AUTOSIZING,
AndroidLayoutAlgorithm.NARROW_COLUMNS,
].toSet();
///Gets a possible [AndroidLayoutAlgorithm] instance from [String] value.

View File

@ -16,32 +16,32 @@ class LayoutInDisplayCutoutMode {
int value, Function nativeValue) =>
LayoutInDisplayCutoutMode._internal(value, nativeValue());
///The window is always allowed to extend into the DisplayCutout areas on the all edges of the screen.
///
///**NOTE**: available on Android 30+.
static const ALWAYS = LayoutInDisplayCutoutMode._internal(3, 3);
///With this default setting, content renders into the cutout area when displayed in portrait mode, but content is letterboxed when displayed in landscape mode.
///
///**NOTE**: available on Android 28+.
static const DEFAULT = LayoutInDisplayCutoutMode._internal(0, 0);
///Content renders into the cutout area in both portrait and landscape modes.
///
///**NOTE**: available on Android 28+.
static const SHORT_EDGES = LayoutInDisplayCutoutMode._internal(1, 1);
///Content never renders into the cutout area.
///
///**NOTE**: available on Android 28+.
static const NEVER = LayoutInDisplayCutoutMode._internal(2, 2);
///The window is always allowed to extend into the DisplayCutout areas on the all edges of the screen.
///Content renders into the cutout area in both portrait and landscape modes.
///
///**NOTE**: available on Android 30+.
static const ALWAYS = LayoutInDisplayCutoutMode._internal(3, 3);
///**NOTE**: available on Android 28+.
static const SHORT_EDGES = LayoutInDisplayCutoutMode._internal(1, 1);
///Set of all values of [LayoutInDisplayCutoutMode].
static final Set<LayoutInDisplayCutoutMode> values = [
LayoutInDisplayCutoutMode.DEFAULT,
LayoutInDisplayCutoutMode.SHORT_EDGES,
LayoutInDisplayCutoutMode.NEVER,
LayoutInDisplayCutoutMode.ALWAYS,
LayoutInDisplayCutoutMode.DEFAULT,
LayoutInDisplayCutoutMode.NEVER,
LayoutInDisplayCutoutMode.SHORT_EDGES,
].toSet();
///Gets a possible [LayoutInDisplayCutoutMode] instance from [int] value.
@ -85,14 +85,14 @@ class LayoutInDisplayCutoutMode {
@override
String toString() {
switch (_value) {
case 0:
return 'DEFAULT';
case 1:
return 'SHORT_EDGES';
case 2:
return 'NEVER';
case 3:
return 'ALWAYS';
case 0:
return 'DEFAULT';
case 2:
return 'NEVER';
case 1:
return 'SHORT_EDGES';
}
return _value.toString();
}
@ -114,32 +114,32 @@ class AndroidLayoutInDisplayCutoutMode {
int value, Function nativeValue) =>
AndroidLayoutInDisplayCutoutMode._internal(value, nativeValue());
///The window is always allowed to extend into the DisplayCutout areas on the all edges of the screen.
///
///**NOTE**: available on Android 30+.
static const ALWAYS = AndroidLayoutInDisplayCutoutMode._internal(3, 3);
///With this default setting, content renders into the cutout area when displayed in portrait mode, but content is letterboxed when displayed in landscape mode.
///
///**NOTE**: available on Android 28+.
static const DEFAULT = AndroidLayoutInDisplayCutoutMode._internal(0, 0);
///Content renders into the cutout area in both portrait and landscape modes.
///
///**NOTE**: available on Android 28+.
static const SHORT_EDGES = AndroidLayoutInDisplayCutoutMode._internal(1, 1);
///Content never renders into the cutout area.
///
///**NOTE**: available on Android 28+.
static const NEVER = AndroidLayoutInDisplayCutoutMode._internal(2, 2);
///The window is always allowed to extend into the DisplayCutout areas on the all edges of the screen.
///Content renders into the cutout area in both portrait and landscape modes.
///
///**NOTE**: available on Android 30+.
static const ALWAYS = AndroidLayoutInDisplayCutoutMode._internal(3, 3);
///**NOTE**: available on Android 28+.
static const SHORT_EDGES = AndroidLayoutInDisplayCutoutMode._internal(1, 1);
///Set of all values of [AndroidLayoutInDisplayCutoutMode].
static final Set<AndroidLayoutInDisplayCutoutMode> values = [
AndroidLayoutInDisplayCutoutMode.DEFAULT,
AndroidLayoutInDisplayCutoutMode.SHORT_EDGES,
AndroidLayoutInDisplayCutoutMode.NEVER,
AndroidLayoutInDisplayCutoutMode.ALWAYS,
AndroidLayoutInDisplayCutoutMode.DEFAULT,
AndroidLayoutInDisplayCutoutMode.NEVER,
AndroidLayoutInDisplayCutoutMode.SHORT_EDGES,
].toSet();
///Gets a possible [AndroidLayoutInDisplayCutoutMode] instance from [int] value.
@ -183,14 +183,14 @@ class AndroidLayoutInDisplayCutoutMode {
@override
String toString() {
switch (_value) {
case 0:
return 'DEFAULT';
case 1:
return 'SHORT_EDGES';
case 2:
return 'NEVER';
case 3:
return 'ALWAYS';
case 0:
return 'DEFAULT';
case 2:
return 'NEVER';
case 1:
return 'SHORT_EDGES';
}
return _value.toString();
}

View File

@ -9,18 +9,18 @@ part of 'loaded_resource.dart';
///Class representing a resource response of the [WebView].
///It is used by the method [WebView.onLoadResource].
class LoadedResource {
///Returns the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) duration to fetch a resource.
double? duration;
///A string representing the type of resource.
String? initiatorType;
///Resource URL.
WebUri? url;
///Returns the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) for the time a resource fetch started.
double? startTime;
///Returns the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) duration to fetch a resource.
double? duration;
LoadedResource({this.initiatorType, this.url, this.startTime, this.duration});
///Resource URL.
WebUri? url;
LoadedResource({this.duration, this.initiatorType, this.startTime, this.url});
///Gets a possible [LoadedResource] instance from a [Map] value.
static LoadedResource? fromMap(Map<String, dynamic>? map) {
@ -28,10 +28,10 @@ class LoadedResource {
return null;
}
final instance = LoadedResource(
initiatorType: map['initiatorType'],
url: map['url'] != null ? WebUri(map['url']) : null,
startTime: map['startTime'],
duration: map['duration'],
initiatorType: map['initiatorType'],
startTime: map['startTime'],
url: map['url'] != null ? WebUri(map['url']) : null,
);
return instance;
}
@ -39,10 +39,10 @@ class LoadedResource {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"initiatorType": initiatorType,
"url": url?.toString(),
"startTime": startTime,
"duration": duration,
"initiatorType": initiatorType,
"startTime": startTime,
"url": url?.toString(),
};
}
@ -53,6 +53,6 @@ class LoadedResource {
@override
String toString() {
return 'LoadedResource{initiatorType: $initiatorType, url: $url, startTime: $startTime, duration: $duration}';
return 'LoadedResource{duration: $duration, initiatorType: $initiatorType, startTime: $startTime, url: $url}';
}
}

View File

@ -8,16 +8,16 @@ part of 'login_request.dart';
///Class used by [WebView.onReceivedLoginRequest] event.
class LoginRequest {
///The account realm used to look up accounts.
String realm;
///An optional account. If not `null`, the account should be checked against accounts on the device.
///If it is a valid account, it should be used to log in the user. This value may be `null`.
String? account;
///Authenticator specific arguments used to log in the user.
String args;
LoginRequest({required this.realm, this.account, required this.args});
///The account realm used to look up accounts.
String realm;
LoginRequest({this.account, required this.args, required this.realm});
///Gets a possible [LoginRequest] instance from a [Map] value.
static LoginRequest? fromMap(Map<String, dynamic>? map) {
@ -25,9 +25,9 @@ class LoginRequest {
return null;
}
final instance = LoginRequest(
realm: map['realm'],
account: map['account'],
args: map['args'],
realm: map['realm'],
);
return instance;
}
@ -35,9 +35,9 @@ class LoginRequest {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"realm": realm,
"account": account,
"args": args,
"realm": realm,
};
}
@ -48,6 +48,6 @@ class LoginRequest {
@override
String toString() {
return 'LoginRequest{realm: $realm, account: $account, args: $args}';
return 'LoginRequest{account: $account, args: $args, realm: $realm}';
}
}

View File

@ -16,20 +16,20 @@ class MediaCaptureState {
int value, Function nativeValue) =>
MediaCaptureState._internal(value, nativeValue());
///The media device is off.
static const NONE = MediaCaptureState._internal(0, 0);
///The media device is actively capturing audio or video.
static const ACTIVE = MediaCaptureState._internal(1, 1);
///The media device is muted, and not actively capturing audio or video.
static const MUTED = MediaCaptureState._internal(2, 2);
///The media device is off.
static const NONE = MediaCaptureState._internal(0, 0);
///Set of all values of [MediaCaptureState].
static final Set<MediaCaptureState> values = [
MediaCaptureState.NONE,
MediaCaptureState.ACTIVE,
MediaCaptureState.MUTED,
MediaCaptureState.NONE,
].toSet();
///Gets a possible [MediaCaptureState] instance from [int] value.
@ -73,12 +73,12 @@ class MediaCaptureState {
@override
String toString() {
switch (_value) {
case 0:
return 'NONE';
case 1:
return 'ACTIVE';
case 2:
return 'MUTED';
case 0:
return 'NONE';
}
return _value.toString();
}

View File

@ -19,20 +19,20 @@ class MediaPlaybackState {
///There is no media to play back.
static const NONE = MediaPlaybackState._internal(0, 0);
///The media is playing.
static const PLAYING = MediaPlaybackState._internal(1, 1);
///The media playback is paused.
static const PAUSED = MediaPlaybackState._internal(2, 2);
///The media is playing.
static const PLAYING = MediaPlaybackState._internal(1, 1);
///The media is not playing, and cannot be resumed until the user revokes the suspension.
static const SUSPENDED = MediaPlaybackState._internal(3, 3);
///Set of all values of [MediaPlaybackState].
static final Set<MediaPlaybackState> values = [
MediaPlaybackState.NONE,
MediaPlaybackState.PLAYING,
MediaPlaybackState.PAUSED,
MediaPlaybackState.PLAYING,
MediaPlaybackState.SUSPENDED,
].toSet();
@ -79,10 +79,10 @@ class MediaPlaybackState {
switch (_value) {
case 0:
return 'NONE';
case 1:
return 'PLAYING';
case 2:
return 'PAUSED';
case 1:
return 'PLAYING';
case 3:
return 'SUSPENDED';
}

View File

@ -8,15 +8,15 @@ part of 'meta_tag.dart';
///Class that represents a `<meta>` HTML tag. It is used by the [InAppWebViewController.getMetaTags] method.
class MetaTag {
///The meta tag name value.
String? name;
///The meta tag attributes list.
List<MetaTagAttribute>? attrs;
///The meta tag content value.
String? content;
///The meta tag attributes list.
List<MetaTagAttribute>? attrs;
MetaTag({this.name, this.content, this.attrs});
///The meta tag name value.
String? name;
MetaTag({this.attrs, this.content, this.name});
///Gets a possible [MetaTag] instance from a [Map] value.
static MetaTag? fromMap(Map<String, dynamic>? map) {
@ -24,12 +24,12 @@ class MetaTag {
return null;
}
final instance = MetaTag(
name: map['name'],
content: map['content'],
attrs: map['attrs'] != null
? List<MetaTagAttribute>.from(map['attrs'].map(
(e) => MetaTagAttribute.fromMap(e?.cast<String, dynamic>())!))
: null,
content: map['content'],
name: map['name'],
);
return instance;
}
@ -37,9 +37,9 @@ class MetaTag {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"name": name,
"content": content,
"attrs": attrs?.map((e) => e.toMap()).toList(),
"content": content,
"name": name,
};
}
@ -50,6 +50,6 @@ class MetaTag {
@override
String toString() {
return 'MetaTag{name: $name, content: $content, attrs: $attrs}';
return 'MetaTag{attrs: $attrs, content: $content, name: $name}';
}
}

View File

@ -20,10 +20,6 @@ class MixedContentMode {
///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 = MixedContentMode._internal(0, 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 = MixedContentMode._internal(1, 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.
@ -32,11 +28,15 @@ class MixedContentMode {
static const MIXED_CONTENT_COMPATIBILITY_MODE =
MixedContentMode._internal(2, 2);
///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 = MixedContentMode._internal(1, 1);
///Set of all values of [MixedContentMode].
static final Set<MixedContentMode> values = [
MixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW,
MixedContentMode.MIXED_CONTENT_NEVER_ALLOW,
MixedContentMode.MIXED_CONTENT_COMPATIBILITY_MODE,
MixedContentMode.MIXED_CONTENT_NEVER_ALLOW,
].toSet();
///Gets a possible [MixedContentMode] instance from [int] value.
@ -82,10 +82,10 @@ class MixedContentMode {
switch (_value) {
case 0:
return 'MIXED_CONTENT_ALWAYS_ALLOW';
case 1:
return 'MIXED_CONTENT_NEVER_ALLOW';
case 2:
return 'MIXED_CONTENT_COMPATIBILITY_MODE';
case 1:
return 'MIXED_CONTENT_NEVER_ALLOW';
}
return _value.toString();
}
@ -111,11 +111,6 @@ class AndroidMixedContentMode {
static const MIXED_CONTENT_ALWAYS_ALLOW =
AndroidMixedContentMode._internal(0, 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 =
AndroidMixedContentMode._internal(1, 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.
@ -124,11 +119,16 @@ class AndroidMixedContentMode {
static const MIXED_CONTENT_COMPATIBILITY_MODE =
AndroidMixedContentMode._internal(2, 2);
///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 =
AndroidMixedContentMode._internal(1, 1);
///Set of all values of [AndroidMixedContentMode].
static final Set<AndroidMixedContentMode> values = [
AndroidMixedContentMode.MIXED_CONTENT_ALWAYS_ALLOW,
AndroidMixedContentMode.MIXED_CONTENT_NEVER_ALLOW,
AndroidMixedContentMode.MIXED_CONTENT_COMPATIBILITY_MODE,
AndroidMixedContentMode.MIXED_CONTENT_NEVER_ALLOW,
].toSet();
///Gets a possible [AndroidMixedContentMode] instance from [int] value.
@ -174,10 +174,10 @@ class AndroidMixedContentMode {
switch (_value) {
case 0:
return 'MIXED_CONTENT_ALWAYS_ALLOW';
case 1:
return 'MIXED_CONTENT_NEVER_ALLOW';
case 2:
return 'MIXED_CONTENT_COMPATIBILITY_MODE';
case 1:
return 'MIXED_CONTENT_NEVER_ALLOW';
}
return _value.toString();
}

View File

@ -16,14 +16,10 @@ class ModalPresentationStyle {
int value, Function nativeValue) =>
ModalPresentationStyle._internal(value, nativeValue());
///A presentation style in which the presented view covers the screen.
static const FULL_SCREEN = ModalPresentationStyle._internal(0, 0);
///A presentation style that partially covers the underlying content.
static const PAGE_SHEET = ModalPresentationStyle._internal(1, 1);
///A presentation style that displays the content centered in the screen.
static const FORM_SHEET = ModalPresentationStyle._internal(2, 2);
///The default presentation style chosen by the system.
///
///**NOTE**: available on iOS 13.0+.
static const AUTOMATIC = ModalPresentationStyle._internal(9, 9);
///A presentation style where the content is displayed over another view controllers content.
static const CURRENT_CONTEXT = ModalPresentationStyle._internal(3, 3);
@ -31,35 +27,39 @@ class ModalPresentationStyle {
///A custom view presentation style that is managed by a custom presentation controller and one or more custom animator objects.
static const CUSTOM = ModalPresentationStyle._internal(4, 4);
///A view presentation style in which the presented view covers the screen.
static const OVER_FULL_SCREEN = ModalPresentationStyle._internal(5, 5);
///A presentation style that displays the content centered in the screen.
static const FORM_SHEET = ModalPresentationStyle._internal(2, 2);
///A presentation style where the content is displayed over another view controllers content.
static const OVER_CURRENT_CONTEXT = ModalPresentationStyle._internal(6, 6);
///A presentation style where the content is displayed in a popover view.
static const POPOVER = ModalPresentationStyle._internal(7, 7);
///A presentation style in which the presented view covers the screen.
static const FULL_SCREEN = ModalPresentationStyle._internal(0, 0);
///A presentation style that indicates no adaptations should be made.
static const NONE = ModalPresentationStyle._internal(8, 8);
///The default presentation style chosen by the system.
///
///**NOTE**: available on iOS 13.0+.
static const AUTOMATIC = ModalPresentationStyle._internal(9, 9);
///A presentation style where the content is displayed over another view controllers content.
static const OVER_CURRENT_CONTEXT = ModalPresentationStyle._internal(6, 6);
///A view presentation style in which the presented view covers the screen.
static const OVER_FULL_SCREEN = ModalPresentationStyle._internal(5, 5);
///A presentation style that partially covers the underlying content.
static const PAGE_SHEET = ModalPresentationStyle._internal(1, 1);
///A presentation style where the content is displayed in a popover view.
static const POPOVER = ModalPresentationStyle._internal(7, 7);
///Set of all values of [ModalPresentationStyle].
static final Set<ModalPresentationStyle> values = [
ModalPresentationStyle.FULL_SCREEN,
ModalPresentationStyle.PAGE_SHEET,
ModalPresentationStyle.FORM_SHEET,
ModalPresentationStyle.AUTOMATIC,
ModalPresentationStyle.CURRENT_CONTEXT,
ModalPresentationStyle.CUSTOM,
ModalPresentationStyle.OVER_FULL_SCREEN,
ModalPresentationStyle.OVER_CURRENT_CONTEXT,
ModalPresentationStyle.POPOVER,
ModalPresentationStyle.FORM_SHEET,
ModalPresentationStyle.FULL_SCREEN,
ModalPresentationStyle.NONE,
ModalPresentationStyle.AUTOMATIC,
ModalPresentationStyle.OVER_CURRENT_CONTEXT,
ModalPresentationStyle.OVER_FULL_SCREEN,
ModalPresentationStyle.PAGE_SHEET,
ModalPresentationStyle.POPOVER,
].toSet();
///Gets a possible [ModalPresentationStyle] instance from [int] value.
@ -103,26 +103,26 @@ class ModalPresentationStyle {
@override
String toString() {
switch (_value) {
case 0:
return 'FULL_SCREEN';
case 1:
return 'PAGE_SHEET';
case 2:
return 'FORM_SHEET';
case 9:
return 'AUTOMATIC';
case 3:
return 'CURRENT_CONTEXT';
case 4:
return 'CUSTOM';
case 5:
return 'OVER_FULL_SCREEN';
case 6:
return 'OVER_CURRENT_CONTEXT';
case 7:
return 'POPOVER';
case 2:
return 'FORM_SHEET';
case 0:
return 'FULL_SCREEN';
case 8:
return 'NONE';
case 9:
return 'AUTOMATIC';
case 6:
return 'OVER_CURRENT_CONTEXT';
case 5:
return 'OVER_FULL_SCREEN';
case 1:
return 'PAGE_SHEET';
case 7:
return 'POPOVER';
}
return _value.toString();
}
@ -140,14 +140,10 @@ class IOSUIModalPresentationStyle {
int value, Function nativeValue) =>
IOSUIModalPresentationStyle._internal(value, nativeValue());
///A presentation style in which the presented view covers the screen.
static const FULL_SCREEN = IOSUIModalPresentationStyle._internal(0, 0);
///A presentation style that partially covers the underlying content.
static const PAGE_SHEET = IOSUIModalPresentationStyle._internal(1, 1);
///A presentation style that displays the content centered in the screen.
static const FORM_SHEET = IOSUIModalPresentationStyle._internal(2, 2);
///The default presentation style chosen by the system.
///
///**NOTE**: available on iOS 13.0+.
static const AUTOMATIC = IOSUIModalPresentationStyle._internal(9, 9);
///A presentation style where the content is displayed over another view controllers content.
static const CURRENT_CONTEXT = IOSUIModalPresentationStyle._internal(3, 3);
@ -155,36 +151,40 @@ class IOSUIModalPresentationStyle {
///A custom view presentation style that is managed by a custom presentation controller and one or more custom animator objects.
static const CUSTOM = IOSUIModalPresentationStyle._internal(4, 4);
///A view presentation style in which the presented view covers the screen.
static const OVER_FULL_SCREEN = IOSUIModalPresentationStyle._internal(5, 5);
///A presentation style that displays the content centered in the screen.
static const FORM_SHEET = IOSUIModalPresentationStyle._internal(2, 2);
///A presentation style in which the presented view covers the screen.
static const FULL_SCREEN = IOSUIModalPresentationStyle._internal(0, 0);
///A presentation style that indicates no adaptations should be made.
static const NONE = IOSUIModalPresentationStyle._internal(8, 8);
///A presentation style where the content is displayed over another view controllers content.
static const OVER_CURRENT_CONTEXT =
IOSUIModalPresentationStyle._internal(6, 6);
///A view presentation style in which the presented view covers the screen.
static const OVER_FULL_SCREEN = IOSUIModalPresentationStyle._internal(5, 5);
///A presentation style that partially covers the underlying content.
static const PAGE_SHEET = IOSUIModalPresentationStyle._internal(1, 1);
///A presentation style where the content is displayed in a popover view.
static const POPOVER = IOSUIModalPresentationStyle._internal(7, 7);
///A presentation style that indicates no adaptations should be made.
static const NONE = IOSUIModalPresentationStyle._internal(8, 8);
///The default presentation style chosen by the system.
///
///**NOTE**: available on iOS 13.0+.
static const AUTOMATIC = IOSUIModalPresentationStyle._internal(9, 9);
///Set of all values of [IOSUIModalPresentationStyle].
static final Set<IOSUIModalPresentationStyle> values = [
IOSUIModalPresentationStyle.FULL_SCREEN,
IOSUIModalPresentationStyle.PAGE_SHEET,
IOSUIModalPresentationStyle.FORM_SHEET,
IOSUIModalPresentationStyle.AUTOMATIC,
IOSUIModalPresentationStyle.CURRENT_CONTEXT,
IOSUIModalPresentationStyle.CUSTOM,
IOSUIModalPresentationStyle.OVER_FULL_SCREEN,
IOSUIModalPresentationStyle.OVER_CURRENT_CONTEXT,
IOSUIModalPresentationStyle.POPOVER,
IOSUIModalPresentationStyle.FORM_SHEET,
IOSUIModalPresentationStyle.FULL_SCREEN,
IOSUIModalPresentationStyle.NONE,
IOSUIModalPresentationStyle.AUTOMATIC,
IOSUIModalPresentationStyle.OVER_CURRENT_CONTEXT,
IOSUIModalPresentationStyle.OVER_FULL_SCREEN,
IOSUIModalPresentationStyle.PAGE_SHEET,
IOSUIModalPresentationStyle.POPOVER,
].toSet();
///Gets a possible [IOSUIModalPresentationStyle] instance from [int] value.
@ -228,26 +228,26 @@ class IOSUIModalPresentationStyle {
@override
String toString() {
switch (_value) {
case 0:
return 'FULL_SCREEN';
case 1:
return 'PAGE_SHEET';
case 2:
return 'FORM_SHEET';
case 9:
return 'AUTOMATIC';
case 3:
return 'CURRENT_CONTEXT';
case 4:
return 'CUSTOM';
case 5:
return 'OVER_FULL_SCREEN';
case 6:
return 'OVER_CURRENT_CONTEXT';
case 7:
return 'POPOVER';
case 2:
return 'FORM_SHEET';
case 0:
return 'FULL_SCREEN';
case 8:
return 'NONE';
case 9:
return 'AUTOMATIC';
case 6:
return 'OVER_CURRENT_CONTEXT';
case 5:
return 'OVER_FULL_SCREEN';
case 1:
return 'PAGE_SHEET';
case 7:
return 'POPOVER';
}
return _value.toString();
}

View File

@ -20,15 +20,15 @@ class ModalTransitionStyle {
///On dismissal, the view slides back down. This is the default transition style.
static const COVER_VERTICAL = ModalTransitionStyle._internal(0, 0);
///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 = ModalTransitionStyle._internal(2, 2);
///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 = ModalTransitionStyle._internal(1, 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 = ModalTransitionStyle._internal(2, 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.
@ -37,8 +37,8 @@ class ModalTransitionStyle {
///Set of all values of [ModalTransitionStyle].
static final Set<ModalTransitionStyle> values = [
ModalTransitionStyle.COVER_VERTICAL,
ModalTransitionStyle.FLIP_HORIZONTAL,
ModalTransitionStyle.CROSS_DISSOLVE,
ModalTransitionStyle.FLIP_HORIZONTAL,
ModalTransitionStyle.PARTIAL_CURL,
].toSet();
@ -85,10 +85,10 @@ class ModalTransitionStyle {
switch (_value) {
case 0:
return 'COVER_VERTICAL';
case 1:
return 'FLIP_HORIZONTAL';
case 2:
return 'CROSS_DISSOLVE';
case 1:
return 'FLIP_HORIZONTAL';
case 3:
return 'PARTIAL_CURL';
}
@ -112,15 +112,15 @@ class IOSUIModalTransitionStyle {
///On dismissal, the view slides back down. This is the default transition style.
static const COVER_VERTICAL = IOSUIModalTransitionStyle._internal(0, 0);
///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 = IOSUIModalTransitionStyle._internal(2, 2);
///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 = IOSUIModalTransitionStyle._internal(1, 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 = IOSUIModalTransitionStyle._internal(2, 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.
@ -129,8 +129,8 @@ class IOSUIModalTransitionStyle {
///Set of all values of [IOSUIModalTransitionStyle].
static final Set<IOSUIModalTransitionStyle> values = [
IOSUIModalTransitionStyle.COVER_VERTICAL,
IOSUIModalTransitionStyle.FLIP_HORIZONTAL,
IOSUIModalTransitionStyle.CROSS_DISSOLVE,
IOSUIModalTransitionStyle.FLIP_HORIZONTAL,
IOSUIModalTransitionStyle.PARTIAL_CURL,
].toSet();
@ -177,10 +177,10 @@ class IOSUIModalTransitionStyle {
switch (_value) {
case 0:
return 'COVER_VERTICAL';
case 1:
return 'FLIP_HORIZONTAL';
case 2:
return 'CROSS_DISSOLVE';
case 1:
return 'FLIP_HORIZONTAL';
case 3:
return 'PARTIAL_CURL';
}

View File

@ -8,24 +8,14 @@ part of 'navigation_action.dart';
///An object that contains information about an action that causes navigation to occur.
class NavigationAction {
///The URL request object associated with the navigation action.
///
///**NOTE for Android**: If the request is associated to the [WebView.onCreateWindow] event
///and the window has been created using JavaScript, [request.url] will be `null`,
///the [request.method] is always `GET`, and [request.headers] value is always `null`.
///Also, on Android < 21, the [request.method] is always `GET` and [request.headers] value is always `null`.
URLRequest request;
///Indicates whether the request was made for the main frame.
///
///**NOTE for Android**: If the request is associated to the [WebView.onCreateWindow] event, this is always `true`.
///Also, on Android < 21, this is always `true`.
bool isForMainFrame;
///Use [hasGesture] instead.
@Deprecated('Use hasGesture instead')
bool? androidHasGesture;
///Use [isRedirect] instead.
@Deprecated('Use isRedirect instead')
bool? androidIsRedirect;
///Gets whether a gesture (such as a click) was associated with the request.
///For security reasons in certain situations this method may return `false` even though
///the sequence of events which caused the request to be created was initiated by a user
@ -37,9 +27,23 @@ class NavigationAction {
///- Android native WebView 21+ ([Official API - WebResourceRequest.hasGesture](https://developer.android.com/reference/android/webkit/WebResourceRequest#hasGesture()))
bool? hasGesture;
///Use [isRedirect] instead.
@Deprecated('Use isRedirect instead')
bool? androidIsRedirect;
///Use [sourceFrame] instead.
@Deprecated('Use sourceFrame instead')
IOSWKFrameInfo? iosSourceFrame;
///Use [targetFrame] instead.
@Deprecated('Use targetFrame instead')
IOSWKFrameInfo? iosTargetFrame;
///Use [navigationType] instead.
@Deprecated('Use navigationType instead')
IOSWKNavigationType? iosWKNavigationType;
///Indicates whether the request was made for the main frame.
///
///**NOTE for Android**: If the request is associated to the [WebView.onCreateWindow] event, this is always `true`.
///Also, on Android < 21, this is always `true`.
bool isForMainFrame;
///Gets whether the request was a result of a server-side redirect.
///
@ -50,10 +54,6 @@ class NavigationAction {
///- Android native WebView 21+ ([Official API - WebResourceRequest.isRedirect](https://developer.android.com/reference/android/webkit/WebResourceRequest#isRedirect()))
bool? isRedirect;
///Use [navigationType] instead.
@Deprecated('Use navigationType instead')
IOSWKNavigationType? iosWKNavigationType;
///The type of action triggering the navigation.ì
///
///**Supported Platforms/Implementations**:
@ -61,9 +61,20 @@ class NavigationAction {
///- MacOS ([Official API - WKNavigationAction.navigationType](https://developer.apple.com/documentation/webkit/wknavigationaction/1401914-navigationtype))
NavigationType? navigationType;
///Use [sourceFrame] instead.
@Deprecated('Use sourceFrame instead')
IOSWKFrameInfo? iosSourceFrame;
///The URL request object associated with the navigation action.
///
///**NOTE for Android**: If the request is associated to the [WebView.onCreateWindow] event
///and the window has been created using JavaScript, [request.url] will be `null`,
///the [request.method] is always `GET`, and [request.headers] value is always `null`.
///Also, on Android < 21, the [request.method] is always `GET` and [request.headers] value is always `null`.
URLRequest request;
///A value indicating whether the web content used a download attribute to indicate that this should be downloaded.
///
///**Supported Platforms/Implementations**:
///- iOS 14.5+ ([Official API - WKNavigationAction.shouldPerformDownload](https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload))
///- MacOS 11.3+ ([Official API - WKNavigationAction.shouldPerformDownload](https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload))
bool? shouldPerformDownload;
///The frame that requested the navigation.
///
@ -72,43 +83,32 @@ class NavigationAction {
///- MacOS ([Official API - WKNavigationAction.sourceFrame](https://developer.apple.com/documentation/webkit/wknavigationaction/1401926-sourceframe))
FrameInfo? sourceFrame;
///Use [targetFrame] instead.
@Deprecated('Use targetFrame instead')
IOSWKFrameInfo? iosTargetFrame;
///The frame in which to display the new content.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationAction.targetFrame](https://developer.apple.com/documentation/webkit/wknavigationaction/1401918-targetframe))
///- MacOS ([Official API - WKNavigationAction.targetFrame](https://developer.apple.com/documentation/webkit/wknavigationaction/1401918-targetframe))
FrameInfo? targetFrame;
///A value indicating whether the web content used a download attribute to indicate that this should be downloaded.
///
///**Supported Platforms/Implementations**:
///- iOS 14.5+ ([Official API - WKNavigationAction.shouldPerformDownload](https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload))
///- MacOS 11.3+ ([Official API - WKNavigationAction.shouldPerformDownload](https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload))
bool? shouldPerformDownload;
NavigationAction(
{required this.request,
required this.isForMainFrame,
@Deprecated('Use hasGesture instead') this.androidHasGesture,
this.hasGesture,
{@Deprecated('Use hasGesture instead') this.androidHasGesture,
@Deprecated('Use isRedirect instead') this.androidIsRedirect,
this.isRedirect,
@Deprecated('Use navigationType instead') this.iosWKNavigationType,
this.navigationType,
this.hasGesture,
@Deprecated('Use sourceFrame instead') this.iosSourceFrame,
this.sourceFrame,
@Deprecated('Use targetFrame instead') this.iosTargetFrame,
this.targetFrame,
this.shouldPerformDownload}) {
@Deprecated('Use navigationType instead') this.iosWKNavigationType,
required this.isForMainFrame,
this.isRedirect,
this.navigationType,
required this.request,
this.shouldPerformDownload,
this.sourceFrame,
this.targetFrame}) {
hasGesture = hasGesture ?? androidHasGesture;
isRedirect = isRedirect ?? androidIsRedirect;
navigationType = navigationType ??
NavigationType.fromNativeValue(iosWKNavigationType?.toNativeValue());
sourceFrame = sourceFrame ?? FrameInfo.fromMap(iosSourceFrame?.toMap());
targetFrame = targetFrame ?? FrameInfo.fromMap(iosTargetFrame?.toMap());
navigationType = navigationType ??
NavigationType.fromNativeValue(iosWKNavigationType?.toNativeValue());
}
///Gets a possible [NavigationAction] instance from a [Map] value.
@ -117,24 +117,24 @@ class NavigationAction {
return null;
}
final instance = NavigationAction(
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>())!,
isForMainFrame: map['isForMainFrame'],
androidHasGesture: map['hasGesture'],
hasGesture: map['hasGesture'],
androidIsRedirect: map['isRedirect'],
isRedirect: map['isRedirect'],
iosWKNavigationType:
IOSWKNavigationType.fromNativeValue(map['navigationType']),
navigationType: NavigationType.fromNativeValue(map['navigationType']),
hasGesture: map['hasGesture'],
iosSourceFrame:
IOSWKFrameInfo.fromMap(map['sourceFrame']?.cast<String, dynamic>()),
sourceFrame:
FrameInfo.fromMap(map['sourceFrame']?.cast<String, dynamic>()),
iosTargetFrame:
IOSWKFrameInfo.fromMap(map['targetFrame']?.cast<String, dynamic>()),
iosWKNavigationType:
IOSWKNavigationType.fromNativeValue(map['navigationType']),
isForMainFrame: map['isForMainFrame'],
isRedirect: map['isRedirect'],
navigationType: NavigationType.fromNativeValue(map['navigationType']),
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>())!,
shouldPerformDownload: map['shouldPerformDownload'],
sourceFrame:
FrameInfo.fromMap(map['sourceFrame']?.cast<String, dynamic>()),
targetFrame:
FrameInfo.fromMap(map['targetFrame']?.cast<String, dynamic>()),
shouldPerformDownload: map['shouldPerformDownload'],
);
return instance;
}
@ -142,14 +142,14 @@ class NavigationAction {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"request": request.toMap(),
"isForMainFrame": isForMainFrame,
"hasGesture": hasGesture,
"isForMainFrame": isForMainFrame,
"isRedirect": isRedirect,
"navigationType": navigationType?.toNativeValue(),
"request": request.toMap(),
"shouldPerformDownload": shouldPerformDownload,
"sourceFrame": sourceFrame?.toMap(),
"targetFrame": targetFrame?.toMap(),
"shouldPerformDownload": shouldPerformDownload,
};
}
@ -160,6 +160,6 @@ class NavigationAction {
@override
String toString() {
return 'NavigationAction{request: $request, isForMainFrame: $isForMainFrame, hasGesture: $hasGesture, isRedirect: $isRedirect, navigationType: $navigationType, sourceFrame: $sourceFrame, targetFrame: $targetFrame, shouldPerformDownload: $shouldPerformDownload}';
return 'NavigationAction{hasGesture: $hasGesture, isForMainFrame: $isForMainFrame, isRedirect: $isRedirect, navigationType: $navigationType, request: $request, shouldPerformDownload: $shouldPerformDownload, sourceFrame: $sourceFrame, targetFrame: $targetFrame}';
}
}

View File

@ -17,12 +17,12 @@ class NavigationActionPolicy {
int value, Function nativeValue) =>
NavigationActionPolicy._internal(value, nativeValue());
///Cancel the navigation.
static const CANCEL = NavigationActionPolicy._internal(0, 0);
///Allow the navigation to continue.
static const ALLOW = NavigationActionPolicy._internal(1, 1);
///Cancel the navigation.
static const CANCEL = NavigationActionPolicy._internal(0, 0);
///Turn the navigation into a download.
///
///**NOTE**: available only on iOS 14.5+. It will fallback to [CANCEL].
@ -30,8 +30,8 @@ class NavigationActionPolicy {
///Set of all values of [NavigationActionPolicy].
static final Set<NavigationActionPolicy> values = [
NavigationActionPolicy.CANCEL,
NavigationActionPolicy.ALLOW,
NavigationActionPolicy.CANCEL,
NavigationActionPolicy.DOWNLOAD,
].toSet();
@ -76,10 +76,10 @@ class NavigationActionPolicy {
@override
String toString() {
switch (_value) {
case 0:
return 'CANCEL';
case 1:
return 'ALLOW';
case 0:
return 'CANCEL';
case 2:
return 'DOWNLOAD';
}

View File

@ -8,18 +8,18 @@ part of 'navigation_response.dart';
///Class that represents the navigation response used by the [WebView.onNavigationResponse] event.
class NavigationResponse {
///The URL for the response.
URLResponse? response;
///A Boolean value that indicates whether WebKit is capable of displaying the responses MIME type natively.
bool canShowMIMEType;
///A Boolean value that indicates whether the response targets the web views main frame.
bool isForMainFrame;
///A Boolean value that indicates whether WebKit is capable of displaying the responses MIME type natively.
bool canShowMIMEType;
///The URL for the response.
URLResponse? response;
NavigationResponse(
{this.response,
{required this.canShowMIMEType,
required this.isForMainFrame,
required this.canShowMIMEType});
this.response});
///Gets a possible [NavigationResponse] instance from a [Map] value.
static NavigationResponse? fromMap(Map<String, dynamic>? map) {
@ -27,9 +27,9 @@ class NavigationResponse {
return null;
}
final instance = NavigationResponse(
response: URLResponse.fromMap(map['response']?.cast<String, dynamic>()),
isForMainFrame: map['isForMainFrame'],
canShowMIMEType: map['canShowMIMEType'],
isForMainFrame: map['isForMainFrame'],
response: URLResponse.fromMap(map['response']?.cast<String, dynamic>()),
);
return instance;
}
@ -37,9 +37,9 @@ class NavigationResponse {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"response": response?.toMap(),
"isForMainFrame": isForMainFrame,
"canShowMIMEType": canShowMIMEType,
"isForMainFrame": isForMainFrame,
"response": response?.toMap(),
};
}
@ -50,7 +50,7 @@ class NavigationResponse {
@override
String toString() {
return 'NavigationResponse{response: $response, isForMainFrame: $isForMainFrame, canShowMIMEType: $canShowMIMEType}';
return 'NavigationResponse{canShowMIMEType: $canShowMIMEType, isForMainFrame: $isForMainFrame, response: $response}';
}
}
@ -58,18 +58,18 @@ class NavigationResponse {
///Use [NavigationResponse] instead.
@Deprecated('Use NavigationResponse instead')
class IOSWKNavigationResponse {
///The URL for the response.
IOSURLResponse? response;
///A Boolean value that indicates whether WebKit is capable of displaying the responses MIME type natively.
bool canShowMIMEType;
///A Boolean value that indicates whether the response targets the web views main frame.
bool isForMainFrame;
///A Boolean value that indicates whether WebKit is capable of displaying the responses MIME type natively.
bool canShowMIMEType;
///The URL for the response.
IOSURLResponse? response;
IOSWKNavigationResponse(
{this.response,
{required this.canShowMIMEType,
required this.isForMainFrame,
required this.canShowMIMEType});
this.response});
///Gets a possible [IOSWKNavigationResponse] instance from a [Map] value.
static IOSWKNavigationResponse? fromMap(Map<String, dynamic>? map) {
@ -77,10 +77,10 @@ class IOSWKNavigationResponse {
return null;
}
final instance = IOSWKNavigationResponse(
canShowMIMEType: map['canShowMIMEType'],
isForMainFrame: map['isForMainFrame'],
response:
IOSURLResponse.fromMap(map['response']?.cast<String, dynamic>()),
isForMainFrame: map['isForMainFrame'],
canShowMIMEType: map['canShowMIMEType'],
);
return instance;
}
@ -88,9 +88,9 @@ class IOSWKNavigationResponse {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"response": response?.toMap(),
"isForMainFrame": isForMainFrame,
"canShowMIMEType": canShowMIMEType,
"isForMainFrame": isForMainFrame,
"response": response?.toMap(),
};
}
@ -101,6 +101,6 @@ class IOSWKNavigationResponse {
@override
String toString() {
return 'IOSWKNavigationResponse{response: $response, isForMainFrame: $isForMainFrame, canShowMIMEType: $canShowMIMEType}';
return 'IOSWKNavigationResponse{canShowMIMEType: $canShowMIMEType, isForMainFrame: $isForMainFrame, response: $response}';
}
}

View File

@ -17,12 +17,12 @@ class NavigationResponseAction {
int value, Function nativeValue) =>
NavigationResponseAction._internal(value, nativeValue());
///Cancel the navigation.
static const CANCEL = NavigationResponseAction._internal(0, 0);
///Allow the navigation to continue.
static const ALLOW = NavigationResponseAction._internal(1, 1);
///Cancel the navigation.
static const CANCEL = NavigationResponseAction._internal(0, 0);
///Turn the navigation into a download.
///
///**NOTE**: available only on iOS 14.5+. It will fallback to [CANCEL].
@ -30,8 +30,8 @@ class NavigationResponseAction {
///Set of all values of [NavigationResponseAction].
static final Set<NavigationResponseAction> values = [
NavigationResponseAction.CANCEL,
NavigationResponseAction.ALLOW,
NavigationResponseAction.CANCEL,
NavigationResponseAction.DOWNLOAD,
].toSet();
@ -76,10 +76,10 @@ class NavigationResponseAction {
@override
String toString() {
switch (_value) {
case 0:
return 'CANCEL';
case 1:
return 'ALLOW';
case 0:
return 'CANCEL';
case 2:
return 'DOWNLOAD';
}
@ -100,16 +100,16 @@ class IOSNavigationResponseAction {
int value, Function nativeValue) =>
IOSNavigationResponseAction._internal(value, nativeValue());
///Cancel the navigation.
static const CANCEL = IOSNavigationResponseAction._internal(0, 0);
///Allow the navigation to continue.
static const ALLOW = IOSNavigationResponseAction._internal(1, 1);
///Cancel the navigation.
static const CANCEL = IOSNavigationResponseAction._internal(0, 0);
///Set of all values of [IOSNavigationResponseAction].
static final Set<IOSNavigationResponseAction> values = [
IOSNavigationResponseAction.CANCEL,
IOSNavigationResponseAction.ALLOW,
IOSNavigationResponseAction.CANCEL,
].toSet();
///Gets a possible [IOSNavigationResponseAction] instance from [int] value.
@ -153,10 +153,10 @@ class IOSNavigationResponseAction {
@override
String toString() {
switch (_value) {
case 0:
return 'CANCEL';
case 1:
return 'ALLOW';
case 0:
return 'CANCEL';
}
return _value.toString();
}

View File

@ -16,32 +16,32 @@ class NavigationType {
int value, Function nativeValue) =>
NavigationType._internal(value, nativeValue());
///A link with an href attribute was activated by the user.
static const LINK_ACTIVATED = NavigationType._internal(0, 0);
///A form was submitted.
static const FORM_SUBMITTED = NavigationType._internal(1, 1);
///An item from the back-forward list was requested.
static const BACK_FORWARD = NavigationType._internal(2, 2);
///The webpage was reloaded.
static const RELOAD = NavigationType._internal(3, 3);
///A form was resubmitted (for example by going back, going forward, or reloading).
static const FORM_RESUBMITTED = NavigationType._internal(4, 4);
///A form was submitted.
static const FORM_SUBMITTED = NavigationType._internal(1, 1);
///A link with an href attribute was activated by the user.
static const LINK_ACTIVATED = NavigationType._internal(0, 0);
///Navigation is taking place for some other reason.
static const OTHER = NavigationType._internal(-1, -1);
///The webpage was reloaded.
static const RELOAD = NavigationType._internal(3, 3);
///Set of all values of [NavigationType].
static final Set<NavigationType> values = [
NavigationType.LINK_ACTIVATED,
NavigationType.FORM_SUBMITTED,
NavigationType.BACK_FORWARD,
NavigationType.RELOAD,
NavigationType.FORM_RESUBMITTED,
NavigationType.FORM_SUBMITTED,
NavigationType.LINK_ACTIVATED,
NavigationType.OTHER,
NavigationType.RELOAD,
].toSet();
///Gets a possible [NavigationType] instance from [int] value.
@ -85,18 +85,18 @@ class NavigationType {
@override
String toString() {
switch (_value) {
case 0:
return 'LINK_ACTIVATED';
case 1:
return 'FORM_SUBMITTED';
case 2:
return 'BACK_FORWARD';
case 3:
return 'RELOAD';
case 4:
return 'FORM_RESUBMITTED';
case 1:
return 'FORM_SUBMITTED';
case 0:
return 'LINK_ACTIVATED';
case -1:
return 'OTHER';
case 3:
return 'RELOAD';
}
return _value.toString();
}
@ -114,32 +114,32 @@ class IOSWKNavigationType {
int value, Function nativeValue) =>
IOSWKNavigationType._internal(value, nativeValue());
///A link with an href attribute was activated by the user.
static const LINK_ACTIVATED = IOSWKNavigationType._internal(0, 0);
///A form was submitted.
static const FORM_SUBMITTED = IOSWKNavigationType._internal(1, 1);
///An item from the back-forward list was requested.
static const BACK_FORWARD = IOSWKNavigationType._internal(2, 2);
///The webpage was reloaded.
static const RELOAD = IOSWKNavigationType._internal(3, 3);
///A form was resubmitted (for example by going back, going forward, or reloading).
static const FORM_RESUBMITTED = IOSWKNavigationType._internal(4, 4);
///A form was submitted.
static const FORM_SUBMITTED = IOSWKNavigationType._internal(1, 1);
///A link with an href attribute was activated by the user.
static const LINK_ACTIVATED = IOSWKNavigationType._internal(0, 0);
///Navigation is taking place for some other reason.
static const OTHER = IOSWKNavigationType._internal(-1, -1);
///The webpage was reloaded.
static const RELOAD = IOSWKNavigationType._internal(3, 3);
///Set of all values of [IOSWKNavigationType].
static final Set<IOSWKNavigationType> values = [
IOSWKNavigationType.LINK_ACTIVATED,
IOSWKNavigationType.FORM_SUBMITTED,
IOSWKNavigationType.BACK_FORWARD,
IOSWKNavigationType.RELOAD,
IOSWKNavigationType.FORM_RESUBMITTED,
IOSWKNavigationType.FORM_SUBMITTED,
IOSWKNavigationType.LINK_ACTIVATED,
IOSWKNavigationType.OTHER,
IOSWKNavigationType.RELOAD,
].toSet();
///Gets a possible [IOSWKNavigationType] instance from [int] value.
@ -183,18 +183,18 @@ class IOSWKNavigationType {
@override
String toString() {
switch (_value) {
case 0:
return 'LINK_ACTIVATED';
case 1:
return 'FORM_SUBMITTED';
case 2:
return 'BACK_FORWARD';
case 3:
return 'RELOAD';
case 4:
return 'FORM_RESUBMITTED';
case 1:
return 'FORM_SUBMITTED';
case 0:
return 'LINK_ACTIVATED';
case -1:
return 'OTHER';
case 3:
return 'RELOAD';
}
return _value.toString();
}

View File

@ -8,6 +8,9 @@ part of 'permission_request.dart';
///Class that represents the response used by the [WebView.onPermissionRequest] event.
class PermissionRequest {
///The frame that initiates the request in the web view.
FrameInfo? frame;
///The origin of web content which attempt to access the restricted resources.
WebUri origin;
@ -16,11 +19,8 @@ class PermissionRequest {
///**NOTE for iOS**: this list will have only 1 element and will be used by the [PermissionResponse.action]
///as the resource to consider when applying the corresponding action.
List<PermissionResourceType> resources;
///The frame that initiates the request in the web view.
FrameInfo? frame;
PermissionRequest(
{required this.origin, this.resources = const [], this.frame});
{this.frame, required this.origin, this.resources = const []});
///Gets a possible [PermissionRequest] instance from a [Map] value.
static PermissionRequest? fromMap(Map<String, dynamic>? map) {
@ -28,8 +28,8 @@ class PermissionRequest {
return null;
}
final instance = PermissionRequest(
origin: WebUri(map['origin']),
frame: FrameInfo.fromMap(map['frame']?.cast<String, dynamic>()),
origin: WebUri(map['origin']),
);
instance.resources = List<PermissionResourceType>.from(map['resources']
.map((e) => PermissionResourceType.fromNativeValue(e)!));
@ -39,9 +39,9 @@ class PermissionRequest {
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"frame": frame?.toMap(),
"origin": origin.toString(),
"resources": resources.map((e) => e.toNativeValue()).toList(),
"frame": frame?.toMap(),
};
}
@ -52,6 +52,6 @@ class PermissionRequest {
@override
String toString() {
return 'PermissionRequest{origin: $origin, resources: $resources, frame: $frame}';
return 'PermissionRequest{frame: $frame, origin: $origin, resources: $resources}';
}
}

View File

@ -16,59 +16,6 @@ class PermissionResourceType {
String value, Function nativeValue) =>
PermissionResourceType._internal(value, nativeValue());
///Resource belongs to audio capture device, like microphone.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_AUDIO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_AUDIO_CAPTURE))
///- iOS 15.0+ ([Official API - WKMediaCaptureType.microphone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone))
///- MacOS 12.0+ ([Official API - WKMediaCaptureType.microphone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone))
static final MICROPHONE =
PermissionResourceType._internalMultiPlatform('MICROPHONE', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 'android.webkit.resource.AUDIO_CAPTURE';
case TargetPlatform.iOS:
return 1;
case TargetPlatform.macOS:
return 1;
default:
break;
}
return null;
});
///Resource will allow sysex messages to be sent to or received from MIDI devices.
///These messages are privileged operations, e.g. modifying sound libraries and sampling data, or even updating the MIDI device's firmware.
///Permission may be requested for this resource in API levels 21 and above, if the Android device has been updated to WebView 45 or above.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_MIDI_SYSEX](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_MIDI_SYSEX))
static final MIDI_SYSEX =
PermissionResourceType._internalMultiPlatform('MIDI_SYSEX', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 'android.webkit.resource.MIDI_SYSEX';
default:
break;
}
return null;
});
///Resource belongs to protected media identifier. After the user grants this resource, the origin can use EME APIs to generate the license requests.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_PROTECTED_MEDIA_ID))
static final PROTECTED_MEDIA_ID =
PermissionResourceType._internalMultiPlatform('PROTECTED_MEDIA_ID', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 'android.webkit.resource.PROTECTED_MEDIA_ID';
default:
break;
}
return null;
});
///Resource belongs to video capture device, like camera.
///
///**Supported Platforms/Implementations**:
@ -128,14 +75,67 @@ class PermissionResourceType {
return null;
});
///Resource belongs to audio capture device, like microphone.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_AUDIO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_AUDIO_CAPTURE))
///- iOS 15.0+ ([Official API - WKMediaCaptureType.microphone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone))
///- MacOS 12.0+ ([Official API - WKMediaCaptureType.microphone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone))
static final MICROPHONE =
PermissionResourceType._internalMultiPlatform('MICROPHONE', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 'android.webkit.resource.AUDIO_CAPTURE';
case TargetPlatform.iOS:
return 1;
case TargetPlatform.macOS:
return 1;
default:
break;
}
return null;
});
///Resource will allow sysex messages to be sent to or received from MIDI devices.
///These messages are privileged operations, e.g. modifying sound libraries and sampling data, or even updating the MIDI device's firmware.
///Permission may be requested for this resource in API levels 21 and above, if the Android device has been updated to WebView 45 or above.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_MIDI_SYSEX](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_MIDI_SYSEX))
static final MIDI_SYSEX =
PermissionResourceType._internalMultiPlatform('MIDI_SYSEX', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 'android.webkit.resource.MIDI_SYSEX';
default:
break;
}
return null;
});
///Resource belongs to protected media identifier. After the user grants this resource, the origin can use EME APIs to generate the license requests.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_PROTECTED_MEDIA_ID))
static final PROTECTED_MEDIA_ID =
PermissionResourceType._internalMultiPlatform('PROTECTED_MEDIA_ID', () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 'android.webkit.resource.PROTECTED_MEDIA_ID';
default:
break;
}
return null;
});
///Set of all values of [PermissionResourceType].
static final Set<PermissionResourceType> values = [
PermissionResourceType.MICROPHONE,
PermissionResourceType.MIDI_SYSEX,
PermissionResourceType.PROTECTED_MEDIA_ID,
PermissionResourceType.CAMERA,
PermissionResourceType.CAMERA_AND_MICROPHONE,
PermissionResourceType.DEVICE_ORIENTATION_AND_MOTION,
PermissionResourceType.MICROPHONE,
PermissionResourceType.MIDI_SYSEX,
PermissionResourceType.PROTECTED_MEDIA_ID,
].toSet();
///Gets a possible [PermissionResourceType] instance from [String] value.

View File

@ -8,15 +8,15 @@ part of 'permission_response.dart';
///Class that represents the response used by the [WebView.onPermissionRequest] event.
class PermissionResponse {
///Indicate the [PermissionResponseAction] to take in response of a permission request.
PermissionResponseAction? action;
///Resources granted to be accessed by origin.
///
///**NOTE for iOS**: not used. The [action] taken is based on the [PermissionRequest.resources].
List<PermissionResourceType> resources;
///Indicate the [PermissionResponseAction] to take in response of a permission request.
PermissionResponseAction? action;
PermissionResponse(
{this.resources = const [], this.action = PermissionResponseAction.DENY});
{this.action = PermissionResponseAction.DENY, this.resources = const []});
///Gets a possible [PermissionResponse] instance from a [Map] value.
static PermissionResponse? fromMap(Map<String, dynamic>? map) {
@ -24,17 +24,17 @@ class PermissionResponse {
return null;
}
final instance = PermissionResponse();
instance.action = PermissionResponseAction.fromNativeValue(map['action']);
instance.resources = List<PermissionResourceType>.from(map['resources']
.map((e) => PermissionResourceType.fromNativeValue(e)!));
instance.action = PermissionResponseAction.fromNativeValue(map['action']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"resources": resources.map((e) => e.toNativeValue()).toList(),
"action": action?.toNativeValue(),
"resources": resources.map((e) => e.toNativeValue()).toList(),
};
}
@ -45,7 +45,7 @@ class PermissionResponse {
@override
String toString() {
return 'PermissionResponse{resources: $resources, action: $action}';
return 'PermissionResponse{action: $action, resources: $resources}';
}
}
@ -53,14 +53,14 @@ class PermissionResponse {
///Use [PermissionResponse] instead.
@Deprecated('Use PermissionResponse instead')
class PermissionRequestResponse {
///Resources granted to be accessed by origin.
List<String> resources;
///Indicate the [PermissionRequestResponseAction] to take in response of a permission request.
PermissionRequestResponseAction? action;
///Resources granted to be accessed by origin.
List<String> resources;
PermissionRequestResponse(
{this.resources = const [],
this.action = PermissionRequestResponseAction.DENY});
{this.action = PermissionRequestResponseAction.DENY,
this.resources = const []});
///Gets a possible [PermissionRequestResponse] instance from a [Map] value.
static PermissionRequestResponse? fromMap(Map<String, dynamic>? map) {
@ -68,17 +68,17 @@ class PermissionRequestResponse {
return null;
}
final instance = PermissionRequestResponse();
instance.resources = map['resources'].cast<String>();
instance.action =
PermissionRequestResponseAction.fromNativeValue(map['action']);
instance.resources = map['resources'].cast<String>();
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"resources": resources,
"action": action?.toNativeValue(),
"resources": resources,
};
}
@ -89,6 +89,6 @@ class PermissionRequestResponse {
@override
String toString() {
return 'PermissionRequestResponse{resources: $resources, action: $action}';
return 'PermissionRequestResponse{action: $action, resources: $resources}';
}
}

View File

@ -16,6 +16,12 @@ class PrintJobAttributes {
///- MacOS
PrintJobColorMode? colorMode;
///If `true`, produce detailed reports when an error occurs.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? detailedErrorReporting;
///The duplex mode to use for the print job.
///
///**Supported Platforms/Implementations**:
@ -24,29 +30,11 @@ class PrintJobAttributes {
///- MacOS
PrintJobDuplexMode? duplex;
///The orientation of the printed content, portrait or landscape.
PrintJobOrientation? orientation;
///The media size.
///A fax number.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
PrintJobMediaSize? mediaSize;
///The supported resolution in DPI (dots per inch).
///
///**Supported Platforms/Implementations**:
///- Android native WebView
PrintJobResolution? resolution;
///The margins for each printed page.
///Margins define the white space around the content where the left margin defines
///the amount of white space on the left of the content and so on.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
EdgeInsets? margins;
String? faxNumber;
///The height of the page footer.
///
@ -57,6 +45,12 @@ class PrintJobAttributes {
///- iOS
double? footerHeight;
///If `true`, a standard header and footer are added outside the margins of each page.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? headerAndFooter;
///The height of the page header.
///
///The header is measured in points from the top of [printableRect] and is above the content area.
@ -66,25 +60,56 @@ class PrintJobAttributes {
///- iOS
double? headerHeight;
///The area in which printing can occur.
///
///The value of this property is a rectangle that defines the area in which the printer can print content.
///Sometimes this is referred to as the imageable area of the paper.
///The horizontal pagination mode.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
InAppWebViewRect? printableRect;
PrintJobPaginationMode? horizontalPagination;
///The size of the paper used for printing.
///Indicates whether the image is centered horizontally.
///
///The value of this property is a rectangle that defines the size of paper chosen for the print job.
///The origin is always (0,0).
///**Supported Platforms/Implementations**:
///- MacOS
bool? isHorizontallyCentered;
///Indicates whether only the currently selected contents should be printed.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? isSelectionOnly;
///Indicates whether the image is centered vertically.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? isVerticallyCentered;
///The action specified for the job.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobDisposition? jobDisposition;
///An URL containing the location to which the job file will be saved when the [jobDisposition] is [PrintJobDisposition.SAVE].
///
///**Supported Platforms/Implementations**:
///- MacOS
WebUri? jobSavingURL;
///The human-readable name of the currently selected paper size, suitable for presentation in user interfaces.
///
///**Supported Platforms/Implementations**:
///- MacOS
String? localizedPaperName;
///The margins for each printed page.
///Margins define the white space around the content where the left margin defines
///the amount of white space on the left of the content and so on.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
InAppWebViewRect? paperRect;
EdgeInsets? margins;
///The maximum height of the content area.
///
@ -107,83 +132,11 @@ class PrintJobAttributes {
///- iOS
double? maximumContentWidth;
///The name of the currently selected paper size.
///The media size.
///
///**Supported Platforms/Implementations**:
///- MacOS
String? paperName;
///The human-readable name of the currently selected paper size, suitable for presentation in user interfaces.
///
///**Supported Platforms/Implementations**:
///- MacOS
String? localizedPaperName;
///The horizontal pagination mode.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobPaginationMode? horizontalPagination;
///The vertical pagination to the specified mode.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobPaginationMode? verticalPagination;
///The action specified for the job.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobDisposition? jobDisposition;
///Indicates whether the image is centered horizontally.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? isHorizontallyCentered;
///Indicates whether the image is centered vertically.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? isVerticallyCentered;
///Indicates whether only the currently selected contents should be printed.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? isSelectionOnly;
///The current scaling factor.
///
///**Supported Platforms/Implementations**:
///- MacOS
double? scalingFactor;
///An URL containing the location to which the job file will be saved when the [jobDisposition] is [PrintJobDisposition.SAVE].
///
///**Supported Platforms/Implementations**:
///- MacOS
WebUri? jobSavingURL;
///If `true`, produce detailed reports when an error occurs.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? detailedErrorReporting;
///A fax number.
///
///**Supported Platforms/Implementations**:
///- MacOS
String? faxNumber;
///If `true`, a standard header and footer are added outside the margins of each page.
///
///**Supported Platforms/Implementations**:
///- MacOS
bool? headerAndFooter;
///- Android native WebView
PrintJobMediaSize? mediaSize;
///If `true`, collates output.
///
@ -191,6 +144,9 @@ class PrintJobAttributes {
///- MacOS
bool? mustCollate;
///The orientation of the printed content, portrait or landscape.
PrintJobOrientation? orientation;
///The number of logical pages to be tiled horizontally on a physical sheet of paper.
///
///**Supported Platforms/Implementations**:
@ -203,41 +159,85 @@ class PrintJobAttributes {
///- MacOS
int? pagesDown;
///The name of the currently selected paper size.
///
///**Supported Platforms/Implementations**:
///- MacOS
String? paperName;
///The size of the paper used for printing.
///
///The value of this property is a rectangle that defines the size of paper chosen for the print job.
///The origin is always (0,0).
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
InAppWebViewRect? paperRect;
///The area in which printing can occur.
///
///The value of this property is a rectangle that defines the area in which the printer can print content.
///Sometimes this is referred to as the imageable area of the paper.
///
///**Supported Platforms/Implementations**:
///- iOS
///- MacOS
InAppWebViewRect? printableRect;
///The supported resolution in DPI (dots per inch).
///
///**Supported Platforms/Implementations**:
///- Android native WebView
PrintJobResolution? resolution;
///The current scaling factor.
///
///**Supported Platforms/Implementations**:
///- MacOS
double? scalingFactor;
///A timestamp that specifies the time at which printing should begin.
///
///**Supported Platforms/Implementations**:
///- MacOS
int? time;
///The vertical pagination to the specified mode.
///
///**Supported Platforms/Implementations**:
///- MacOS
PrintJobPaginationMode? verticalPagination;
PrintJobAttributes(
{this.colorMode,
this.detailedErrorReporting,
this.duplex,
this.orientation,
this.mediaSize,
this.resolution,
this.margins,
this.faxNumber,
this.footerHeight,
this.headerAndFooter,
this.headerHeight,
this.printableRect,
this.paperRect,
this.horizontalPagination,
this.isHorizontallyCentered,
this.isSelectionOnly,
this.isVerticallyCentered,
this.jobDisposition,
this.jobSavingURL,
this.localizedPaperName,
this.margins,
this.maximumContentHeight,
this.maximumContentWidth,
this.paperName,
this.localizedPaperName,
this.horizontalPagination,
this.verticalPagination,
this.jobDisposition,
this.isHorizontallyCentered,
this.isVerticallyCentered,
this.isSelectionOnly,
this.scalingFactor,
this.jobSavingURL,
this.detailedErrorReporting,
this.faxNumber,
this.headerAndFooter,
this.mediaSize,
this.mustCollate,
this.orientation,
this.pagesAcross,
this.pagesDown,
this.time});
this.paperName,
this.paperRect,
this.printableRect,
this.resolution,
this.scalingFactor,
this.time,
this.verticalPagination});
///Gets a possible [PrintJobAttributes] instance from a [Map] value.
static PrintJobAttributes? fromMap(Map<String, dynamic>? map) {
@ -246,42 +246,42 @@ class PrintJobAttributes {
}
final instance = PrintJobAttributes(
colorMode: PrintJobColorMode.fromNativeValue(map['colorMode']),
detailedErrorReporting: map['detailedErrorReporting'],
duplex: PrintJobDuplexMode.fromNativeValue(map['duplex']),
orientation: PrintJobOrientation.fromNativeValue(map['orientation']),
mediaSize:
PrintJobMediaSize.fromMap(map['mediaSize']?.cast<String, dynamic>()),
resolution: PrintJobResolution.fromMap(
map['resolution']?.cast<String, dynamic>()),
margins: MapEdgeInsets.fromMap(map['margins']?.cast<String, dynamic>()),
faxNumber: map['faxNumber'],
footerHeight: map['footerHeight'],
headerAndFooter: map['headerAndFooter'],
headerHeight: map['headerHeight'],
printableRect: InAppWebViewRect.fromMap(
map['printableRect']?.cast<String, dynamic>()),
paperRect:
InAppWebViewRect.fromMap(map['paperRect']?.cast<String, dynamic>()),
maximumContentHeight: map['maximumContentHeight'],
maximumContentWidth: map['maximumContentWidth'],
paperName: map['paperName'],
localizedPaperName: map['localizedPaperName'],
horizontalPagination:
PrintJobPaginationMode.fromNativeValue(map['horizontalPagination']),
verticalPagination:
PrintJobPaginationMode.fromNativeValue(map['verticalPagination']),
isHorizontallyCentered: map['isHorizontallyCentered'],
isSelectionOnly: map['isSelectionOnly'],
isVerticallyCentered: map['isVerticallyCentered'],
jobDisposition:
PrintJobDisposition.fromNativeValue(map['jobDisposition']),
isHorizontallyCentered: map['isHorizontallyCentered'],
isVerticallyCentered: map['isVerticallyCentered'],
isSelectionOnly: map['isSelectionOnly'],
scalingFactor: map['scalingFactor'],
jobSavingURL:
map['jobSavingURL'] != null ? WebUri(map['jobSavingURL']) : null,
detailedErrorReporting: map['detailedErrorReporting'],
faxNumber: map['faxNumber'],
headerAndFooter: map['headerAndFooter'],
localizedPaperName: map['localizedPaperName'],
margins: MapEdgeInsets.fromMap(map['margins']?.cast<String, dynamic>()),
maximumContentHeight: map['maximumContentHeight'],
maximumContentWidth: map['maximumContentWidth'],
mediaSize:
PrintJobMediaSize.fromMap(map['mediaSize']?.cast<String, dynamic>()),
mustCollate: map['mustCollate'],
orientation: PrintJobOrientation.fromNativeValue(map['orientation']),
pagesAcross: map['pagesAcross'],
pagesDown: map['pagesDown'],
paperName: map['paperName'],
paperRect:
InAppWebViewRect.fromMap(map['paperRect']?.cast<String, dynamic>()),
printableRect: InAppWebViewRect.fromMap(
map['printableRect']?.cast<String, dynamic>()),
resolution: PrintJobResolution.fromMap(
map['resolution']?.cast<String, dynamic>()),
scalingFactor: map['scalingFactor'],
time: map['time'],
verticalPagination:
PrintJobPaginationMode.fromNativeValue(map['verticalPagination']),
);
return instance;
}
@ -290,34 +290,34 @@ class PrintJobAttributes {
Map<String, dynamic> toMap() {
return {
"colorMode": colorMode?.toNativeValue(),
"detailedErrorReporting": detailedErrorReporting,
"duplex": duplex?.toNativeValue(),
"orientation": orientation?.toNativeValue(),
"mediaSize": mediaSize?.toMap(),
"resolution": resolution?.toMap(),
"margins": margins?.toMap(),
"faxNumber": faxNumber,
"footerHeight": footerHeight,
"headerAndFooter": headerAndFooter,
"headerHeight": headerHeight,
"printableRect": printableRect?.toMap(),
"paperRect": paperRect?.toMap(),
"horizontalPagination": horizontalPagination?.toNativeValue(),
"isHorizontallyCentered": isHorizontallyCentered,
"isSelectionOnly": isSelectionOnly,
"isVerticallyCentered": isVerticallyCentered,
"jobDisposition": jobDisposition?.toNativeValue(),
"jobSavingURL": jobSavingURL?.toString(),
"localizedPaperName": localizedPaperName,
"margins": margins?.toMap(),
"maximumContentHeight": maximumContentHeight,
"maximumContentWidth": maximumContentWidth,
"paperName": paperName,
"localizedPaperName": localizedPaperName,
"horizontalPagination": horizontalPagination?.toNativeValue(),
"verticalPagination": verticalPagination?.toNativeValue(),
"jobDisposition": jobDisposition?.toNativeValue(),
"isHorizontallyCentered": isHorizontallyCentered,
"isVerticallyCentered": isVerticallyCentered,
"isSelectionOnly": isSelectionOnly,
"scalingFactor": scalingFactor,
"jobSavingURL": jobSavingURL?.toString(),
"detailedErrorReporting": detailedErrorReporting,
"faxNumber": faxNumber,
"headerAndFooter": headerAndFooter,
"mediaSize": mediaSize?.toMap(),
"mustCollate": mustCollate,
"orientation": orientation?.toNativeValue(),
"pagesAcross": pagesAcross,
"pagesDown": pagesDown,
"paperName": paperName,
"paperRect": paperRect?.toMap(),
"printableRect": printableRect?.toMap(),
"resolution": resolution?.toMap(),
"scalingFactor": scalingFactor,
"time": time,
"verticalPagination": verticalPagination?.toNativeValue(),
};
}
@ -328,6 +328,6 @@ class PrintJobAttributes {
@override
String toString() {
return 'PrintJobAttributes{colorMode: $colorMode, duplex: $duplex, orientation: $orientation, mediaSize: $mediaSize, resolution: $resolution, margins: $margins, footerHeight: $footerHeight, headerHeight: $headerHeight, printableRect: $printableRect, paperRect: $paperRect, maximumContentHeight: $maximumContentHeight, maximumContentWidth: $maximumContentWidth, paperName: $paperName, localizedPaperName: $localizedPaperName, horizontalPagination: $horizontalPagination, verticalPagination: $verticalPagination, jobDisposition: $jobDisposition, isHorizontallyCentered: $isHorizontallyCentered, isVerticallyCentered: $isVerticallyCentered, isSelectionOnly: $isSelectionOnly, scalingFactor: $scalingFactor, jobSavingURL: $jobSavingURL, detailedErrorReporting: $detailedErrorReporting, faxNumber: $faxNumber, headerAndFooter: $headerAndFooter, mustCollate: $mustCollate, pagesAcross: $pagesAcross, pagesDown: $pagesDown, time: $time}';
return 'PrintJobAttributes{colorMode: $colorMode, detailedErrorReporting: $detailedErrorReporting, duplex: $duplex, faxNumber: $faxNumber, footerHeight: $footerHeight, headerAndFooter: $headerAndFooter, headerHeight: $headerHeight, horizontalPagination: $horizontalPagination, isHorizontallyCentered: $isHorizontallyCentered, isSelectionOnly: $isSelectionOnly, isVerticallyCentered: $isVerticallyCentered, jobDisposition: $jobDisposition, jobSavingURL: $jobSavingURL, localizedPaperName: $localizedPaperName, margins: $margins, maximumContentHeight: $maximumContentHeight, maximumContentWidth: $maximumContentWidth, mediaSize: $mediaSize, mustCollate: $mustCollate, orientation: $orientation, pagesAcross: $pagesAcross, pagesDown: $pagesDown, paperName: $paperName, paperRect: $paperRect, printableRect: $printableRect, resolution: $resolution, scalingFactor: $scalingFactor, time: $time, verticalPagination: $verticalPagination}';
}
}

View File

@ -16,23 +16,6 @@ class PrintJobColorMode {
int value, Function nativeValue) =>
PrintJobColorMode._internal(value, nativeValue());
///Monochrome color scheme, for example one color is used.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- MacOS
static final MONOCHROME = PrintJobColorMode._internalMultiPlatform(1, () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 1;
case TargetPlatform.macOS:
return 'Gray';
default:
break;
}
return null;
});
///Color color scheme, for example many colors are used.
///
///**Supported Platforms/Implementations**:
@ -50,10 +33,27 @@ class PrintJobColorMode {
return null;
});
///Monochrome color scheme, for example one color is used.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- MacOS
static final MONOCHROME = PrintJobColorMode._internalMultiPlatform(1, () {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return 1;
case TargetPlatform.macOS:
return 'Gray';
default:
break;
}
return null;
});
///Set of all values of [PrintJobColorMode].
static final Set<PrintJobColorMode> values = [
PrintJobColorMode.MONOCHROME,
PrintJobColorMode.COLOR,
PrintJobColorMode.MONOCHROME,
].toSet();
///Gets a possible [PrintJobColorMode] instance from [int] value.
@ -97,10 +97,10 @@ class PrintJobColorMode {
@override
String toString() {
switch (_value) {
case 1:
return 'MONOCHROME';
case 2:
return 'COLOR';
case 1:
return 'MONOCHROME';
}
return _value.toString();
}

Some files were not shown because too many files have changed in this diff Show More