moved every class in types.dart in a specific class file
This commit is contained in:
parent
dc2e384822
commit
1e6de69d20
|
@ -1,7 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'webview_feature.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
|
||||
///Class that manages Service Workers used by [WebView].
|
||||
///
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import '../../util.dart';
|
||||
import '../../types.dart';
|
||||
import '../../types/main.dart';
|
||||
|
||||
import '../chrome_safari_browser_settings.dart';
|
||||
import '../chrome_safari_browser.dart';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import '../../util.dart';
|
||||
import '../../types.dart';
|
||||
import '../../types/main.dart';
|
||||
|
||||
import '../chrome_safari_browser_settings.dart';
|
||||
import '../chrome_safari_browser.dart';
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
|
|||
import '../util.dart';
|
||||
import 'android/chrome_custom_tabs_options.dart';
|
||||
import 'apple/safari_options.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
|
||||
class ChromeSafariBrowserOptions {
|
||||
Map<String, dynamic> toMap() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'types.dart';
|
||||
import 'types/main.dart';
|
||||
|
||||
///Class that represents a set of rules to use block content in the browser window.
|
||||
///
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'in_app_webview/webview.dart';
|
||||
import 'types.dart';
|
||||
import 'types/main.dart';
|
||||
|
||||
///Class that represents the WebView context menu. It used by [WebView.contextMenu].
|
||||
///
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'in_app_webview/in_app_webview_settings.dart';
|
|||
import 'in_app_webview/headless_in_app_webview.dart';
|
||||
import 'platform_util.dart';
|
||||
|
||||
import 'types.dart';
|
||||
import 'types/main.dart';
|
||||
|
||||
///Class that implements a singleton object (shared instance) which manages the cookies used by WebView instances.
|
||||
///On Android, it is implemented using [CookieManager](https://developer.android.com/reference/android/webkit/CookieManager).
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'types.dart';
|
||||
import 'types/main.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
///Class that implements a singleton object (shared instance) which manages the shared HTTP auth credentials cache.
|
||||
|
|
|
@ -5,7 +5,7 @@ import '../../in_app_webview/apple/in_app_webview_options.dart';
|
|||
import '../in_app_browser_settings.dart';
|
||||
import '../in_app_browser.dart';
|
||||
|
||||
import '../../types.dart';
|
||||
import '../../types/main.dart';
|
||||
import '../../util.dart';
|
||||
|
||||
///This class represents all the iOS-only [InAppBrowser] options available.
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
|
|||
|
||||
import '../context_menu.dart';
|
||||
import '../pull_to_refresh/main.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
|
||||
import '../in_app_webview/in_app_webview_controller.dart';
|
||||
import '../in_app_webview/in_app_webview_settings.dart';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_inappwebview/src/types.dart';
|
||||
import 'package:flutter_inappwebview/src/types/main.dart';
|
||||
|
||||
import '../util.dart';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'dart:core';
|
|||
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../types.dart';
|
||||
import '../../types/main.dart';
|
||||
import '../../android/webview_feature.dart';
|
||||
import '../in_app_webview_controller.dart';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import '../../util.dart';
|
||||
import '../../types.dart';
|
||||
import '../../types/main.dart';
|
||||
import '../../in_app_browser/in_app_browser_settings.dart';
|
||||
import '../in_app_webview_settings.dart';
|
||||
import '../webview.dart';
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'dart:typed_data';
|
|||
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../types.dart';
|
||||
import '../../types/main.dart';
|
||||
import '../in_app_webview_controller.dart';
|
||||
|
||||
///Class mixin that contains only iOS-specific methods for the WebView.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import '../../types.dart';
|
||||
import '../../types/main.dart';
|
||||
|
||||
import '../../in_app_browser/in_app_browser_settings.dart';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
|
|||
import 'package:flutter_inappwebview/src/util.dart';
|
||||
|
||||
import '../context_menu.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
import 'webview.dart';
|
||||
import 'in_app_webview_controller.dart';
|
||||
import 'in_app_webview_settings.dart';
|
||||
|
|
|
@ -12,7 +12,7 @@ import 'package:flutter/gestures.dart';
|
|||
import '../web/web_platform_manager.dart';
|
||||
|
||||
import '../context_menu.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
|
||||
import 'webview.dart';
|
||||
import 'in_app_webview_controller.dart';
|
||||
|
|
|
@ -14,7 +14,7 @@ import 'android/in_app_webview_controller.dart';
|
|||
import 'apple/in_app_webview_controller.dart';
|
||||
|
||||
import '../context_menu.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
import '../in_app_browser/in_app_browser.dart';
|
||||
import '../web_storage/web_storage.dart';
|
||||
import '../util.dart';
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'android/in_app_webview_options.dart';
|
||||
import 'apple/in_app_webview_options.dart';
|
||||
import '../content_blocker.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
import '../util.dart';
|
||||
import '../in_app_browser/in_app_browser_settings.dart';
|
||||
import 'webview.dart';
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview_web.dart';
|
|||
import '../pull_to_refresh/pull_to_refresh_controller.dart';
|
||||
|
||||
import '../context_menu.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
|
||||
import 'in_app_webview_controller.dart';
|
||||
import 'in_app_webview_settings.dart';
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
export 'types/main.dart';
|
||||
export 'in_app_webview/main.dart';
|
||||
export 'in_app_browser/main.dart';
|
||||
export 'chrome_safari_browser/main.dart';
|
||||
|
@ -5,7 +6,7 @@ export 'android/main.dart';
|
|||
export 'apple/main.dart';
|
||||
export 'x509_certificate/main.dart';
|
||||
export 'web_storage/main.dart';
|
||||
export 'types.dart';
|
||||
export 'types/main.dart';
|
||||
export 'cookie_manager.dart';
|
||||
export 'in_app_localhost_server.dart';
|
||||
export 'content_blocker.dart';
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:flutter/services.dart';
|
|||
import '../in_app_webview/webview.dart';
|
||||
import '../in_app_browser/in_app_browser.dart';
|
||||
import '../util.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
import '../in_app_webview/in_app_webview_settings.dart';
|
||||
import 'pull_to_refresh_settings.dart';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'dart:ui';
|
||||
import '../util.dart';
|
||||
import '../types.dart';
|
||||
import '../types/main.dart';
|
||||
|
||||
///Pull-To-Refresh Settings
|
||||
class PullToRefreshSettings {
|
||||
|
|
10852
lib/src/types.dart
10852
lib/src/types.dart
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,140 @@
|
|||
///Class used to disable the action mode menu items.
|
||||
class ActionModeMenuItem {
|
||||
final int _value;
|
||||
|
||||
const ActionModeMenuItem._internal(this._value);
|
||||
|
||||
///Set of all values of [ActionModeMenuItem].
|
||||
static final Set<ActionModeMenuItem> values = [
|
||||
ActionModeMenuItem.MENU_ITEM_NONE,
|
||||
ActionModeMenuItem.MENU_ITEM_SHARE,
|
||||
ActionModeMenuItem.MENU_ITEM_WEB_SEARCH,
|
||||
ActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [ActionModeMenuItem] instance from an [int] value.
|
||||
static ActionModeMenuItem? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return ActionModeMenuItem.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
// maybe coming from a Bitwise OR operator
|
||||
return ActionModeMenuItem._internal(value);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "MENU_ITEM_SHARE";
|
||||
case 2:
|
||||
return "MENU_ITEM_WEB_SEARCH";
|
||||
case 4:
|
||||
return "MENU_ITEM_PROCESS_TEXT";
|
||||
case 0:
|
||||
return "MENU_ITEM_NONE";
|
||||
}
|
||||
return _value.toString();
|
||||
}
|
||||
|
||||
///No menu items should be disabled.
|
||||
static const MENU_ITEM_NONE = const ActionModeMenuItem._internal(0);
|
||||
|
||||
///Disable menu item "Share".
|
||||
static const MENU_ITEM_SHARE = const ActionModeMenuItem._internal(1);
|
||||
|
||||
///Disable menu item "Web Search".
|
||||
static const MENU_ITEM_WEB_SEARCH = const ActionModeMenuItem._internal(2);
|
||||
|
||||
///Disable all the action mode menu items for text processing.
|
||||
static const MENU_ITEM_PROCESS_TEXT = const ActionModeMenuItem._internal(4);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
ActionModeMenuItem operator |(ActionModeMenuItem value) =>
|
||||
ActionModeMenuItem._internal(value.toValue() | _value);
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An Android-specific class used to disable the action mode menu items.
|
||||
///
|
||||
///**NOTE**: available on Android 24+.
|
||||
///
|
||||
///Use [ActionModeMenuItem] instead.
|
||||
@Deprecated("Use ActionModeMenuItem instead")
|
||||
class AndroidActionModeMenuItem {
|
||||
final int _value;
|
||||
|
||||
const AndroidActionModeMenuItem._internal(this._value);
|
||||
|
||||
///Set of all values of [AndroidActionModeMenuItem].
|
||||
static final Set<AndroidActionModeMenuItem> values = [
|
||||
AndroidActionModeMenuItem.MENU_ITEM_NONE,
|
||||
AndroidActionModeMenuItem.MENU_ITEM_SHARE,
|
||||
AndroidActionModeMenuItem.MENU_ITEM_WEB_SEARCH,
|
||||
AndroidActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [AndroidActionModeMenuItem] instance from an [int] value.
|
||||
static AndroidActionModeMenuItem? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return AndroidActionModeMenuItem.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
// maybe coming from a Bitwise OR operator
|
||||
return AndroidActionModeMenuItem._internal(value);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "MENU_ITEM_SHARE";
|
||||
case 2:
|
||||
return "MENU_ITEM_WEB_SEARCH";
|
||||
case 4:
|
||||
return "MENU_ITEM_PROCESS_TEXT";
|
||||
case 0:
|
||||
return "MENU_ITEM_NONE";
|
||||
}
|
||||
return _value.toString();
|
||||
}
|
||||
|
||||
///No menu items should be disabled.
|
||||
static const MENU_ITEM_NONE = const AndroidActionModeMenuItem._internal(0);
|
||||
|
||||
///Disable menu item "Share".
|
||||
static const MENU_ITEM_SHARE = const AndroidActionModeMenuItem._internal(1);
|
||||
|
||||
///Disable menu item "Web Search".
|
||||
static const MENU_ITEM_WEB_SEARCH =
|
||||
const AndroidActionModeMenuItem._internal(2);
|
||||
|
||||
///Disable all the action mode menu items for text processing.
|
||||
static const MENU_ITEM_PROCESS_TEXT =
|
||||
const AndroidActionModeMenuItem._internal(4);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
AndroidActionModeMenuItem operator |(AndroidActionModeMenuItem value) =>
|
||||
AndroidActionModeMenuItem._internal(value.toValue() | _value);
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,158 @@
|
|||
import 'ajax_request_headers.dart';
|
||||
import 'ajax_request_ready_state.dart';
|
||||
import 'ajax_request_event.dart';
|
||||
import 'ajax_request_action.dart';
|
||||
|
||||
///Class that represents a JavaScript [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object.
|
||||
class AjaxRequest {
|
||||
///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.
|
||||
Uri? 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;
|
||||
|
||||
///The HTTP request headers.
|
||||
AjaxRequestHeaders? headers;
|
||||
|
||||
///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 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.
|
||||
Uri? responseURL;
|
||||
|
||||
///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 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;
|
||||
|
||||
///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;
|
||||
|
||||
///Event type of the `XMLHttpRequest` request.
|
||||
AjaxRequestEvent? event;
|
||||
|
||||
///Indicates the [AjaxRequestAction] that can be used to control the `XMLHttpRequest` request.
|
||||
AjaxRequestAction? action;
|
||||
|
||||
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.event,
|
||||
this.action = AjaxRequestAction.PROCEED});
|
||||
|
||||
///Gets a possible [AjaxRequest] instance from a [Map] value.
|
||||
static AjaxRequest? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return AjaxRequest(
|
||||
data: map["data"],
|
||||
method: map["method"],
|
||||
url: map["url"] != null ? Uri.parse(map["url"]) : null,
|
||||
isAsync: map["isAsync"],
|
||||
user: map["user"],
|
||||
password: map["password"],
|
||||
withCredentials: map["withCredentials"],
|
||||
headers:
|
||||
AjaxRequestHeaders.fromMap(map["headers"]?.cast<String, dynamic>()),
|
||||
readyState: AjaxRequestReadyState.fromValue(map["readyState"]),
|
||||
status: map["status"],
|
||||
responseURL:
|
||||
map["responseURL"] != null ? Uri.parse(map["responseURL"]) : null,
|
||||
responseType: map["responseType"],
|
||||
response: map["response"],
|
||||
responseText: map["responseText"],
|
||||
responseXML: map["responseXML"],
|
||||
statusText: map["statusText"],
|
||||
responseHeaders: map["responseHeaders"]?.cast<String, dynamic>(),
|
||||
event: AjaxRequestEvent.fromMap(map["event"]?.cast<String, dynamic>()));
|
||||
}
|
||||
|
||||
///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?.toValue(),
|
||||
"status": status,
|
||||
"responseURL": responseURL?.toString(),
|
||||
"responseType": responseType,
|
||||
"response": response,
|
||||
"responseText": responseText,
|
||||
"responseXML": responseXML,
|
||||
"statusText": statusText,
|
||||
"responseHeaders": responseHeaders,
|
||||
"action": action?.toValue()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
import 'ajax_request.dart';
|
||||
|
||||
///Class used by [AjaxRequest] class.
|
||||
class AjaxRequestAction {
|
||||
final int _value;
|
||||
|
||||
const AjaxRequestAction._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Aborts the current [AjaxRequest].
|
||||
static const ABORT = const AjaxRequestAction._internal(0);
|
||||
|
||||
///Proceeds with the current [AjaxRequest].
|
||||
static const PROCEED = const AjaxRequestAction._internal(1);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"action": _value,
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
import 'ajax_request.dart';
|
||||
import 'ajax_request_event_type.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;
|
||||
|
||||
///Is an integer representing the amount of work already performed by the underlying process.
|
||||
///The ratio of work done can be calculated with the property and [AjaxRequestEvent.total].
|
||||
///When downloading a resource using HTTP, this only represent the part of the content itself, not headers and other overhead.
|
||||
int? loaded;
|
||||
|
||||
///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});
|
||||
|
||||
///Gets a possible [AjaxRequestEvent] instance from a [Map] value.
|
||||
static AjaxRequestEvent? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return AjaxRequestEvent(
|
||||
type: AjaxRequestEventType.fromValue(map["type"]),
|
||||
lengthComputable: map["lengthComputable"],
|
||||
loaded: map["loaded"],
|
||||
total: map["total"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"type": type?.toValue(),
|
||||
"lengthComputable": lengthComputable,
|
||||
"loaded": loaded,
|
||||
"total": total,
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
import 'ajax_request_event.dart';
|
||||
|
||||
///Class used by [AjaxRequestEvent] class.
|
||||
class AjaxRequestEventType {
|
||||
final String _value;
|
||||
|
||||
const AjaxRequestEventType._internal(this._value);
|
||||
|
||||
///Set of all values of [AjaxRequestEventType].
|
||||
static final Set<AjaxRequestEventType> values = [
|
||||
AjaxRequestEventType.LOADSTART,
|
||||
AjaxRequestEventType.LOAD,
|
||||
AjaxRequestEventType.LOADEND,
|
||||
AjaxRequestEventType.PROGRESS,
|
||||
AjaxRequestEventType.ERROR,
|
||||
AjaxRequestEventType.ABORT,
|
||||
AjaxRequestEventType.TIMEOUT,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [AjaxRequestEventType] instance from a [String] value.
|
||||
static AjaxRequestEventType? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return AjaxRequestEventType.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
String toString() => _value;
|
||||
|
||||
///The LOADSTART event is fired when a request has started to load data.
|
||||
static const LOADSTART = const AjaxRequestEventType._internal("loadstart");
|
||||
|
||||
///The LOAD event is fired when an `XMLHttpRequest` transaction completes successfully.
|
||||
static const LOAD = const AjaxRequestEventType._internal("load");
|
||||
|
||||
///The LOADEND event is fired when a request has completed, whether successfully (after [AjaxRequestEventType.LOAD]) or
|
||||
///unsuccessfully (after [AjaxRequestEventType.ABORT] or [AjaxRequestEventType.ERROR]).
|
||||
static const LOADEND = const AjaxRequestEventType._internal("loadend");
|
||||
|
||||
///The PROGRESS event is fired periodically when a request receives more data.
|
||||
static const PROGRESS = const AjaxRequestEventType._internal("progress");
|
||||
|
||||
///The ERROR event is fired when the request encountered an error.
|
||||
static const ERROR = const AjaxRequestEventType._internal("error");
|
||||
|
||||
///The ABORT event is fired when a request has been aborted.
|
||||
static const ABORT = const AjaxRequestEventType._internal("abort");
|
||||
|
||||
///The TIMEOUT event is fired when progression is terminated due to preset time expiring.
|
||||
static const TIMEOUT = const AjaxRequestEventType._internal("timeout");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
import 'ajax_request.dart';
|
||||
|
||||
///Class that represents the HTTP headers of an [AjaxRequest].
|
||||
class AjaxRequestHeaders {
|
||||
Map<String, dynamic> _headers;
|
||||
Map<String, dynamic> _newHeaders = {};
|
||||
|
||||
AjaxRequestHeaders(this._headers);
|
||||
|
||||
///Gets a possible [AjaxRequestHeaders] instance from a [Map] value.
|
||||
static AjaxRequestHeaders? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return AjaxRequestHeaders(map);
|
||||
}
|
||||
|
||||
///Gets the HTTP headers of the [AjaxRequest].
|
||||
Map<String, dynamic> getHeaders() {
|
||||
return this._headers;
|
||||
}
|
||||
|
||||
///Sets/updates an HTTP header of the [AjaxRequest]. If there is already an existing [header] with the same name, the values are merged into one single request header.
|
||||
///For security reasons, some headers can only be controlled by the user agent.
|
||||
///These headers include the [forbidden header names](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name)
|
||||
///and [forbidden response header names](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_response_header_name).
|
||||
void setRequestHeader(String header, String value) {
|
||||
_newHeaders[header] = value;
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return _newHeaders;
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
import 'ajax_request.dart';
|
||||
|
||||
///Class used by [AjaxRequest] class. It represents the state of an [AjaxRequest].
|
||||
class AjaxRequestReadyState {
|
||||
final int _value;
|
||||
|
||||
const AjaxRequestReadyState._internal(this._value);
|
||||
|
||||
///Set of all values of [AjaxRequestReadyState].
|
||||
static final Set<AjaxRequestReadyState> values = [
|
||||
AjaxRequestReadyState.UNSENT,
|
||||
AjaxRequestReadyState.OPENED,
|
||||
AjaxRequestReadyState.HEADERS_RECEIVED,
|
||||
AjaxRequestReadyState.LOADING,
|
||||
AjaxRequestReadyState.DONE,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [AjaxRequestReadyState] instance from an [int] value.
|
||||
static AjaxRequestReadyState? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return AjaxRequestReadyState.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "OPENED";
|
||||
case 2:
|
||||
return "HEADERS_RECEIVED";
|
||||
case 3:
|
||||
return "LOADING";
|
||||
case 4:
|
||||
return "DONE";
|
||||
case 0:
|
||||
default:
|
||||
return "UNSENT";
|
||||
}
|
||||
}
|
||||
|
||||
///Client has been created. `XMLHttpRequest.open()` not called yet.
|
||||
static const UNSENT = const AjaxRequestReadyState._internal(0);
|
||||
|
||||
///`XMLHttpRequest.open()` has been called.
|
||||
static const OPENED = const AjaxRequestReadyState._internal(1);
|
||||
|
||||
///`XMLHttpRequest.send()` has been called, and [AjaxRequest.headers] and [AjaxRequest.status] are available.
|
||||
static const HEADERS_RECEIVED = const AjaxRequestReadyState._internal(2);
|
||||
|
||||
///Downloading; [AjaxRequest.responseText] holds partial data.
|
||||
static const LOADING = const AjaxRequestReadyState._internal(3);
|
||||
|
||||
///The operation is complete.
|
||||
static const DONE = const AjaxRequestReadyState._internal(4);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,308 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import '../pull_to_refresh/main.dart';
|
||||
import 'underline_style.dart';
|
||||
import 'attributed_string_text_effect_style.dart';
|
||||
import '../util.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.
|
||||
///Use this attribute to specify the color of the background area behind the text.
|
||||
///If you do not specify this attribute, no background color is drawn.
|
||||
Color? backgroundColor;
|
||||
|
||||
///The vertical offset for the position of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating point value indicating the character’s offset from the baseline, in points.
|
||||
///The default value is `0`.
|
||||
double? baselineOffset;
|
||||
|
||||
///The expansion factor of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating point value indicating the log of the expansion factor to be applied to glyphs.
|
||||
///The default value is `0`, indicating no expansion.
|
||||
double? expansion;
|
||||
|
||||
///The color of the text.
|
||||
///
|
||||
///The value of this attribute is a [Color] object.
|
||||
///Use this attribute to specify the color of the text during rendering.
|
||||
///If you do not specify this attribute, the text is rendered in black.
|
||||
Color? foregroundColor;
|
||||
|
||||
///The kerning of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating-point value.
|
||||
///This value specifies the number of points by which to adjust kern-pair characters.
|
||||
///Kerning prevents unwanted space from occurring between specific characters and depends on the font.
|
||||
///The value `0` means kerning is disabled. The default value for this attribute is `0`.
|
||||
double? kern;
|
||||
|
||||
///The ligature of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing an integer.
|
||||
///Ligatures cause specific character combinations to be rendered using a single custom glyph that corresponds to those characters.
|
||||
///The value `0` indicates no ligatures. The value `1` indicates the use of the default ligatures.
|
||||
///The value `2` indicates the use of all ligatures.
|
||||
///The default value for this attribute is `1`. (Value `2` is unsupported on iOS.)
|
||||
int? ligature;
|
||||
|
||||
///The obliqueness of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating point value indicating skew to be applied to glyphs.
|
||||
///The default value is `0`, indicating no skew.
|
||||
double? obliqueness;
|
||||
|
||||
///The color of the strikethrough.
|
||||
///
|
||||
///The value of this attribute is a [Color] object. The default value is `null`, indicating same as foreground color.
|
||||
Color? strikethroughColor;
|
||||
|
||||
///The strikethrough style of the text.
|
||||
///
|
||||
///This value indicates whether the text has a line through it and corresponds to one of the constants described in [UnderlineStyle].
|
||||
///The default value for this attribute is [UnderlineStyle.STYLE_NONE].
|
||||
UnderlineStyle? strikethroughStyle;
|
||||
|
||||
///The color of the stroke.
|
||||
///
|
||||
///The value of this parameter is a [Color] object.
|
||||
///If it is not defined (which is the case by default), it is assumed to be the same as the value of foregroundColor;
|
||||
///otherwise, it describes the outline color.
|
||||
Color? strokeColor;
|
||||
|
||||
///The width of the stroke.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating-point value.
|
||||
///This value represents the amount to change the stroke width and is specified as a percentage of the font point size.
|
||||
///Specify `0` (the default) for no additional changes.
|
||||
///Specify positive values to change the stroke width alone.
|
||||
///Specify negative values to stroke and fill the text.
|
||||
///For example, a typical value for outlined text would be `3.0`.
|
||||
double? strokeWidth;
|
||||
|
||||
///The text effect.
|
||||
///
|
||||
///The value of this attribute is a [AttributedStringTextEffectStyle] object.
|
||||
///The default value of this property is `null`, indicating no text effect.
|
||||
AttributedStringTextEffectStyle? textEffect;
|
||||
|
||||
///The color of the underline.
|
||||
///
|
||||
///The value of this attribute is a [Color] object.
|
||||
///The default value is `null`, indicating same as foreground color.
|
||||
Color? underlineColor;
|
||||
|
||||
///The underline style of the text.
|
||||
///
|
||||
///This value indicates whether the text is underlined and corresponds to one of the constants described in [UnderlineStyle].
|
||||
///The default value for this attribute is [UnderlineStyle.STYLE_NONE].
|
||||
UnderlineStyle? underlineStyle;
|
||||
|
||||
AttributedString({
|
||||
required this.string,
|
||||
this.backgroundColor,
|
||||
this.baselineOffset,
|
||||
this.expansion,
|
||||
this.foregroundColor,
|
||||
this.kern,
|
||||
this.ligature,
|
||||
this.obliqueness,
|
||||
this.strikethroughColor,
|
||||
this.strikethroughStyle,
|
||||
this.strokeColor,
|
||||
this.strokeWidth,
|
||||
this.textEffect,
|
||||
this.underlineColor,
|
||||
this.underlineStyle,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"string": this.string,
|
||||
"backgroundColor": this.backgroundColor?.toHex(),
|
||||
"baselineOffset": this.baselineOffset,
|
||||
"expansion": this.expansion,
|
||||
"foregroundColor": this.foregroundColor?.toHex(),
|
||||
"kern": this.kern,
|
||||
"ligature": this.ligature,
|
||||
"obliqueness": this.obliqueness,
|
||||
"strikethroughColor": this.strikethroughColor?.toHex(),
|
||||
"strikethroughStyle": this.strikethroughStyle?.toValue(),
|
||||
"strokeColor": this.strokeColor?.toHex(),
|
||||
"strokeWidth": this.strokeWidth,
|
||||
"textEffect": this.textEffect?.toValue(),
|
||||
"underlineColor": this.underlineColor?.toHex(),
|
||||
"underlineStyle": this.underlineStyle?.toValue(),
|
||||
};
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
||||
|
||||
///An iOS-specific class that represents a string with associated attributes
|
||||
///used by the [PullToRefreshController] and [PullToRefreshOptions] classes.
|
||||
///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.
|
||||
///Use this attribute to specify the color of the background area behind the text.
|
||||
///If you do not specify this attribute, no background color is drawn.
|
||||
Color? backgroundColor;
|
||||
|
||||
///The vertical offset for the position of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating point value indicating the character’s offset from the baseline, in points.
|
||||
///The default value is `0`.
|
||||
double? baselineOffset;
|
||||
|
||||
///The expansion factor of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating point value indicating the log of the expansion factor to be applied to glyphs.
|
||||
///The default value is `0`, indicating no expansion.
|
||||
double? expansion;
|
||||
|
||||
///The color of the text.
|
||||
///
|
||||
///The value of this attribute is a [Color] object.
|
||||
///Use this attribute to specify the color of the text during rendering.
|
||||
///If you do not specify this attribute, the text is rendered in black.
|
||||
Color? foregroundColor;
|
||||
|
||||
///The kerning of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating-point value.
|
||||
///This value specifies the number of points by which to adjust kern-pair characters.
|
||||
///Kerning prevents unwanted space from occurring between specific characters and depends on the font.
|
||||
///The value `0` means kerning is disabled. The default value for this attribute is `0`.
|
||||
double? kern;
|
||||
|
||||
///The ligature of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing an integer.
|
||||
///Ligatures cause specific character combinations to be rendered using a single custom glyph that corresponds to those characters.
|
||||
///The value `0` indicates no ligatures. The value `1` indicates the use of the default ligatures.
|
||||
///The value `2` indicates the use of all ligatures.
|
||||
///The default value for this attribute is `1`. (Value `2` is unsupported on iOS.)
|
||||
int? ligature;
|
||||
|
||||
///The obliqueness of the text.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating point value indicating skew to be applied to glyphs.
|
||||
///The default value is `0`, indicating no skew.
|
||||
double? obliqueness;
|
||||
|
||||
///The color of the strikethrough.
|
||||
///
|
||||
///The value of this attribute is a [Color] object. The default value is `null`, indicating same as foreground color.
|
||||
Color? strikethroughColor;
|
||||
|
||||
///The strikethrough style of the text.
|
||||
///
|
||||
///This value indicates whether the text has a line through it and corresponds to one of the constants described in [IOSNSUnderlineStyle].
|
||||
///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE].
|
||||
IOSNSUnderlineStyle? strikethroughStyle;
|
||||
|
||||
///The color of the stroke.
|
||||
///
|
||||
///The value of this parameter is a [Color] object.
|
||||
///If it is not defined (which is the case by default), it is assumed to be the same as the value of foregroundColor;
|
||||
///otherwise, it describes the outline color.
|
||||
Color? strokeColor;
|
||||
|
||||
///The width of the stroke.
|
||||
///
|
||||
///The value of this attribute is a number containing a floating-point value.
|
||||
///This value represents the amount to change the stroke width and is specified as a percentage of the font point size.
|
||||
///Specify `0` (the default) for no additional changes.
|
||||
///Specify positive values to change the stroke width alone.
|
||||
///Specify negative values to stroke and fill the text.
|
||||
///For example, a typical value for outlined text would be `3.0`.
|
||||
double? strokeWidth;
|
||||
|
||||
///The text effect.
|
||||
///
|
||||
///The value of this attribute is a [IOSNSAttributedStringTextEffectStyle] object.
|
||||
///The default value of this property is `null`, indicating no text effect.
|
||||
IOSNSAttributedStringTextEffectStyle? textEffect;
|
||||
|
||||
///The color of the underline.
|
||||
///
|
||||
///The value of this attribute is a [Color] object.
|
||||
///The default value is `null`, indicating same as foreground color.
|
||||
Color? underlineColor;
|
||||
|
||||
///The underline style of the text.
|
||||
///
|
||||
///This value indicates whether the text is underlined and corresponds to one of the constants described in [IOSNSUnderlineStyle].
|
||||
///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE].
|
||||
IOSNSUnderlineStyle? underlineStyle;
|
||||
|
||||
IOSNSAttributedString({
|
||||
required this.string,
|
||||
this.backgroundColor,
|
||||
this.baselineOffset,
|
||||
this.expansion,
|
||||
this.foregroundColor,
|
||||
this.kern,
|
||||
this.ligature,
|
||||
this.obliqueness,
|
||||
this.strikethroughColor,
|
||||
this.strikethroughStyle,
|
||||
this.strokeColor,
|
||||
this.strokeWidth,
|
||||
this.textEffect,
|
||||
this.underlineColor,
|
||||
this.underlineStyle,
|
||||
});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"string": this.string,
|
||||
"backgroundColor": this.backgroundColor?.toHex(),
|
||||
"baselineOffset": this.baselineOffset,
|
||||
"expansion": this.expansion,
|
||||
"foregroundColor": this.foregroundColor?.toHex(),
|
||||
"kern": this.kern,
|
||||
"ligature": this.ligature,
|
||||
"obliqueness": this.obliqueness,
|
||||
"strikethroughColor": this.strikethroughColor?.toHex(),
|
||||
"strikethroughStyle": this.strikethroughStyle?.toValue(),
|
||||
"strokeColor": this.strokeColor?.toHex(),
|
||||
"strokeWidth": this.strokeWidth,
|
||||
"textEffect": this.textEffect?.toValue(),
|
||||
"underlineColor": this.underlineColor?.toHex(),
|
||||
"underlineStyle": this.underlineStyle?.toValue(),
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
///Class that represents the supported proxy types.
|
||||
class AttributedStringTextEffectStyle {
|
||||
final String _value;
|
||||
|
||||
const AttributedStringTextEffectStyle._internal(this._value);
|
||||
|
||||
///Set of all values of [AttributedStringTextEffectStyle].
|
||||
static final Set<AttributedStringTextEffectStyle> values = [
|
||||
AttributedStringTextEffectStyle.LETTERPRESS_STYLE,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [AttributedStringTextEffectStyle] instance from a [String] value.
|
||||
static AttributedStringTextEffectStyle? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return AttributedStringTextEffectStyle.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper.
|
||||
static const LETTERPRESS_STYLE =
|
||||
const AttributedStringTextEffectStyle._internal("letterpressStyle");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An iOS-specific Class that represents the supported proxy types.
|
||||
///Use [AttributedStringTextEffectStyle] instead.
|
||||
@Deprecated("Use AttributedStringTextEffectStyle instead")
|
||||
class IOSNSAttributedStringTextEffectStyle {
|
||||
final String _value;
|
||||
|
||||
const IOSNSAttributedStringTextEffectStyle._internal(this._value);
|
||||
|
||||
///Set of all values of [IOSNSAttributedStringTextEffectStyle].
|
||||
static final Set<IOSNSAttributedStringTextEffectStyle> values = [
|
||||
IOSNSAttributedStringTextEffectStyle.LETTERPRESS_STYLE,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [IOSNSAttributedStringTextEffectStyle] instance from a [String] value.
|
||||
static IOSNSAttributedStringTextEffectStyle? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return IOSNSAttributedStringTextEffectStyle.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper.
|
||||
static const LETTERPRESS_STYLE =
|
||||
const IOSNSAttributedStringTextEffectStyle._internal("letterpressStyle");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
///Class used to override the way the cache is used.
|
||||
class CacheMode {
|
||||
final int _value;
|
||||
|
||||
const CacheMode._internal(this._value);
|
||||
|
||||
///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,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [CacheMode] instance from an [int] value.
|
||||
static CacheMode? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return CacheMode.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "LOAD_CACHE_ELSE_NETWORK";
|
||||
case 2:
|
||||
return "LOAD_NO_CACHE";
|
||||
case 3:
|
||||
return "LOAD_CACHE_ONLY";
|
||||
case -1:
|
||||
default:
|
||||
return "LOAD_DEFAULT";
|
||||
}
|
||||
}
|
||||
|
||||
///Default cache usage mode. If the navigation type doesn't impose any specific behavior,
|
||||
///use cached resources when they are available and not expired, otherwise load resources from the network.
|
||||
static const LOAD_DEFAULT = const CacheMode._internal(-1);
|
||||
|
||||
///Use cached resources when they are available, even if they have expired. Otherwise load resources from the network.
|
||||
static const LOAD_CACHE_ELSE_NETWORK = const CacheMode._internal(1);
|
||||
|
||||
///Don't use the cache, load from the network.
|
||||
static const LOAD_NO_CACHE = const CacheMode._internal(2);
|
||||
|
||||
///Don't use the network, load from the cache.
|
||||
static const LOAD_CACHE_ONLY = const CacheMode._internal(3);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An Android-specific class used to override the way the cache is used.
|
||||
///Use [CacheMode] instead.
|
||||
@Deprecated("Use CacheMode instead")
|
||||
class AndroidCacheMode {
|
||||
final int _value;
|
||||
|
||||
const AndroidCacheMode._internal(this._value);
|
||||
|
||||
///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,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [AndroidCacheMode] instance from an [int] value.
|
||||
static AndroidCacheMode? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return AndroidCacheMode.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "LOAD_CACHE_ELSE_NETWORK";
|
||||
case 2:
|
||||
return "LOAD_NO_CACHE";
|
||||
case 3:
|
||||
return "LOAD_CACHE_ONLY";
|
||||
case -1:
|
||||
default:
|
||||
return "LOAD_DEFAULT";
|
||||
}
|
||||
}
|
||||
|
||||
///Default cache usage mode. If the navigation type doesn't impose any specific behavior,
|
||||
///use cached resources when they are available and not expired, otherwise load resources from the network.
|
||||
static const LOAD_DEFAULT = const AndroidCacheMode._internal(-1);
|
||||
|
||||
///Use cached resources when they are available, even if they have expired. Otherwise load resources from the network.
|
||||
static const LOAD_CACHE_ELSE_NETWORK = const AndroidCacheMode._internal(1);
|
||||
|
||||
///Don't use the cache, load from the network.
|
||||
static const LOAD_NO_CACHE = const AndroidCacheMode._internal(2);
|
||||
|
||||
///Don't use the network, load from the cache.
|
||||
static const LOAD_CACHE_ONLY = const AndroidCacheMode._internal(3);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
import '../in_app_webview/in_app_webview_controller.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});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"value": value, "error": error};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
import 'url_authentication_challenge.dart';
|
||||
import 'url_protection_space.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.
|
||||
///
|
||||
///**NOTE**: available only on Android.
|
||||
List<String>? principals;
|
||||
|
||||
///Use [keyTypes] instead.
|
||||
@Deprecated('Use keyTypes instead')
|
||||
List<String>? androidKeyTypes;
|
||||
|
||||
///Returns the acceptable types of asymmetric keys.
|
||||
///
|
||||
///**NOTE**: available only on Android.
|
||||
List<String>? keyTypes;
|
||||
|
||||
ClientCertChallenge(
|
||||
{required URLProtectionSpace protectionSpace,
|
||||
@Deprecated('Use principals instead') this.androidPrincipals,
|
||||
this.principals,
|
||||
@Deprecated('Use keyTypes instead') this.androidKeyTypes,
|
||||
this.keyTypes})
|
||||
: super(protectionSpace: protectionSpace) {
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.principals = this.principals ?? this.androidPrincipals;
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.keyTypes = this.keyTypes ?? this.androidKeyTypes;
|
||||
}
|
||||
|
||||
///Gets a possible [ClientCertChallenge] instance from a [Map] value.
|
||||
static ClientCertChallenge? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return ClientCertChallenge(
|
||||
protectionSpace: URLProtectionSpace.fromMap(
|
||||
map["protectionSpace"].cast<String, dynamic>())!,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidPrincipals: map["principals"]?.cast<String>(),
|
||||
principals: map["principals"]?.cast<String>(),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidKeyTypes: map["keyTypes"]?.cast<String>(),
|
||||
keyTypes: map["keyTypes"]?.cast<String>());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
import 'client_cert_response_action.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;
|
||||
|
||||
///Use [keyStoreType] instead.
|
||||
@Deprecated('Use keyStoreType instead')
|
||||
String? androidKeyStoreType;
|
||||
|
||||
///An Android-specific property used by Java [KeyStore](https://developer.android.com/reference/java/security/KeyStore) class to get the instance.
|
||||
String? keyStoreType;
|
||||
|
||||
///Indicate the [ClientCertResponseAction] to take in response of the client certificate challenge.
|
||||
ClientCertResponseAction? action;
|
||||
|
||||
ClientCertResponse(
|
||||
{required this.certificatePath,
|
||||
this.certificatePassword = "",
|
||||
@Deprecated('Use keyStoreType instead')
|
||||
this.androidKeyStoreType = "PKCS12",
|
||||
this.keyStoreType = "PKCS12",
|
||||
this.action = ClientCertResponseAction.CANCEL}) {
|
||||
if (this.action == ClientCertResponseAction.PROCEED)
|
||||
assert(certificatePath.isNotEmpty);
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.keyStoreType = this.keyStoreType ?? this.androidKeyStoreType;
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"certificatePath": certificatePath,
|
||||
"certificatePassword": certificatePassword,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"androidKeyStoreType": keyStoreType ?? androidKeyStoreType,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"keyStoreType": keyStoreType ?? androidKeyStoreType,
|
||||
"action": action?.toValue()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import 'client_cert_response.dart';
|
||||
|
||||
///Class used by [ClientCertResponse] class.
|
||||
class ClientCertResponseAction {
|
||||
final int _value;
|
||||
|
||||
const ClientCertResponseAction._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Cancel this request.
|
||||
static const CANCEL = const ClientCertResponseAction._internal(0);
|
||||
|
||||
///Proceed with the specified certificate.
|
||||
static const PROCEED = const ClientCertResponseAction._internal(1);
|
||||
|
||||
///Ignore the request for now.
|
||||
static const IGNORE = const ClientCertResponseAction._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
///Class that represents the known formats a bitmap can be compressed into.
|
||||
class CompressFormat {
|
||||
final String _value;
|
||||
|
||||
const CompressFormat._internal(this._value);
|
||||
|
||||
///Set of all values of [CompressFormat].
|
||||
static final Set<CompressFormat> values = [
|
||||
CompressFormat.JPEG,
|
||||
CompressFormat.PNG,
|
||||
CompressFormat.WEBP,
|
||||
CompressFormat.WEBP_LOSSY,
|
||||
CompressFormat.WEBP_LOSSLESS,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [CompressFormat] instance from a [String] value.
|
||||
static CompressFormat? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return CompressFormat.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///Compress to the `PNG` format.
|
||||
///PNG is lossless, so `quality` is ignored.
|
||||
static const PNG = const CompressFormat._internal("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 = const CompressFormat._internal("JPEG");
|
||||
|
||||
///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.
|
||||
static const WEBP = const CompressFormat._internal("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 = const CompressFormat._internal("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.
|
||||
///`100` means to spend more time compressing, resulting in a smaller file.
|
||||
///
|
||||
///**NOTE**: available only on Android.
|
||||
///
|
||||
///**NOTE for Android**: available on Android 30+.
|
||||
static const WEBP_LOSSLESS = const CompressFormat._internal("WEBP_LOSSLESS");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
import 'console_message_level.dart';
|
||||
|
||||
///Class representing a JavaScript console message from WebCore.
|
||||
///This could be a issued by a call to one of the console logging functions (e.g. console.log('...')) or a JavaScript error on the page.
|
||||
///
|
||||
///To receive notifications of these messages, use the [WebView.onConsoleMessage] event.
|
||||
class ConsoleMessage {
|
||||
///Console message
|
||||
String message;
|
||||
|
||||
///Console messsage level
|
||||
ConsoleMessageLevel messageLevel;
|
||||
|
||||
ConsoleMessage(
|
||||
{this.message = "", this.messageLevel = ConsoleMessageLevel.LOG});
|
||||
|
||||
///Gets a possible [ConsoleMessage] instance from a [Map] value.
|
||||
static ConsoleMessage? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return ConsoleMessage(
|
||||
message: map["message"],
|
||||
messageLevel: ConsoleMessageLevel.fromValue(map["messageLevel"]) ??
|
||||
ConsoleMessageLevel.LOG,
|
||||
);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"message": message, "messageLevel": messageLevel.toValue()};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
///Class representing the level of a console message.
|
||||
class ConsoleMessageLevel {
|
||||
final int _value;
|
||||
|
||||
const ConsoleMessageLevel._internal(this._value);
|
||||
|
||||
///Set of all values of [ConsoleMessageLevel].
|
||||
static final Set<ConsoleMessageLevel> values = [
|
||||
ConsoleMessageLevel.TIP,
|
||||
ConsoleMessageLevel.LOG,
|
||||
ConsoleMessageLevel.WARNING,
|
||||
ConsoleMessageLevel.ERROR,
|
||||
ConsoleMessageLevel.DEBUG,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [ConsoleMessageLevel] instance from an [int] value.
|
||||
static ConsoleMessageLevel? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return ConsoleMessageLevel.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 0:
|
||||
return "TIP";
|
||||
case 2:
|
||||
return "WARNING";
|
||||
case 3:
|
||||
return "ERROR";
|
||||
case 4:
|
||||
return "DEBUG";
|
||||
case 1:
|
||||
default:
|
||||
return "LOG";
|
||||
}
|
||||
}
|
||||
|
||||
///Console TIP level
|
||||
static const TIP = const ConsoleMessageLevel._internal(0);
|
||||
|
||||
///Console LOG level
|
||||
static const LOG = const ConsoleMessageLevel._internal(1);
|
||||
|
||||
///Console WARNING level
|
||||
static const WARNING = const ConsoleMessageLevel._internal(2);
|
||||
|
||||
///Console ERROR level
|
||||
static const ERROR = const ConsoleMessageLevel._internal(3);
|
||||
|
||||
///Console DEBUG level
|
||||
static const DEBUG = const ConsoleMessageLevel._internal(4);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
import '../content_blocker.dart';
|
||||
|
||||
///Class that represents the kind of action that can be used with a [ContentBlockerTrigger].
|
||||
class ContentBlockerActionType {
|
||||
final String _value;
|
||||
|
||||
const ContentBlockerActionType._internal(this._value);
|
||||
|
||||
///Set of all values of [ContentBlockerActionType].
|
||||
static final Set<ContentBlockerActionType> values = [
|
||||
ContentBlockerActionType.BLOCK,
|
||||
ContentBlockerActionType.CSS_DISPLAY_NONE,
|
||||
ContentBlockerActionType.MAKE_HTTPS,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [ContentBlockerActionType] instance from a [String] value.
|
||||
static ContentBlockerActionType? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return ContentBlockerActionType.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///Stops loading of the resource. If the resource was cached, the cache is ignored.
|
||||
static const BLOCK = const ContentBlockerActionType._internal('block');
|
||||
|
||||
///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.
|
||||
///
|
||||
///**NOTE**: on Android, JavaScript must be enabled.
|
||||
static const CSS_DISPLAY_NONE =
|
||||
const ContentBlockerActionType._internal('css-display-none');
|
||||
|
||||
///Changes a URL from http to https. URLs with a specified (nondefault) port and links using other protocols are unaffected.
|
||||
static const MAKE_HTTPS =
|
||||
const ContentBlockerActionType._internal('make-https');
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
import '../content_blocker.dart';
|
||||
|
||||
///Class that represents the possible load type for a [ContentBlockerTrigger].
|
||||
class ContentBlockerTriggerLoadType {
|
||||
final String _value;
|
||||
|
||||
const ContentBlockerTriggerLoadType._internal(this._value);
|
||||
|
||||
///Set of all values of [ContentBlockerTriggerLoadType].
|
||||
static final Set<ContentBlockerTriggerLoadType> values = [
|
||||
ContentBlockerTriggerLoadType.FIRST_PARTY,
|
||||
ContentBlockerTriggerLoadType.THIRD_PARTY,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [ContentBlockerTriggerLoadType] instance from a [String] value.
|
||||
static ContentBlockerTriggerLoadType? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return ContentBlockerTriggerLoadType.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///FIRST_PARTY is triggered only if the resource has the same scheme, domain, and port as the main page resource.
|
||||
static const FIRST_PARTY =
|
||||
const ContentBlockerTriggerLoadType._internal('first-party');
|
||||
|
||||
///THIRD_PARTY is triggered if the resource is not from the same domain as the main page resource.
|
||||
static const THIRD_PARTY =
|
||||
const ContentBlockerTriggerLoadType._internal('third-party');
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
import '../content_blocker.dart';
|
||||
|
||||
///Class that represents the possible resource type defined for a [ContentBlockerTrigger].
|
||||
class ContentBlockerTriggerResourceType {
|
||||
final String _value;
|
||||
|
||||
const ContentBlockerTriggerResourceType._internal(this._value);
|
||||
|
||||
///Set of all values of [ContentBlockerTriggerResourceType].
|
||||
static final Set<ContentBlockerTriggerResourceType> values = [
|
||||
ContentBlockerTriggerResourceType.DOCUMENT,
|
||||
ContentBlockerTriggerResourceType.IMAGE,
|
||||
ContentBlockerTriggerResourceType.STYLE_SHEET,
|
||||
ContentBlockerTriggerResourceType.SCRIPT,
|
||||
ContentBlockerTriggerResourceType.FONT,
|
||||
ContentBlockerTriggerResourceType.MEDIA,
|
||||
ContentBlockerTriggerResourceType.SVG_DOCUMENT,
|
||||
ContentBlockerTriggerResourceType.RAW,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [ContentBlockerTriggerResourceType] instance from a [String] value.
|
||||
static ContentBlockerTriggerResourceType? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return ContentBlockerTriggerResourceType.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
static const DOCUMENT =
|
||||
const ContentBlockerTriggerResourceType._internal('document');
|
||||
static const IMAGE =
|
||||
const ContentBlockerTriggerResourceType._internal('image');
|
||||
static const STYLE_SHEET =
|
||||
const ContentBlockerTriggerResourceType._internal('style-sheet');
|
||||
static const SCRIPT =
|
||||
const ContentBlockerTriggerResourceType._internal('script');
|
||||
static const FONT = const ContentBlockerTriggerResourceType._internal('font');
|
||||
static const MEDIA =
|
||||
const ContentBlockerTriggerResourceType._internal('media');
|
||||
static const SVG_DOCUMENT =
|
||||
const ContentBlockerTriggerResourceType._internal('svg-document');
|
||||
|
||||
///Any untyped load
|
||||
static const RAW = const ContentBlockerTriggerResourceType._internal('raw');
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
final _contentWorldNameRegExp = RegExp(r'[\s]');
|
||||
|
||||
///Class that represents an object that defines a scope of execution for JavaScript code and which you use to prevent conflicts between different scripts.
|
||||
///
|
||||
///**NOTE for iOS**: available on iOS 14.0+. This class represents the native [WKContentWorld](https://developer.apple.com/documentation/webkit/wkcontentworld) class.
|
||||
///
|
||||
///**NOTE for Android**: it will create and append an `<iframe>` HTML element with `id` attribute equals to `flutter_inappwebview_[name]`
|
||||
///to the webpage's content that contains only the inline `<script>` HTML elements in order to define a new scope of execution for JavaScript code.
|
||||
///Unfortunately, there isn't any other way to do it.
|
||||
///There are some limitations:
|
||||
///- for any [ContentWorld], except [ContentWorld.PAGE] (that is the webpage itself), if you need to access to the `window` or `document` global Object,
|
||||
///you need to use `window.top` and `window.top.document` because the code runs inside an `<iframe>`;
|
||||
///- also, the execution of the inline `<script>` could be blocked by the `Content-Security-Policy` header.
|
||||
class ContentWorld {
|
||||
///The name of a custom content world.
|
||||
///It cannot contain space characters.
|
||||
final String name;
|
||||
|
||||
///Returns the custom content world with the specified name.
|
||||
ContentWorld.world({required this.name}) {
|
||||
// WINDOW-ID- is used internally by the plugin!
|
||||
assert(!this.name.startsWith("WINDOW-ID-") &&
|
||||
!this.name.contains(_contentWorldNameRegExp));
|
||||
}
|
||||
|
||||
///The default world for clients.
|
||||
// ignore: non_constant_identifier_names
|
||||
static final ContentWorld DEFAULT_CLIENT =
|
||||
ContentWorld.world(name: "defaultClient");
|
||||
|
||||
///The content world for the current webpage’s content.
|
||||
///This property contains the content world for scripts that the current webpage executes.
|
||||
///Be careful when manipulating variables in this content world.
|
||||
///If you modify a variable with the same name as one the webpage uses, you may unintentionally disrupt the normal operation of that page.
|
||||
// ignore: non_constant_identifier_names
|
||||
static final ContentWorld PAGE = ContentWorld.world(name: "page");
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"name": name};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
import '../cookie_manager.dart';
|
||||
import 'http_cookie_same_site_policy.dart';
|
||||
|
||||
///Class that represents a cookie returned by the [CookieManager].
|
||||
class Cookie {
|
||||
///The cookie name.
|
||||
String name;
|
||||
|
||||
///The cookie value.
|
||||
dynamic value;
|
||||
|
||||
///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.
|
||||
///
|
||||
///**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;
|
||||
|
||||
///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.
|
||||
///
|
||||
///**NOTE**: on Android it will be always `null`.
|
||||
bool? isHttpOnly;
|
||||
|
||||
///The cookie path.
|
||||
///
|
||||
///**NOTE**: on Android it will be always `null`.
|
||||
String? path;
|
||||
|
||||
Cookie(
|
||||
{required this.name,
|
||||
required this.value,
|
||||
this.expiresDate,
|
||||
this.isSessionOnly,
|
||||
this.domain,
|
||||
this.sameSite,
|
||||
this.isSecure,
|
||||
this.isHttpOnly,
|
||||
this.path});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"name": name,
|
||||
"value": value,
|
||||
"expiresDate": expiresDate,
|
||||
"isSessionOnly": isSessionOnly,
|
||||
"domain": domain,
|
||||
"sameSite": sameSite?.toValue(),
|
||||
"isSecure": isSecure,
|
||||
"isHttpOnly": isHttpOnly,
|
||||
"path": path
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,158 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
import 'navigation_action.dart';
|
||||
import 'window_features.dart';
|
||||
import 'url_request.dart';
|
||||
import 'frame_info.dart';
|
||||
import 'navigation_type.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;
|
||||
|
||||
///Indicates if the new window should be a dialog, rather than a full-size window.
|
||||
///
|
||||
///**NOTE**: available only on Android.
|
||||
bool? isDialog;
|
||||
|
||||
///Use [windowFeatures] instead.
|
||||
@Deprecated("Use windowFeatures instead")
|
||||
IOSWKWindowFeatures? iosWindowFeatures;
|
||||
|
||||
///Window features requested by the webpage.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
WindowFeatures? windowFeatures;
|
||||
|
||||
CreateWindowAction(
|
||||
{required this.windowId,
|
||||
@Deprecated('Use isDialog instead')
|
||||
this.androidIsDialog,
|
||||
this.isDialog,
|
||||
@Deprecated('Use windowFeatures instead')
|
||||
this.iosWindowFeatures,
|
||||
this.windowFeatures,
|
||||
required URLRequest request,
|
||||
required bool isForMainFrame,
|
||||
@Deprecated('Use hasGesture instead')
|
||||
bool? androidHasGesture,
|
||||
@Deprecated('Use isRedirect instead')
|
||||
bool? androidIsRedirect,
|
||||
bool? hasGesture,
|
||||
bool? isRedirect,
|
||||
@Deprecated('Use navigationType instead')
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKNavigationType? iosWKNavigationType,
|
||||
NavigationType? navigationType,
|
||||
@Deprecated('Use sourceFrame instead')
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKFrameInfo? iosSourceFrame,
|
||||
FrameInfo? sourceFrame,
|
||||
@Deprecated('Use targetFrame instead')
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKFrameInfo? iosTargetFrame,
|
||||
FrameInfo? targetFrame})
|
||||
: super(
|
||||
request: request,
|
||||
isForMainFrame: isForMainFrame,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidHasGesture: hasGesture ?? androidHasGesture,
|
||||
hasGesture: hasGesture ?? androidHasGesture,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidIsRedirect: isRedirect ?? androidIsRedirect,
|
||||
isRedirect: isRedirect ?? androidIsRedirect,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosWKNavigationType:
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKNavigationType.fromValue(navigationType?.toValue()) ??
|
||||
iosWKNavigationType,
|
||||
navigationType: navigationType ??
|
||||
NavigationType.fromValue(iosWKNavigationType?.toValue()),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosSourceFrame:
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKFrameInfo.fromMap(sourceFrame?.toMap()) ?? iosSourceFrame,
|
||||
sourceFrame:
|
||||
sourceFrame ?? FrameInfo.fromMap(iosSourceFrame?.toMap()),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosTargetFrame:
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKFrameInfo.fromMap(targetFrame?.toMap()) ?? iosTargetFrame,
|
||||
targetFrame:
|
||||
targetFrame ?? FrameInfo.fromMap(iosTargetFrame?.toMap())) {
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.isDialog = this.isDialog ?? this.androidIsDialog;
|
||||
this.windowFeatures = this.windowFeatures ??
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
WindowFeatures.fromMap(this.iosWindowFeatures?.toMap());
|
||||
}
|
||||
|
||||
///Gets a possible [CreateWindowAction] instance from a [Map] value.
|
||||
static CreateWindowAction? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return CreateWindowAction(
|
||||
windowId: map["windowId"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidIsDialog: map["isDialog"] ?? map["androidIsDialog"],
|
||||
isDialog: map["isDialog"] ?? map["androidIsDialog"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosWindowFeatures: IOSWKWindowFeatures.fromMap(
|
||||
map["windowFeatures"]?.cast<String, dynamic>()),
|
||||
windowFeatures: WindowFeatures.fromMap(
|
||||
map["windowFeatures"]?.cast<String, dynamic>()),
|
||||
request: URLRequest.fromMap(map["request"].cast<String, dynamic>())!,
|
||||
isForMainFrame: map["isForMainFrame"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidHasGesture: map["hasGesture"],
|
||||
hasGesture: map["hasGesture"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidIsRedirect: map["isRedirect"],
|
||||
isRedirect: map["isRedirect"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosWKNavigationType:
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKNavigationType.fromValue(map["navigationType"]),
|
||||
navigationType: NavigationType.fromValue(map["navigationType"]),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosSourceFrame:
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKFrameInfo.fromMap(map["sourceFrame"]?.cast<String, dynamic>()),
|
||||
sourceFrame:
|
||||
FrameInfo.fromMap(map["sourceFrame"]?.cast<String, dynamic>()),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosTargetFrame:
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKFrameInfo.fromMap(map["targetFrame"]?.cast<String, dynamic>()),
|
||||
targetFrame:
|
||||
FrameInfo.fromMap(map["targetFrame"]?.cast<String, dynamic>()));
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toMap() {
|
||||
var createWindowActionMap = super.toMap();
|
||||
createWindowActionMap.addAll({
|
||||
"windowId": windowId,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"androidIsDialog": isDialog ?? androidIsDialog,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"isDialog": isDialog ?? androidIsDialog,
|
||||
"iosWindowFeatures":
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
windowFeatures?.toMap() ?? iosWindowFeatures?.toMap(),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"windowFeatures": windowFeatures?.toMap() ?? iosWindowFeatures?.toMap(),
|
||||
});
|
||||
return createWindowActionMap;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
import 'script_html_tag_attributes.dart';
|
||||
import 'css_link_html_tag_attributes.dart';
|
||||
|
||||
///Class that represents the `crossorigin` content attribute on media elements, which is a CORS settings attribute.
|
||||
///It could be used with [ScriptHtmlTagAttributes] and [CSSLinkHtmlTagAttributes]
|
||||
///when fetching a resource `<link>` or a `<script>` (or resources fetched by the `<script>`).
|
||||
class CrossOrigin {
|
||||
final String _value;
|
||||
|
||||
const CrossOrigin._internal(this._value);
|
||||
|
||||
///Set of all values of [CrossOrigin].
|
||||
static final Set<CrossOrigin> values = [
|
||||
CrossOrigin.ANONYMOUS,
|
||||
CrossOrigin.USE_CREDENTIALS,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [CrossOrigin] instance from a [String] value.
|
||||
static CrossOrigin? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return CrossOrigin.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///CORS requests for this element will have the credentials flag set to 'same-origin'.
|
||||
static const ANONYMOUS = const CrossOrigin._internal("anonymous");
|
||||
|
||||
///CORS requests for this element will have the credentials flag set to 'include'.
|
||||
static const USE_CREDENTIALS = const CrossOrigin._internal("use-credentials");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
import '../in_app_webview/in_app_webview_controller.dart';
|
||||
import 'cross_origin.dart';
|
||||
import 'referrer_policy.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;
|
||||
|
||||
///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.
|
||||
///
|
||||
///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 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.crossOrigin,
|
||||
this.integrity,
|
||||
this.referrerPolicy,
|
||||
this.disabled,
|
||||
this.alternate,
|
||||
this.title});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"id": this.id,
|
||||
"media": this.media,
|
||||
"crossOrigin": this.crossOrigin?.toValue(),
|
||||
"integrity": this.integrity,
|
||||
"referrerPolicy": this.referrerPolicy?.toValue(),
|
||||
"disabled": this.disabled,
|
||||
"alternate": this.alternate,
|
||||
"title": this.title,
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import '../in_app_webview/webview.dart';
|
||||
|
||||
///Class representing the response returned by the [WebView.onLoadResourceCustomScheme] 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-Type of the data, such as `image/png`.
|
||||
String contentType;
|
||||
|
||||
///Content-Encoding of the data, such as `utf-8`.
|
||||
String contentEncoding;
|
||||
|
||||
CustomSchemeResponse(
|
||||
{required this.data,
|
||||
required this.contentType,
|
||||
this.contentEncoding = 'utf-8'});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'contentType': contentType,
|
||||
'contentEncoding': contentEncoding,
|
||||
'data': data
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
///Class representing the share state that should be applied to the custom tab.
|
||||
class CustomTabsShareState {
|
||||
final int _value;
|
||||
|
||||
const CustomTabsShareState._internal(this._value);
|
||||
|
||||
///Set of all values of [CustomTabsShareState].
|
||||
static final Set<CustomTabsShareState> values = [
|
||||
CustomTabsShareState.SHARE_STATE_DEFAULT,
|
||||
CustomTabsShareState.SHARE_STATE_ON,
|
||||
CustomTabsShareState.SHARE_STATE_OFF,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [CustomTabsShareState] instance from an [int] value.
|
||||
static CustomTabsShareState? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return CustomTabsShareState.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "SHARE_STATE_ON";
|
||||
case 2:
|
||||
return "SHARE_STATE_OFF";
|
||||
case 0:
|
||||
default:
|
||||
return "SHARE_STATE_DEFAULT";
|
||||
}
|
||||
}
|
||||
|
||||
///Applies the default share settings depending on the browser.
|
||||
static const SHARE_STATE_DEFAULT = const CustomTabsShareState._internal(0);
|
||||
|
||||
///Shows a share option in the tab.
|
||||
static const SHARE_STATE_ON = const CustomTabsShareState._internal(1);
|
||||
|
||||
///Explicitly does not show a share option in the tab.
|
||||
static const SHARE_STATE_OFF = const CustomTabsShareState._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
///Class used to specify a `dataDetectoryTypes` value that adds interactivity to web content that matches the value.
|
||||
class DataDetectorTypes {
|
||||
final String _value;
|
||||
|
||||
const DataDetectorTypes._internal(this._value);
|
||||
|
||||
///Set of all values of [DataDetectorTypes].
|
||||
static final Set<DataDetectorTypes> values = [
|
||||
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,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [DataDetectorTypes] instance from a [String] value.
|
||||
static DataDetectorTypes? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return DataDetectorTypes.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///No detection is performed.
|
||||
static const NONE = const DataDetectorTypes._internal("NONE");
|
||||
|
||||
///Phone numbers are detected and turned into links.
|
||||
static const PHONE_NUMBER = const DataDetectorTypes._internal("PHONE_NUMBER");
|
||||
|
||||
///URLs in text are detected and turned into links.
|
||||
static const LINK = const DataDetectorTypes._internal("LINK");
|
||||
|
||||
///Addresses are detected and turned into links.
|
||||
static const ADDRESS = const DataDetectorTypes._internal("ADDRESS");
|
||||
|
||||
///Dates and times that are in the future are detected and turned into links.
|
||||
static const CALENDAR_EVENT =
|
||||
const DataDetectorTypes._internal("CALENDAR_EVENT");
|
||||
|
||||
///Tracking numbers are detected and turned into links.
|
||||
static const TRACKING_NUMBER =
|
||||
const DataDetectorTypes._internal("TRACKING_NUMBER");
|
||||
|
||||
///Flight numbers are detected and turned into links.
|
||||
static const FLIGHT_NUMBER =
|
||||
const DataDetectorTypes._internal("FLIGHT_NUMBER");
|
||||
|
||||
///Lookup suggestions are detected and turned into links.
|
||||
static const LOOKUP_SUGGESTION =
|
||||
const DataDetectorTypes._internal("LOOKUP_SUGGESTION");
|
||||
|
||||
///Spotlight suggestions are detected and turned into links.
|
||||
static const SPOTLIGHT_SUGGESTION =
|
||||
const DataDetectorTypes._internal("SPOTLIGHT_SUGGESTION");
|
||||
|
||||
///All of the above data types are turned into links when detected. Choosing this value will automatically include any new detection type that is added.
|
||||
static const ALL = const DataDetectorTypes._internal("ALL");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An iOS-specific class used to specify a `dataDetectoryTypes` value that adds interactivity to web content that matches the value.
|
||||
///
|
||||
///**NOTE**: available on iOS 10.0+.
|
||||
///
|
||||
///Use [DataDetectorTypes] instead.
|
||||
@Deprecated("Use DataDetectorTypes instead")
|
||||
class IOSWKDataDetectorTypes {
|
||||
final String _value;
|
||||
|
||||
const IOSWKDataDetectorTypes._internal(this._value);
|
||||
|
||||
///Set of all values of [IOSWKDataDetectorTypes].
|
||||
static final Set<IOSWKDataDetectorTypes> values = [
|
||||
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,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [IOSWKDataDetectorTypes] instance from a [String] value.
|
||||
static IOSWKDataDetectorTypes? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return IOSWKDataDetectorTypes.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///No detection is performed.
|
||||
static const NONE = const IOSWKDataDetectorTypes._internal("NONE");
|
||||
|
||||
///Phone numbers are detected and turned into links.
|
||||
static const PHONE_NUMBER =
|
||||
const IOSWKDataDetectorTypes._internal("PHONE_NUMBER");
|
||||
|
||||
///URLs in text are detected and turned into links.
|
||||
static const LINK = const IOSWKDataDetectorTypes._internal("LINK");
|
||||
|
||||
///Addresses are detected and turned into links.
|
||||
static const ADDRESS = const IOSWKDataDetectorTypes._internal("ADDRESS");
|
||||
|
||||
///Dates and times that are in the future are detected and turned into links.
|
||||
static const CALENDAR_EVENT =
|
||||
const IOSWKDataDetectorTypes._internal("CALENDAR_EVENT");
|
||||
|
||||
///Tracking numbers are detected and turned into links.
|
||||
static const TRACKING_NUMBER =
|
||||
const IOSWKDataDetectorTypes._internal("TRACKING_NUMBER");
|
||||
|
||||
///Flight numbers are detected and turned into links.
|
||||
static const FLIGHT_NUMBER =
|
||||
const IOSWKDataDetectorTypes._internal("FLIGHT_NUMBER");
|
||||
|
||||
///Lookup suggestions are detected and turned into links.
|
||||
static const LOOKUP_SUGGESTION =
|
||||
const IOSWKDataDetectorTypes._internal("LOOKUP_SUGGESTION");
|
||||
|
||||
///Spotlight suggestions are detected and turned into links.
|
||||
static const SPOTLIGHT_SUGGESTION =
|
||||
const IOSWKDataDetectorTypes._internal("SPOTLIGHT_SUGGESTION");
|
||||
|
||||
///All of the above data types are turned into links when detected. Choosing this value will automatically include any new detection type that is added.
|
||||
static const ALL = const IOSWKDataDetectorTypes._internal("ALL");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
///Class used to set the custom style for the dismiss button.
|
||||
class DismissButtonStyle {
|
||||
final int _value;
|
||||
|
||||
const DismissButtonStyle._internal(this._value);
|
||||
|
||||
///Set of all values of [DismissButtonStyle].
|
||||
static final Set<DismissButtonStyle> values = [
|
||||
DismissButtonStyle.DONE,
|
||||
DismissButtonStyle.CLOSE,
|
||||
DismissButtonStyle.CANCEL,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [DismissButtonStyle] instance from an [int] value.
|
||||
static DismissButtonStyle? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return DismissButtonStyle.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "CLOSE";
|
||||
case 2:
|
||||
return "CANCEL";
|
||||
case 0:
|
||||
default:
|
||||
return "DONE";
|
||||
}
|
||||
}
|
||||
|
||||
///Makes the button title the localized string "Done".
|
||||
static const DONE = const DismissButtonStyle._internal(0);
|
||||
|
||||
///Makes the button title the localized string "Close".
|
||||
static const CLOSE = const DismissButtonStyle._internal(1);
|
||||
|
||||
///Makes the button title the localized string "Cancel".
|
||||
static const CANCEL = const DismissButtonStyle._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An iOS-specific class used to set the custom style for the dismiss button.
|
||||
///
|
||||
///**NOTE**: available on iOS 11.0+.
|
||||
///
|
||||
///Use [DismissButtonStyle] instead.
|
||||
@Deprecated("Use DismissButtonStyle instead")
|
||||
class IOSSafariDismissButtonStyle {
|
||||
final int _value;
|
||||
|
||||
const IOSSafariDismissButtonStyle._internal(this._value);
|
||||
|
||||
///Set of all values of [IOSSafariDismissButtonStyle].
|
||||
static final Set<IOSSafariDismissButtonStyle> values = [
|
||||
IOSSafariDismissButtonStyle.DONE,
|
||||
IOSSafariDismissButtonStyle.CLOSE,
|
||||
IOSSafariDismissButtonStyle.CANCEL,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [IOSSafariDismissButtonStyle] instance from an [int] value.
|
||||
static IOSSafariDismissButtonStyle? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return IOSSafariDismissButtonStyle.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "CLOSE";
|
||||
case 2:
|
||||
return "CANCEL";
|
||||
case 0:
|
||||
default:
|
||||
return "DONE";
|
||||
}
|
||||
}
|
||||
|
||||
///Makes the button title the localized string "Done".
|
||||
static const DONE = const IOSSafariDismissButtonStyle._internal(0);
|
||||
|
||||
///Makes the button title the localized string "Close".
|
||||
static const CLOSE = const IOSSafariDismissButtonStyle._internal(1);
|
||||
|
||||
///Makes the button title the localized string "Cancel".
|
||||
static const CANCEL = const IOSSafariDismissButtonStyle._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
import '../in_app_webview/webview.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.
|
||||
Uri 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;
|
||||
|
||||
///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;
|
||||
|
||||
DownloadStartRequest(
|
||||
{required this.url,
|
||||
this.userAgent,
|
||||
this.contentDisposition,
|
||||
this.mimeType,
|
||||
required this.contentLength,
|
||||
this.suggestedFilename,
|
||||
this.textEncodingName});
|
||||
|
||||
///Gets a possible [DownloadStartRequest] instance from a [Map] value.
|
||||
static DownloadStartRequest? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return DownloadStartRequest(
|
||||
url: Uri.parse(map["url"]),
|
||||
userAgent: map["userAgent"],
|
||||
contentDisposition: map["contentDisposition"],
|
||||
mimeType: map["mimeType"],
|
||||
contentLength: map["contentLength"],
|
||||
suggestedFilename: map["suggestedFilename"],
|
||||
textEncodingName: map["textEncodingName"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"url": url.toString(),
|
||||
"userAgent": userAgent,
|
||||
"contentDisposition": contentDisposition,
|
||||
"mimeType": mimeType,
|
||||
"contentLength": contentLength,
|
||||
"suggestedFilename": suggestedFilename,
|
||||
"textEncodingName": textEncodingName
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
import '../in_app_webview/in_app_webview_controller.dart';
|
||||
|
||||
///Class that represents a favicon of a website. It is used by [InAppWebViewController.getFavicons] method.
|
||||
class Favicon {
|
||||
///The url of the favicon image.
|
||||
Uri url;
|
||||
|
||||
///The relationship between the current web page and the favicon image.
|
||||
String? rel;
|
||||
|
||||
///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});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"url": url.toString(),
|
||||
"rel": rel,
|
||||
"width": width,
|
||||
"height": height
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
import 'fetch_request_action.dart';
|
||||
import 'fetch_request_credential.dart';
|
||||
import 'fetch_request_credential_default.dart';
|
||||
import 'fetch_request_federated_credential.dart';
|
||||
import 'fetch_request_password_credential.dart';
|
||||
import 'referrer_policy.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.
|
||||
Uri? url;
|
||||
|
||||
///The HTTP request method used of the request.
|
||||
String? method;
|
||||
|
||||
///The HTTP request headers.
|
||||
Map<String, dynamic>? headers;
|
||||
|
||||
///Body of the request.
|
||||
dynamic body;
|
||||
|
||||
///The mode used by the request.
|
||||
String? mode;
|
||||
|
||||
///The request credentials used by the request.
|
||||
FetchRequestCredential? credentials;
|
||||
|
||||
///The cache mode used by the request.
|
||||
String? cache;
|
||||
|
||||
///The redirect mode used by the request.
|
||||
String? redirect;
|
||||
|
||||
///A String specifying no-referrer, client, or a URL.
|
||||
String? referrer;
|
||||
|
||||
///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;
|
||||
|
||||
FetchRequest(
|
||||
{this.url,
|
||||
this.method,
|
||||
this.headers,
|
||||
this.body,
|
||||
this.mode,
|
||||
this.credentials,
|
||||
this.cache,
|
||||
this.redirect,
|
||||
this.referrer,
|
||||
this.referrerPolicy,
|
||||
this.integrity,
|
||||
this.keepalive,
|
||||
this.action = FetchRequestAction.PROCEED});
|
||||
|
||||
///Gets a possible [FetchRequest] instance from a [Map] value.
|
||||
static FetchRequest? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, dynamic>? credentialMap =
|
||||
map["credentials"]?.cast<String, dynamic>();
|
||||
FetchRequestCredential? credentials;
|
||||
if (credentialMap != null) {
|
||||
if (credentialMap["type"] == "default") {
|
||||
credentials = FetchRequestCredentialDefault.fromMap(credentialMap);
|
||||
} else if (credentialMap["type"] == "federated") {
|
||||
credentials = FetchRequestFederatedCredential.fromMap(credentialMap);
|
||||
} else if (credentialMap["type"] == "password") {
|
||||
credentials = FetchRequestPasswordCredential.fromMap(credentialMap);
|
||||
}
|
||||
}
|
||||
|
||||
return FetchRequest(
|
||||
url: map["url"] != null ? Uri.parse(map["url"]) : null,
|
||||
method: map["method"],
|
||||
headers: map["headers"]?.cast<String, dynamic>(),
|
||||
body: map["body"],
|
||||
mode: map["mode"],
|
||||
credentials: credentials,
|
||||
cache: map["cache"],
|
||||
redirect: map["redirect"],
|
||||
referrer: map["referrer"],
|
||||
referrerPolicy: ReferrerPolicy.fromValue(map["referrerPolicy"]),
|
||||
integrity: map["integrity"],
|
||||
keepalive: map["keepalive"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"url": url?.toString(),
|
||||
"method": method,
|
||||
"headers": headers,
|
||||
"body": body,
|
||||
"mode": mode,
|
||||
"credentials": credentials?.toMap(),
|
||||
"cache": cache,
|
||||
"redirect": redirect,
|
||||
"referrer": referrer,
|
||||
"referrerPolicy": referrerPolicy?.toValue(),
|
||||
"integrity": integrity,
|
||||
"keepalive": keepalive,
|
||||
"action": action?.toValue()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
import 'fetch_request.dart';
|
||||
|
||||
///Class used by [FetchRequest] class.
|
||||
class FetchRequestAction {
|
||||
final int _value;
|
||||
|
||||
const FetchRequestAction._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Aborts the fetch request.
|
||||
static const ABORT = const FetchRequestAction._internal(0);
|
||||
|
||||
///Proceeds with the fetch request.
|
||||
static const PROCEED = const FetchRequestAction._internal(1);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
import 'fetch_request_credential_default.dart';
|
||||
import 'fetch_request_federated_credential.dart';
|
||||
import 'fetch_request_password_credential.dart';
|
||||
|
||||
///Class that is an interface for [FetchRequestCredentialDefault], [FetchRequestFederatedCredential] and [FetchRequestPasswordCredential] classes.
|
||||
class FetchRequestCredential {
|
||||
///Type of credentials.
|
||||
String? type;
|
||||
|
||||
FetchRequestCredential({this.type});
|
||||
|
||||
///Gets a possible [FetchRequestCredential] instance from a [Map] value.
|
||||
static FetchRequestCredential? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return FetchRequestCredential(type: map["type"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"type": type};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
import 'fetch_request.dart';
|
||||
import 'fetch_request_credential.dart';
|
||||
|
||||
///Class that represents the default credentials used by an [FetchRequest].
|
||||
class FetchRequestCredentialDefault extends FetchRequestCredential {
|
||||
///The value of the credentials.
|
||||
String? value;
|
||||
|
||||
FetchRequestCredentialDefault({type, this.value}) : super(type: type);
|
||||
|
||||
///Gets a possible [FetchRequestCredentialDefault] instance from a [Map] value.
|
||||
static FetchRequestCredentialDefault? fromMap(
|
||||
Map<String, dynamic>? credentialsMap) {
|
||||
if (credentialsMap == null) {
|
||||
return null;
|
||||
}
|
||||
return FetchRequestCredentialDefault(
|
||||
type: credentialsMap["type"], value: credentialsMap["value"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"type": type,
|
||||
"value": value,
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
import 'fetch_request_credential.dart';
|
||||
|
||||
///Class that represents a [FederatedCredential](https://developer.mozilla.org/en-US/docs/Web/API/FederatedCredential) type of credentials.
|
||||
class FetchRequestFederatedCredential extends FetchRequestCredential {
|
||||
///Credential's identifier.
|
||||
dynamic id;
|
||||
|
||||
///The name associated with a credential. It should be a human-readable, public name.
|
||||
String? name;
|
||||
|
||||
///Credential's federated identity protocol.
|
||||
String? protocol;
|
||||
|
||||
///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.
|
||||
Uri? iconURL;
|
||||
|
||||
FetchRequestFederatedCredential(
|
||||
{type, this.id, this.name, this.protocol, this.provider, this.iconURL})
|
||||
: super(type: type);
|
||||
|
||||
///Gets a possible [FetchRequestFederatedCredential] instance from a [Map] value.
|
||||
static FetchRequestFederatedCredential? fromMap(
|
||||
Map<String, dynamic>? credentialsMap) {
|
||||
if (credentialsMap == null) {
|
||||
return null;
|
||||
}
|
||||
return FetchRequestFederatedCredential(
|
||||
type: credentialsMap["type"],
|
||||
id: credentialsMap["id"],
|
||||
name: credentialsMap["name"],
|
||||
protocol: credentialsMap["protocol"],
|
||||
provider: credentialsMap["provider"],
|
||||
iconURL: credentialsMap["iconURL"] != null
|
||||
? Uri.parse(credentialsMap["iconURL"])
|
||||
: null);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"type": type,
|
||||
"id": id,
|
||||
"name": name,
|
||||
"protocol": protocol,
|
||||
"provider": provider,
|
||||
"iconURL": iconURL?.toString()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
import 'fetch_request_credential.dart';
|
||||
|
||||
///Class that represents a [PasswordCredential](https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential) type of credentials.
|
||||
class FetchRequestPasswordCredential extends FetchRequestCredential {
|
||||
///Credential's identifier.
|
||||
dynamic id;
|
||||
|
||||
///The name associated with a credential. It should be a human-readable, public name.
|
||||
String? name;
|
||||
|
||||
///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.
|
||||
Uri? iconURL;
|
||||
|
||||
FetchRequestPasswordCredential(
|
||||
{type, this.id, this.name, this.password, this.iconURL})
|
||||
: super(type: type);
|
||||
|
||||
///Gets a possible [FetchRequestPasswordCredential] instance from a [Map] value.
|
||||
static FetchRequestPasswordCredential? fromMap(
|
||||
Map<String, dynamic>? credentialsMap) {
|
||||
if (credentialsMap == null) {
|
||||
return null;
|
||||
}
|
||||
return FetchRequestPasswordCredential(
|
||||
type: credentialsMap["type"],
|
||||
id: credentialsMap["id"],
|
||||
name: credentialsMap["name"],
|
||||
password: credentialsMap["password"],
|
||||
iconURL: credentialsMap["iconURL"] != null
|
||||
? Uri.parse(credentialsMap["iconURL"])
|
||||
: null);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"type": type,
|
||||
"id": id,
|
||||
"name": name,
|
||||
"password": password,
|
||||
"iconURL": iconURL?.toString()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
///Class used to indicate the force dark mode.
|
||||
class ForceDark {
|
||||
final int _value;
|
||||
|
||||
const ForceDark._internal(this._value);
|
||||
|
||||
///Set of all values of [ForceDark].
|
||||
static final Set<ForceDark> values = [
|
||||
ForceDark.FORCE_DARK_OFF,
|
||||
ForceDark.FORCE_DARK_AUTO,
|
||||
ForceDark.FORCE_DARK_ON,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [ForceDark] instance from an [int] value.
|
||||
static ForceDark? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return ForceDark.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "FORCE_DARK_AUTO";
|
||||
case 2:
|
||||
return "FORCE_DARK_ON";
|
||||
case 0:
|
||||
default:
|
||||
return "FORCE_DARK_OFF";
|
||||
}
|
||||
}
|
||||
|
||||
///Disable force dark, irrespective of the force dark mode of the WebView parent.
|
||||
///In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened.
|
||||
static const FORCE_DARK_OFF = const ForceDark._internal(0);
|
||||
|
||||
///Enable force dark dependent on the state of the WebView parent view.
|
||||
static const FORCE_DARK_AUTO = const ForceDark._internal(1);
|
||||
|
||||
///Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.
|
||||
static const FORCE_DARK_ON = const ForceDark._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An Android-specific class used to indicate the force dark mode.
|
||||
///
|
||||
///**NOTE**: available on Android 29+.
|
||||
///
|
||||
///Use [ForceDark] instead.
|
||||
@Deprecated("Use ForceDark instead")
|
||||
class AndroidForceDark {
|
||||
final int _value;
|
||||
|
||||
const AndroidForceDark._internal(this._value);
|
||||
|
||||
///Set of all values of [AndroidForceDark].
|
||||
static final Set<AndroidForceDark> values = [
|
||||
AndroidForceDark.FORCE_DARK_OFF,
|
||||
AndroidForceDark.FORCE_DARK_AUTO,
|
||||
AndroidForceDark.FORCE_DARK_ON,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [AndroidForceDark] instance from an [int] value.
|
||||
static AndroidForceDark? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return AndroidForceDark.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "FORCE_DARK_AUTO";
|
||||
case 2:
|
||||
return "FORCE_DARK_ON";
|
||||
case 0:
|
||||
default:
|
||||
return "FORCE_DARK_OFF";
|
||||
}
|
||||
}
|
||||
|
||||
///Disable force dark, irrespective of the force dark mode of the WebView parent.
|
||||
///In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened.
|
||||
static const FORCE_DARK_OFF = const AndroidForceDark._internal(0);
|
||||
|
||||
///Enable force dark dependent on the state of the WebView parent view.
|
||||
static const FORCE_DARK_AUTO = const AndroidForceDark._internal(1);
|
||||
|
||||
///Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.
|
||||
static const FORCE_DARK_ON = const AndroidForceDark._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
///Class that represents the action to take used by the [WebView.onFormResubmission] event.
|
||||
class FormResubmissionAction {
|
||||
final int _value;
|
||||
|
||||
const FormResubmissionAction._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Resend data
|
||||
static const RESEND = const FormResubmissionAction._internal(0);
|
||||
|
||||
///Don't resend data
|
||||
static const DONT_RESEND = const FormResubmissionAction._internal(1);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"action": _value};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
import 'url_request.dart';
|
||||
import 'security_origin.dart';
|
||||
|
||||
///An object that contains information about a frame on a webpage.
|
||||
class FrameInfo {
|
||||
///A Boolean value indicating whether the frame is the web site's main frame or a subframe.
|
||||
bool isMainFrame;
|
||||
|
||||
///The frame’s current request.
|
||||
URLRequest? request;
|
||||
|
||||
///The frame’s security origin.
|
||||
SecurityOrigin? securityOrigin;
|
||||
|
||||
FrameInfo(
|
||||
{required this.isMainFrame, required this.request, this.securityOrigin});
|
||||
|
||||
///Gets a possible [FrameInfo] instance from a [Map] value.
|
||||
static FrameInfo? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return FrameInfo(
|
||||
isMainFrame: map["isMainFrame"],
|
||||
request: URLRequest.fromMap(map["request"]?.cast<String, dynamic>()),
|
||||
securityOrigin: SecurityOrigin.fromMap(
|
||||
map["securityOrigin"]?.cast<String, dynamic>()));
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"isMainFrame": isMainFrame,
|
||||
"request": request?.toMap(),
|
||||
"securityOrigin": securityOrigin?.toMap()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
||||
|
||||
///An object that contains information about a frame on a webpage.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
///
|
||||
///Use [FrameInfo] instead.
|
||||
@Deprecated("Use FrameInfo instead")
|
||||
class IOSWKFrameInfo {
|
||||
///A Boolean value indicating whether the frame is the web site's main frame or a subframe.
|
||||
bool isMainFrame;
|
||||
|
||||
///The frame’s current request.
|
||||
URLRequest? request;
|
||||
|
||||
///The frame’s security origin.
|
||||
IOSWKSecurityOrigin? securityOrigin;
|
||||
|
||||
IOSWKFrameInfo(
|
||||
{required this.isMainFrame, required this.request, this.securityOrigin});
|
||||
|
||||
///Gets a possible [IOSWKFrameInfo] instance from a [Map] value.
|
||||
static IOSWKFrameInfo? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return IOSWKFrameInfo(
|
||||
isMainFrame: map["isMainFrame"],
|
||||
request: URLRequest.fromMap(map["request"]?.cast<String, dynamic>()),
|
||||
securityOrigin: IOSWKSecurityOrigin.fromMap(
|
||||
map["securityOrigin"]?.cast<String, dynamic>()));
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"isMainFrame": isMainFrame,
|
||||
"request": request?.toMap(),
|
||||
"securityOrigin": securityOrigin?.toMap()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
import '../in_app_webview/webview.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;
|
||||
|
||||
///Whether the permission should be retained beyond the lifetime of a page currently being displayed by a WebView
|
||||
bool? retain;
|
||||
|
||||
GeolocationPermissionShowPromptResponse(
|
||||
{this.origin, this.allow, this.retain});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"origin": origin, "allow": allow, "retain": retain};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
import 'http_auth_response_action.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;
|
||||
|
||||
///Represents the password used for the authentication if the [action] corresponds to [HttpAuthResponseAction.PROCEED]
|
||||
String password;
|
||||
|
||||
///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;
|
||||
|
||||
HttpAuthResponse(
|
||||
{this.username = "",
|
||||
this.password = "",
|
||||
this.permanentPersistence = false,
|
||||
this.action = HttpAuthResponseAction.CANCEL});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"username": username,
|
||||
"password": password,
|
||||
"permanentPersistence": permanentPersistence,
|
||||
"action": action?.toValue()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import 'http_auth_response.dart';
|
||||
|
||||
///Class used by [HttpAuthResponse] class.
|
||||
class HttpAuthResponseAction {
|
||||
final int _value;
|
||||
|
||||
const HttpAuthResponseAction._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Instructs the WebView to cancel the authentication request.
|
||||
static const CANCEL = const HttpAuthResponseAction._internal(0);
|
||||
|
||||
///Instructs the WebView to proceed with the authentication with the given credentials.
|
||||
static const PROCEED = const HttpAuthResponseAction._internal(1);
|
||||
|
||||
///Uses the credentials stored for the current host.
|
||||
static const USE_SAVED_HTTP_AUTH_CREDENTIALS =
|
||||
const HttpAuthResponseAction._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
import 'url_credential.dart';
|
||||
import 'url_response.dart';
|
||||
import 'url_authentication_challenge.dart';
|
||||
import 'url_protection_space.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 credential’s 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 URL response object representing the last authentication failure.
|
||||
///This value is `null` if the protocol doesn’t use responses to indicate an authentication failure.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
URLResponse? failureResponse;
|
||||
|
||||
///Use [error] instead.
|
||||
@Deprecated("Use error instead")
|
||||
String? iosError;
|
||||
|
||||
///The error object representing the last authentication failure.
|
||||
///This value is `null` if the protocol doesn’t use errors to indicate an authentication failure.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
String? error;
|
||||
|
||||
HttpAuthenticationChallenge(
|
||||
{required this.previousFailureCount,
|
||||
required URLProtectionSpace protectionSpace,
|
||||
@Deprecated("Use failureResponse instead") this.iosFailureResponse,
|
||||
this.failureResponse,
|
||||
this.proposedCredential,
|
||||
@Deprecated("Use error instead") this.iosError,
|
||||
this.error})
|
||||
: super(protectionSpace: protectionSpace) {
|
||||
this.failureResponse = this.failureResponse ??
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
URLResponse.fromMap(this.iosFailureResponse?.toMap());
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.error = this.error ?? this.iosError;
|
||||
}
|
||||
|
||||
///Gets a possible [HttpAuthenticationChallenge] instance from a [Map] value.
|
||||
static HttpAuthenticationChallenge? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return HttpAuthenticationChallenge(
|
||||
previousFailureCount: map["previousFailureCount"],
|
||||
protectionSpace: URLProtectionSpace.fromMap(
|
||||
map["protectionSpace"].cast<String, dynamic>())!,
|
||||
proposedCredential: URLCredential.fromMap(
|
||||
map["proposedCredential"]?.cast<String, dynamic>()),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosFailureResponse: IOSURLResponse.fromMap(
|
||||
map["failureResponse"]?.cast<String, dynamic>()),
|
||||
failureResponse:
|
||||
URLResponse.fromMap(map["failureResponse"]?.cast<String, dynamic>()),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosError: map["error"],
|
||||
error: map["error"],
|
||||
);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
var map = super.toMap();
|
||||
map.addAll({
|
||||
"previousFailureCount": previousFailureCount,
|
||||
"protectionSpace": protectionSpace.toMap(),
|
||||
"proposedCredential": proposedCredential?.toMap(),
|
||||
"iosFailureResponse":
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
failureResponse?.toMap() ?? iosFailureResponse?.toMap(),
|
||||
"failureResponse":
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
failureResponse?.toMap() ?? iosFailureResponse?.toMap(),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"iosError": error ?? iosError,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"error": error ?? iosError,
|
||||
});
|
||||
return map;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
import 'cookie.dart';
|
||||
|
||||
///Class that represents the same site policy of a cookie. Used by the [Cookie] class.
|
||||
class HTTPCookieSameSitePolicy {
|
||||
final String _value;
|
||||
|
||||
const HTTPCookieSameSitePolicy._internal(this._value);
|
||||
|
||||
///Set of all values of [HTTPCookieSameSitePolicy].
|
||||
static final Set<HTTPCookieSameSitePolicy> values = [
|
||||
HTTPCookieSameSitePolicy.LAX,
|
||||
HTTPCookieSameSitePolicy.STRICT,
|
||||
HTTPCookieSameSitePolicy.NONE,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [HTTPCookieSameSitePolicy] instance from a [String] value.
|
||||
static HTTPCookieSameSitePolicy? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return HTTPCookieSameSitePolicy.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///SameSite=Lax;
|
||||
///
|
||||
///Cookies are allowed to be sent with top-level navigations and will be sent along with GET
|
||||
///request initiated by third party website. This is the default value in modern browsers.
|
||||
static const LAX = const HTTPCookieSameSitePolicy._internal("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 = const HTTPCookieSameSitePolicy._internal("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 = const HTTPCookieSameSitePolicy._internal("None");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
import 'in_app_webview_hit_test_result_type.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});
|
||||
|
||||
///Gets a possible [InAppWebViewHitTestResult] instance from a [Map] value.
|
||||
static InAppWebViewHitTestResult? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return InAppWebViewHitTestResult(
|
||||
type: InAppWebViewHitTestResultType.fromValue(map["type"]),
|
||||
extra: map["extra"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"type": type?.toValue(), "extra": extra};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
///Class representing the [InAppWebViewHitTestResult] type.
|
||||
class InAppWebViewHitTestResultType {
|
||||
final int _value;
|
||||
|
||||
const InAppWebViewHitTestResultType._internal(this._value);
|
||||
|
||||
///Set of all values of [InAppWebViewHitTestResultType].
|
||||
static final Set<InAppWebViewHitTestResultType> values = [
|
||||
InAppWebViewHitTestResultType.UNKNOWN_TYPE,
|
||||
InAppWebViewHitTestResultType.PHONE_TYPE,
|
||||
InAppWebViewHitTestResultType.GEO_TYPE,
|
||||
InAppWebViewHitTestResultType.EMAIL_TYPE,
|
||||
InAppWebViewHitTestResultType.IMAGE_TYPE,
|
||||
InAppWebViewHitTestResultType.SRC_ANCHOR_TYPE,
|
||||
InAppWebViewHitTestResultType.SRC_IMAGE_ANCHOR_TYPE,
|
||||
InAppWebViewHitTestResultType.EDIT_TEXT_TYPE,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [InAppWebViewHitTestResultType] instance from an [int] value.
|
||||
static InAppWebViewHitTestResultType? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return InAppWebViewHitTestResultType.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 2:
|
||||
return "PHONE_TYPE";
|
||||
case 3:
|
||||
return "GEO_TYPE";
|
||||
case 4:
|
||||
return "EMAIL_TYPE";
|
||||
case 5:
|
||||
return "IMAGE_TYPE";
|
||||
case 7:
|
||||
return "SRC_ANCHOR_TYPE";
|
||||
case 8:
|
||||
return "SRC_IMAGE_ANCHOR_TYPE";
|
||||
case 9:
|
||||
return "EDIT_TEXT_TYPE";
|
||||
case 0:
|
||||
default:
|
||||
return "UNKNOWN_TYPE";
|
||||
}
|
||||
}
|
||||
|
||||
///Default [InAppWebViewHitTestResult], where the target is unknown.
|
||||
static const UNKNOWN_TYPE = const InAppWebViewHitTestResultType._internal(0);
|
||||
|
||||
///[InAppWebViewHitTestResult] for hitting a phone number.
|
||||
static const PHONE_TYPE = const InAppWebViewHitTestResultType._internal(2);
|
||||
|
||||
///[InAppWebViewHitTestResult] for hitting a map address.
|
||||
static const GEO_TYPE = const InAppWebViewHitTestResultType._internal(3);
|
||||
|
||||
///[InAppWebViewHitTestResult] for hitting an email address.
|
||||
static const EMAIL_TYPE = const InAppWebViewHitTestResultType._internal(4);
|
||||
|
||||
///[InAppWebViewHitTestResult] for hitting an HTML::img tag.
|
||||
static const IMAGE_TYPE = const InAppWebViewHitTestResultType._internal(5);
|
||||
|
||||
///[InAppWebViewHitTestResult] for hitting a HTML::a tag with src=http.
|
||||
static const SRC_ANCHOR_TYPE =
|
||||
const InAppWebViewHitTestResultType._internal(7);
|
||||
|
||||
///[InAppWebViewHitTestResult] for hitting a HTML::a tag with src=http + HTML::img.
|
||||
static const SRC_IMAGE_ANCHOR_TYPE =
|
||||
const InAppWebViewHitTestResultType._internal(8);
|
||||
|
||||
///[InAppWebViewHitTestResult] for hitting an edit text area.
|
||||
static const EDIT_TEXT_TYPE =
|
||||
const InAppWebViewHitTestResultType._internal(9);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
import '../in_app_webview/webview.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;
|
||||
|
||||
///The URL to use as the page's base URL. The default value is `about:blank`.
|
||||
late Uri baseUrl;
|
||||
|
||||
///Use [historyUrl] instead.
|
||||
@Deprecated('Use historyUrl instead')
|
||||
late Uri androidHistoryUrl;
|
||||
|
||||
///The URL to use as the history entry. The default value is `about:blank`. If non-null, this must be a valid URL.
|
||||
///
|
||||
///This parameter is used only on Android.
|
||||
late Uri historyUrl;
|
||||
|
||||
InAppWebViewInitialData(
|
||||
{required this.data,
|
||||
this.mimeType = "text/html",
|
||||
this.encoding = "utf8",
|
||||
Uri? baseUrl,
|
||||
@Deprecated('Use historyUrl instead') Uri? androidHistoryUrl,
|
||||
Uri? historyUrl}) {
|
||||
this.baseUrl = baseUrl == null ? Uri.parse("about:blank") : baseUrl;
|
||||
this.historyUrl = historyUrl == null
|
||||
? (androidHistoryUrl == null
|
||||
? Uri.parse("about:blank")
|
||||
: androidHistoryUrl)
|
||||
: historyUrl;
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.androidHistoryUrl = this.historyUrl;
|
||||
}
|
||||
|
||||
///Gets a possible [InAppWebViewInitialData] instance from a [Map] value.
|
||||
static InAppWebViewInitialData? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return InAppWebViewInitialData(
|
||||
data: map["data"],
|
||||
mimeType: map["mimeType"],
|
||||
encoding: map["encoding"],
|
||||
baseUrl: map["baseUrl"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidHistoryUrl: map["androidHistoryUrl"],
|
||||
historyUrl: map["historyUrl"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, String> toMap() {
|
||||
return {
|
||||
"data": data,
|
||||
"mimeType": mimeType,
|
||||
"encoding": encoding,
|
||||
"baseUrl": baseUrl.toString(),
|
||||
"historyUrl": historyUrl.toString()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, String> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
///A class that represents a structure that contains the location and dimensions of a rectangle.
|
||||
class InAppWebViewRect {
|
||||
///x position
|
||||
double x;
|
||||
|
||||
///y position
|
||||
double y;
|
||||
|
||||
///rect width
|
||||
double width;
|
||||
|
||||
///rect height
|
||||
double height;
|
||||
|
||||
InAppWebViewRect(
|
||||
{required this.x,
|
||||
required this.y,
|
||||
required this.width,
|
||||
required this.height}) {
|
||||
assert(this.x >= 0 && this.y >= 0 && this.width >= 0 && this.height >= 0);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"x": x, "y": y, "width": width, "height": height};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import '../in_app_webview/in_app_webview_controller.dart';
|
||||
|
||||
///This type represents a callback, added with [InAppWebViewController.addJavaScriptHandler], that listens to post messages sent from JavaScript.
|
||||
///
|
||||
///The Android implementation uses [addJavascriptInterface](https://developer.android.com/reference/android/webkit/WebView#addJavascriptInterface(java.lang.Object,%20java.lang.String)).
|
||||
///The iOS implementation uses [addScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537172-addscriptmessagehandler?language=objc)
|
||||
///
|
||||
///The JavaScript function that can be used to call the handler is `window.flutter_inappwebview.callHandler(handlerName <String>, ...args);`, where `args` are [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
|
||||
///The `args` will be stringified automatically using `JSON.stringify(args)` method and then they will be decoded on the Dart side.
|
||||
///
|
||||
///Also, a [JavaScriptHandlerCallback] can return json data to the JavaScript side.
|
||||
///In this case, simply return data that you want to send and it will be automatically json encoded using [jsonEncode] from the `dart:convert` library.
|
||||
typedef dynamic JavaScriptHandlerCallback(List<dynamic> arguments);
|
|
@ -0,0 +1,64 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
///Class that represents the request of the [WebView.onJsAlert] event.
|
||||
class JsAlertRequest {
|
||||
///The url of the page requesting the dialog.
|
||||
Uri? url;
|
||||
|
||||
///Message to be displayed in the window.
|
||||
String? message;
|
||||
|
||||
///Use [isMainFrame] instead.
|
||||
@Deprecated("Use isMainFrame instead")
|
||||
bool? iosIsMainFrame;
|
||||
|
||||
///Indicates whether the request was made for the main frame.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
bool? isMainFrame;
|
||||
|
||||
JsAlertRequest(
|
||||
{this.url,
|
||||
this.message,
|
||||
@Deprecated("Use isMainFrame instead") this.iosIsMainFrame,
|
||||
this.isMainFrame}) {
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.isMainFrame = this.isMainFrame ?? this.iosIsMainFrame;
|
||||
}
|
||||
|
||||
///Gets a possible [JsAlertRequest] instance from a [Map] value.
|
||||
static JsAlertRequest? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return JsAlertRequest(
|
||||
url: map["url"] != null ? Uri.parse(map["url"]) : null,
|
||||
message: map["message"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosIsMainFrame: map["isMainFrame"],
|
||||
isMainFrame: map["isMainFrame"],
|
||||
);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"url": url?.toString(),
|
||||
"message": message,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"iosIsMainFrame": isMainFrame ?? iosIsMainFrame,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"isMainFrame": isMainFrame ?? iosIsMainFrame
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
import 'js_alert_response_action.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;
|
||||
|
||||
///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 button.
|
||||
JsAlertResponseAction? action;
|
||||
|
||||
JsAlertResponse(
|
||||
{this.message = "",
|
||||
this.handledByClient = false,
|
||||
this.confirmButtonTitle = "",
|
||||
this.action = JsAlertResponseAction.CONFIRM});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"message": message,
|
||||
"confirmButtonTitle": confirmButtonTitle,
|
||||
"handledByClient": handledByClient,
|
||||
"action": action?.toValue()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
import 'js_alert_response.dart';
|
||||
|
||||
///Class used by [JsAlertResponse] class.
|
||||
class JsAlertResponseAction {
|
||||
final int _value;
|
||||
|
||||
const JsAlertResponseAction._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Confirm that the user hit confirm button.
|
||||
static const CONFIRM = const JsAlertResponseAction._internal(0);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
///Class that represents the request of the [WebView.onJsBeforeUnload] event.
|
||||
class JsBeforeUnloadRequest {
|
||||
///The url of the page requesting the dialog.
|
||||
Uri? url;
|
||||
|
||||
///Message to be displayed in the window.
|
||||
String? message;
|
||||
|
||||
JsBeforeUnloadRequest({this.url, this.message});
|
||||
|
||||
///Gets a possible [JsBeforeUnloadRequest] instance from a [Map] value.
|
||||
static JsBeforeUnloadRequest? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return JsBeforeUnloadRequest(
|
||||
url: map["url"] != null ? Uri.parse(map["url"]) : null,
|
||||
message: map["message"],
|
||||
);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"url": url?.toString(), "message": message};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
import 'js_before_unload_response_action.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;
|
||||
|
||||
///Title of the cancel button.
|
||||
String cancelButtonTitle;
|
||||
|
||||
///Whether the client will handle the alert dialog.
|
||||
bool handledByClient;
|
||||
|
||||
///Action used to confirm that the user hit confirm or cancel button.
|
||||
JsBeforeUnloadResponseAction? action;
|
||||
|
||||
JsBeforeUnloadResponse(
|
||||
{this.message = "",
|
||||
this.handledByClient = false,
|
||||
this.confirmButtonTitle = "",
|
||||
this.cancelButtonTitle = "",
|
||||
this.action = JsBeforeUnloadResponseAction.CONFIRM});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"message": message,
|
||||
"confirmButtonTitle": confirmButtonTitle,
|
||||
"cancelButtonTitle": cancelButtonTitle,
|
||||
"handledByClient": handledByClient,
|
||||
"action": action?.toValue()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
import 'js_before_unload_response.dart';
|
||||
|
||||
///Class used by [JsBeforeUnloadResponse] class.
|
||||
class JsBeforeUnloadResponseAction {
|
||||
final int _value;
|
||||
|
||||
const JsBeforeUnloadResponseAction._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Confirm that the user hit confirm button.
|
||||
static const CONFIRM = const JsBeforeUnloadResponseAction._internal(0);
|
||||
|
||||
///Confirm that the user hit cancel button.
|
||||
static const CANCEL = const JsBeforeUnloadResponseAction._internal(1);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
///Class that represents the request of the [WebView.onJsConfirm] event.
|
||||
class JsConfirmRequest {
|
||||
///The url of the page requesting the dialog.
|
||||
Uri? url;
|
||||
|
||||
///Message to be displayed in the window.
|
||||
String? message;
|
||||
|
||||
///Use [isMainFrame] instead.
|
||||
@Deprecated("Use isMainFrame instead")
|
||||
bool? iosIsMainFrame;
|
||||
|
||||
///Indicates whether the request was made for the main frame.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
bool? isMainFrame;
|
||||
|
||||
JsConfirmRequest(
|
||||
{this.url,
|
||||
this.message,
|
||||
@Deprecated("Use isMainFrame instead") this.iosIsMainFrame,
|
||||
this.isMainFrame}) {
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.isMainFrame = this.isMainFrame ?? this.iosIsMainFrame;
|
||||
}
|
||||
|
||||
///Gets a possible [JsConfirmRequest] instance from a [Map] value.
|
||||
static JsConfirmRequest? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return JsConfirmRequest(
|
||||
url: map["url"] != null ? Uri.parse(map["url"]) : null,
|
||||
message: map["message"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosIsMainFrame: map["isMainFrame"],
|
||||
isMainFrame: map["isMainFrame"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"url": url?.toString(),
|
||||
"message": message,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"iosIsMainFrame": isMainFrame ?? iosIsMainFrame,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"isMainFrame": isMainFrame ?? iosIsMainFrame
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
import 'js_confirm_response_action.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;
|
||||
|
||||
///Title of the cancel button.
|
||||
String cancelButtonTitle;
|
||||
|
||||
///Whether the client will handle the confirm dialog.
|
||||
bool handledByClient;
|
||||
|
||||
///Action used to confirm that the user hit confirm or cancel button.
|
||||
JsConfirmResponseAction? action;
|
||||
|
||||
JsConfirmResponse(
|
||||
{this.message = "",
|
||||
this.handledByClient = false,
|
||||
this.confirmButtonTitle = "",
|
||||
this.cancelButtonTitle = "",
|
||||
this.action = JsConfirmResponseAction.CANCEL});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"message": message,
|
||||
"confirmButtonTitle": confirmButtonTitle,
|
||||
"cancelButtonTitle": cancelButtonTitle,
|
||||
"handledByClient": handledByClient,
|
||||
"action": action?.toValue()
|
||||
};
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
import 'js_confirm_response.dart';
|
||||
|
||||
///Class used by [JsConfirmResponse] class.
|
||||
class JsConfirmResponseAction {
|
||||
final int _value;
|
||||
|
||||
const JsConfirmResponseAction._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Confirm that the user hit confirm button.
|
||||
static const CONFIRM = const JsConfirmResponseAction._internal(0);
|
||||
|
||||
///Confirm that the user hit cancel button.
|
||||
static const CANCEL = const JsConfirmResponseAction._internal(1);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
///Class that represents the request of the [WebView.onJsPrompt] event.
|
||||
class JsPromptRequest {
|
||||
///The url of the page requesting the dialog.
|
||||
Uri? url;
|
||||
|
||||
///Message to be displayed in the window.
|
||||
String? message;
|
||||
|
||||
///The default value displayed in the prompt dialog.
|
||||
String? defaultValue;
|
||||
|
||||
///Use [isMainFrame] instead.
|
||||
@Deprecated("Use isMainFrame instead")
|
||||
bool? iosIsMainFrame;
|
||||
|
||||
///Indicates whether the request was made for the main frame.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
bool? isMainFrame;
|
||||
|
||||
JsPromptRequest(
|
||||
{this.url,
|
||||
this.message,
|
||||
this.defaultValue,
|
||||
@Deprecated("Use isMainFrame instead") this.iosIsMainFrame,
|
||||
this.isMainFrame}) {
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.isMainFrame = this.isMainFrame ?? this.iosIsMainFrame;
|
||||
}
|
||||
|
||||
///Gets a possible [JsPromptRequest] instance from a [Map] value.
|
||||
static JsPromptRequest? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return JsPromptRequest(
|
||||
url: map["url"] != null ? Uri.parse(map["url"]) : null,
|
||||
message: map["message"],
|
||||
defaultValue: map["defaultValue"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosIsMainFrame: map["isMainFrame"],
|
||||
isMainFrame: map["isMainFrame"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"url": url?.toString(),
|
||||
"message": message,
|
||||
"defaultValue": defaultValue,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"iosIsMainFrame": isMainFrame ?? iosIsMainFrame,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"isMainFrame": isMainFrame ?? iosIsMainFrame
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
import 'js_prompt_response_action.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;
|
||||
|
||||
///Title of the cancel button.
|
||||
String cancelButtonTitle;
|
||||
|
||||
///Whether the client will handle the prompt dialog.
|
||||
bool handledByClient;
|
||||
|
||||
///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.handledByClient = false,
|
||||
this.confirmButtonTitle = "",
|
||||
this.cancelButtonTitle = "",
|
||||
this.value,
|
||||
this.action = JsPromptResponseAction.CANCEL});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"message": message,
|
||||
"defaultValue": defaultValue,
|
||||
"confirmButtonTitle": confirmButtonTitle,
|
||||
"cancelButtonTitle": cancelButtonTitle,
|
||||
"handledByClient": handledByClient,
|
||||
"value": value,
|
||||
"action": action?.toValue()
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
import 'js_prompt_response.dart';
|
||||
|
||||
///Class used by [JsPromptResponse] class.
|
||||
class JsPromptResponseAction {
|
||||
final int _value;
|
||||
|
||||
const JsPromptResponseAction._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Confirm that the user hit confirm button.
|
||||
static const CONFIRM = const JsPromptResponseAction._internal(0);
|
||||
|
||||
///Confirm that the user hit cancel button.
|
||||
static const CANCEL = const JsPromptResponseAction._internal(1);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
///Class used to set the underlying layout algorithm.
|
||||
class LayoutAlgorithm {
|
||||
final String _value;
|
||||
|
||||
const LayoutAlgorithm._internal(this._value);
|
||||
|
||||
///Set of all values of [LayoutAlgorithm].
|
||||
static final Set<LayoutAlgorithm> values = [
|
||||
LayoutAlgorithm.NORMAL,
|
||||
LayoutAlgorithm.TEXT_AUTOSIZING,
|
||||
LayoutAlgorithm.NARROW_COLUMNS,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [LayoutAlgorithm] instance from a [String] value.
|
||||
static LayoutAlgorithm? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return LayoutAlgorithm.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
|
||||
static const NORMAL = const LayoutAlgorithm._internal("NORMAL");
|
||||
|
||||
///TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make the text readable when viewing a wide-viewport layout in the overview mode.
|
||||
///It is recommended to enable zoom support [AndroidInAppWebViewOptions.supportZoom] when using this mode.
|
||||
///
|
||||
///**NOTE**: available on Android 19+.
|
||||
static const TEXT_AUTOSIZING =
|
||||
const LayoutAlgorithm._internal("TEXT_AUTOSIZING");
|
||||
|
||||
///NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use this for API levels prior to `Build.VERSION_CODES.KITKAT`.
|
||||
static const NARROW_COLUMNS =
|
||||
const LayoutAlgorithm._internal("NARROW_COLUMNS");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An Android-specific class used to set the underlying layout algorithm.
|
||||
///Use [LayoutAlgorithm] instead.
|
||||
@Deprecated("Use LayoutAlgorithm instead")
|
||||
class AndroidLayoutAlgorithm {
|
||||
final String _value;
|
||||
|
||||
const AndroidLayoutAlgorithm._internal(this._value);
|
||||
|
||||
///Set of all values of [AndroidLayoutAlgorithm].
|
||||
static final Set<AndroidLayoutAlgorithm> values = [
|
||||
AndroidLayoutAlgorithm.NORMAL,
|
||||
AndroidLayoutAlgorithm.TEXT_AUTOSIZING,
|
||||
AndroidLayoutAlgorithm.NARROW_COLUMNS,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [AndroidLayoutAlgorithm] instance from a [String] value.
|
||||
static AndroidLayoutAlgorithm? fromValue(String? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return AndroidLayoutAlgorithm.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [String] value.
|
||||
String toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() => _value;
|
||||
|
||||
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
|
||||
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.
|
||||
///
|
||||
///**NOTE**: available on Android 19+.
|
||||
static const TEXT_AUTOSIZING =
|
||||
const AndroidLayoutAlgorithm._internal("TEXT_AUTOSIZING");
|
||||
|
||||
///NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use this for API levels prior to `Build.VERSION_CODES.KITKAT`.
|
||||
static const NARROW_COLUMNS =
|
||||
const AndroidLayoutAlgorithm._internal("NARROW_COLUMNS");
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
///Class representing the share state that should be applied to the custom tab.
|
||||
///
|
||||
///**NOTE**: available on Android 28+.
|
||||
class LayoutInDisplayCutoutMode {
|
||||
final int _value;
|
||||
|
||||
const LayoutInDisplayCutoutMode._internal(this._value);
|
||||
|
||||
///Set of all values of [LayoutInDisplayCutoutMode].
|
||||
static final Set<LayoutInDisplayCutoutMode> values = [
|
||||
LayoutInDisplayCutoutMode.DEFAULT,
|
||||
LayoutInDisplayCutoutMode.SHORT_EDGES,
|
||||
LayoutInDisplayCutoutMode.NEVER,
|
||||
LayoutInDisplayCutoutMode.ALWAYS
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [LayoutInDisplayCutoutMode] instance from an [int] value.
|
||||
static LayoutInDisplayCutoutMode? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return LayoutInDisplayCutoutMode.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "SHORT_EDGES";
|
||||
case 2:
|
||||
return "NEVER";
|
||||
case 3:
|
||||
return "ALWAYS";
|
||||
case 0:
|
||||
default:
|
||||
return "DEFAULT";
|
||||
}
|
||||
}
|
||||
|
||||
///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 = const LayoutInDisplayCutoutMode._internal(0);
|
||||
|
||||
///Content renders into the cutout area in both portrait and landscape modes.
|
||||
///
|
||||
///**NOTE**: available on Android 28+.
|
||||
static const SHORT_EDGES = const LayoutInDisplayCutoutMode._internal(1);
|
||||
|
||||
///Content never renders into the cutout area.
|
||||
///
|
||||
///**NOTE**: available on Android 28+.
|
||||
static const NEVER = const LayoutInDisplayCutoutMode._internal(2);
|
||||
|
||||
///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 = const LayoutInDisplayCutoutMode._internal(3);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///Android-specific class representing the share state that should be applied to the custom tab.
|
||||
///
|
||||
///**NOTE**: available on Android 28+.
|
||||
///
|
||||
///Use [LayoutInDisplayCutoutMode] instead.
|
||||
@Deprecated("Use LayoutInDisplayCutoutMode instead")
|
||||
class AndroidLayoutInDisplayCutoutMode {
|
||||
final int _value;
|
||||
|
||||
const AndroidLayoutInDisplayCutoutMode._internal(this._value);
|
||||
|
||||
///Set of all values of [AndroidLayoutInDisplayCutoutMode].
|
||||
static final Set<AndroidLayoutInDisplayCutoutMode> values = [
|
||||
AndroidLayoutInDisplayCutoutMode.DEFAULT,
|
||||
AndroidLayoutInDisplayCutoutMode.SHORT_EDGES,
|
||||
AndroidLayoutInDisplayCutoutMode.NEVER,
|
||||
AndroidLayoutInDisplayCutoutMode.ALWAYS
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [AndroidLayoutInDisplayCutoutMode] instance from an [int] value.
|
||||
static AndroidLayoutInDisplayCutoutMode? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return AndroidLayoutInDisplayCutoutMode.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "SHORT_EDGES";
|
||||
case 2:
|
||||
return "NEVER";
|
||||
case 3:
|
||||
return "ALWAYS";
|
||||
case 0:
|
||||
default:
|
||||
return "DEFAULT";
|
||||
}
|
||||
}
|
||||
|
||||
///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 = const AndroidLayoutInDisplayCutoutMode._internal(0);
|
||||
|
||||
///Content renders into the cutout area in both portrait and landscape modes.
|
||||
///
|
||||
///**NOTE**: available on Android 28+.
|
||||
static const SHORT_EDGES =
|
||||
const AndroidLayoutInDisplayCutoutMode._internal(1);
|
||||
|
||||
///Content never renders into the cutout area.
|
||||
///
|
||||
///**NOTE**: available on Android 28+.
|
||||
static const NEVER = const AndroidLayoutInDisplayCutoutMode._internal(2);
|
||||
|
||||
///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 = const AndroidLayoutInDisplayCutoutMode._internal(3);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
///Class representing a resource response of the [WebView].
|
||||
///It is used by the method [WebView.onLoadResource].
|
||||
class LoadedResource {
|
||||
///A string representing the type of resource.
|
||||
String? initiatorType;
|
||||
|
||||
///Resource URL.
|
||||
Uri? 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});
|
||||
|
||||
///Gets a possible [LoadedResource] instance from a [Map] value.
|
||||
static LoadedResource? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return LoadedResource(
|
||||
initiatorType: map["initiatorType"],
|
||||
url: map["url"] != null ? Uri.parse(map["url"]) : null,
|
||||
startTime: map["startTime"],
|
||||
duration: map["duration"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"initiatorType": initiatorType,
|
||||
"url": url?.toString(),
|
||||
"startTime": startTime,
|
||||
"duration": duration
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
import '../in_app_webview/webview.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});
|
||||
|
||||
///Gets a possible [LoginRequest] instance from a [Map] value.
|
||||
static LoginRequest? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return LoginRequest(
|
||||
realm: map["realm"],
|
||||
account: map["account"],
|
||||
args: map["args"],
|
||||
);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"realm": realm, "account": account, "args": args};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
export 'action_mode_menu_item.dart';
|
||||
export 'ajax_request.dart';
|
||||
export 'ajax_request_action.dart';
|
||||
export 'ajax_request_event.dart';
|
||||
export 'ajax_request_event_type.dart';
|
||||
export 'ajax_request_headers.dart';
|
||||
export 'ajax_request_ready_state.dart';
|
||||
export 'attributed_string.dart';
|
||||
export 'attributed_string_text_effect_style.dart';
|
||||
export 'cache_mode.dart';
|
||||
export 'call_async_javascript_result.dart';
|
||||
export 'client_cert_challenge.dart';
|
||||
export 'client_cert_response.dart';
|
||||
export 'client_cert_response_action.dart';
|
||||
export 'compress_format.dart';
|
||||
export 'console_message.dart';
|
||||
export 'console_message_level.dart';
|
||||
export 'content_blocker_action_type.dart';
|
||||
export 'content_blocker_trigger_load_type.dart';
|
||||
export 'content_blocker_trigger_resource_type.dart';
|
||||
export 'content_world.dart';
|
||||
export 'cookie.dart';
|
||||
export 'create_window_action.dart';
|
||||
export 'cross_origin.dart';
|
||||
export 'css_link_html_tag_attributes.dart';
|
||||
export 'custom_scheme_response.dart';
|
||||
export 'custom_tabs_share_state.dart';
|
||||
export 'data_detector_types.dart';
|
||||
export 'dismiss_button_style.dart';
|
||||
export 'download_start_request.dart';
|
||||
export 'favicon.dart';
|
||||
export 'fetch_request.dart';
|
||||
export 'fetch_request_action.dart';
|
||||
export 'fetch_request_credential.dart';
|
||||
export 'fetch_request_credential_default.dart';
|
||||
export 'fetch_request_federated_credential.dart';
|
||||
export 'fetch_request_password_credential.dart';
|
||||
export 'force_dark.dart';
|
||||
export 'form_resubmission_action.dart';
|
||||
export 'frame_info.dart';
|
||||
export 'geolocation_permission_show_prompt_response.dart';
|
||||
export 'http_auth_response.dart';
|
||||
export 'http_auth_response_action.dart';
|
||||
export 'http_authentication_challenge.dart';
|
||||
export 'http_cookie_same_site_policy.dart';
|
||||
export 'in_app_webview_hit_test_result.dart';
|
||||
export 'in_app_webview_hit_test_result_type.dart';
|
||||
export 'in_app_webview_initial_data.dart';
|
||||
export 'in_app_webview_rect.dart';
|
||||
export 'javascript_handler_callback.dart';
|
||||
export 'js_alert_request.dart';
|
||||
export 'js_alert_response.dart';
|
||||
export 'js_alert_response_action.dart';
|
||||
export 'js_before_unload_request.dart';
|
||||
export 'js_before_unload_response.dart';
|
||||
export 'js_before_unload_response_action.dart';
|
||||
export 'js_confirm_request.dart';
|
||||
export 'js_confirm_response.dart';
|
||||
export 'js_confirm_response_action.dart';
|
||||
export 'js_prompt_request.dart';
|
||||
export 'js_prompt_response.dart';
|
||||
export 'js_prompt_response_action.dart';
|
||||
export 'layout_algorithm.dart';
|
||||
export 'layout_in_display_cutout_mode.dart';
|
||||
export 'loaded_resource.dart';
|
||||
export 'login_request.dart';
|
||||
export 'media_playback_state.dart';
|
||||
export 'meta_tag.dart';
|
||||
export 'meta_tag_attribute.dart';
|
||||
export 'mixed_content_mode.dart';
|
||||
export 'modal_presentation_style.dart';
|
||||
export 'modal_transition_style.dart';
|
||||
export 'navigation_action.dart';
|
||||
export 'navigation_action_policy.dart';
|
||||
export 'navigation_response.dart';
|
||||
export 'navigation_response_action.dart';
|
||||
export 'navigation_type.dart';
|
||||
export 'on_post_message_callback.dart';
|
||||
export 'over_scroll_mode.dart';
|
||||
export 'pdf_configuration.dart';
|
||||
export 'permission_request.dart';
|
||||
export 'permission_resource_type.dart';
|
||||
export 'permission_response.dart';
|
||||
export 'permission_response_action.dart';
|
||||
export 'pull_to_refresh_size.dart';
|
||||
export 'referrer_policy.dart';
|
||||
export 'render_process_gone_detail.dart';
|
||||
export 'renderer_priority.dart';
|
||||
export 'renderer_priority_policy.dart';
|
||||
export 'request_focus_node_href_result.dart';
|
||||
export 'request_image_ref_result.dart';
|
||||
export 'safe_browsing_response.dart';
|
||||
export 'safe_browsing_response_action.dart';
|
||||
export 'safe_browsing_threat.dart';
|
||||
export 'sandbox.dart';
|
||||
export 'screenshot_configuration.dart';
|
||||
export 'script_html_tag_attributes.dart';
|
||||
export 'scrollbar_style.dart';
|
||||
export 'scrollview_content_inset_adjustment_behavior.dart';
|
||||
export 'scrollview_deceleration_rate.dart';
|
||||
export 'security_origin.dart';
|
||||
export 'selection_granularity.dart';
|
||||
export 'server_trust_auth_response.dart';
|
||||
export 'server_trust_auth_response_action.dart';
|
||||
export 'server_trust_challenge.dart';
|
||||
export 'should_allow_deprecated_tls_action.dart';
|
||||
export 'ssl_certificate.dart';
|
||||
export 'ssl_certificate_dname.dart';
|
||||
export 'ssl_error.dart';
|
||||
export 'ssl_error_type.dart';
|
||||
export 'trusted_web_activity_default_display_mode.dart';
|
||||
export 'trusted_web_activity_display_mode.dart';
|
||||
export 'trusted_web_activity_immersive_display_mode.dart';
|
||||
export 'trusted_web_activity_screen_orientation.dart';
|
||||
export 'underline_style.dart';
|
||||
export 'url_authentication_challenge.dart';
|
||||
export 'url_credential.dart';
|
||||
export 'url_credential_persistence.dart';
|
||||
export 'url_protection_space.dart';
|
||||
export 'url_protection_space_authentication_method.dart';
|
||||
export 'url_protection_space_http_auth_credentials.dart';
|
||||
export 'url_protection_space_proxy_type.dart';
|
||||
export 'url_request.dart';
|
||||
export 'url_request_cache_policy.dart';
|
||||
export 'url_request_network_service_type.dart';
|
||||
export 'url_response.dart';
|
||||
export 'user_preferred_content_mode.dart';
|
||||
export 'user_script.dart';
|
||||
export 'user_script_injection_time.dart';
|
||||
export 'vertical_scrollbar_position.dart';
|
||||
export 'web_archive_format.dart';
|
||||
export 'web_history.dart';
|
||||
export 'web_history_item.dart';
|
||||
export 'web_message_callback.dart';
|
||||
export 'web_resource_request.dart';
|
||||
export 'web_resource_response.dart';
|
||||
export 'web_storage_origin.dart';
|
||||
export 'web_storage_type.dart';
|
||||
export 'website_data_record.dart';
|
||||
export 'website_data_type.dart';
|
||||
export 'webview_implementation.dart';
|
||||
export 'webview_package_info.dart';
|
||||
export 'webview_render_process_action.dart';
|
||||
export 'window_features.dart';
|
|
@ -0,0 +1,62 @@
|
|||
///Class that describes whether an audio or video presentation is playing, paused, or suspended.
|
||||
class MediaPlaybackState {
|
||||
final int _value;
|
||||
|
||||
const MediaPlaybackState._internal(this._value);
|
||||
|
||||
///Set of all values of [MediaPlaybackState].
|
||||
static final Set<MediaPlaybackState> values = [
|
||||
MediaPlaybackState.NONE,
|
||||
MediaPlaybackState.PLAYING,
|
||||
MediaPlaybackState.PAUSED,
|
||||
MediaPlaybackState.SUSPENDED,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [MediaPlaybackState] instance from an [int] value.
|
||||
static MediaPlaybackState? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return MediaPlaybackState.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "PLAYING";
|
||||
case 2:
|
||||
return "PAUSED";
|
||||
case 3:
|
||||
return "SUSPENDED";
|
||||
case 0:
|
||||
default:
|
||||
return "NONE";
|
||||
}
|
||||
}
|
||||
|
||||
///There is no media to play back.
|
||||
static const NONE = const MediaPlaybackState._internal(0);
|
||||
|
||||
///The media is playing.
|
||||
static const PLAYING = const MediaPlaybackState._internal(1);
|
||||
|
||||
///The media playback is paused.
|
||||
static const PAUSED = const MediaPlaybackState._internal(2);
|
||||
|
||||
///The media is not playing, and cannot be resumed until the user revokes the suspension.
|
||||
static const SUSPENDED = const MediaPlaybackState._internal(3);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
import '../in_app_webview/in_app_webview_controller.dart';
|
||||
import 'meta_tag_attribute.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 content value.
|
||||
String? content;
|
||||
|
||||
///The meta tag attributes list.
|
||||
List<MetaTagAttribute>? attrs;
|
||||
|
||||
MetaTag({this.name, this.content, this.attrs});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {"name": name, "content": content, "attrs": attrs};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
import 'meta_tag.dart';
|
||||
|
||||
///Class that represents an attribute of a `<meta>` HTML tag. It is used by the [MetaTag] class.
|
||||
class MetaTagAttribute {
|
||||
///The attribute name.
|
||||
String? name;
|
||||
|
||||
///The attribute value.
|
||||
String? value;
|
||||
|
||||
MetaTagAttribute({this.name, this.value});
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"name": name,
|
||||
"value": value,
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
///Class used to configure the WebView's behavior when a secure origin attempts to load a resource from an insecure origin.
|
||||
class MixedContentMode {
|
||||
final int _value;
|
||||
|
||||
const MixedContentMode._internal(this._value);
|
||||
|
||||
///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,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [MixedContentMode] instance from an [int] value.
|
||||
static MixedContentMode? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return MixedContentMode.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "MIXED_CONTENT_NEVER_ALLOW";
|
||||
case 2:
|
||||
return "MIXED_CONTENT_COMPATIBILITY_MODE";
|
||||
case 0:
|
||||
default:
|
||||
return "MIXED_CONTENT_ALWAYS_ALLOW";
|
||||
}
|
||||
}
|
||||
|
||||
///In this mode, the WebView will allow a secure origin to load content from any other origin, even if that origin is insecure.
|
||||
///This is the least secure mode of operation for the WebView, and where possible apps should not set this mode.
|
||||
static const MIXED_CONTENT_ALWAYS_ALLOW = const MixedContentMode._internal(0);
|
||||
|
||||
///In this mode, the WebView will not allow a secure origin to load content from an insecure origin.
|
||||
///This is the preferred and most secure mode of operation for the WebView and apps are strongly advised to use this mode.
|
||||
static const MIXED_CONTENT_NEVER_ALLOW = const MixedContentMode._internal(1);
|
||||
|
||||
///In this mode, the WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.
|
||||
///Some insecure content may be allowed to be loaded by a secure origin and other types of content will be blocked.
|
||||
///The types of content are allowed or blocked may change release to release and are not explicitly defined.
|
||||
///This mode is intended to be used by apps that are not in control of the content that they render but desire to operate in a reasonably secure environment.
|
||||
///For highest security, apps are recommended to use [MixedContentMode.MIXED_CONTENT_NEVER_ALLOW].
|
||||
static const MIXED_CONTENT_COMPATIBILITY_MODE =
|
||||
const MixedContentMode._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An Android-specific class used to configure the WebView's behavior when a secure origin attempts to load a resource from an insecure origin.
|
||||
///
|
||||
///**NOTE**: available on Android 21+.
|
||||
///
|
||||
///Use [MixedContentMode] instead.
|
||||
@Deprecated("Use MixedContentMode instead")
|
||||
class AndroidMixedContentMode {
|
||||
final int _value;
|
||||
|
||||
const AndroidMixedContentMode._internal(this._value);
|
||||
|
||||
///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,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [AndroidMixedContentMode] instance from an [int] value.
|
||||
static AndroidMixedContentMode? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return AndroidMixedContentMode.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "MIXED_CONTENT_NEVER_ALLOW";
|
||||
case 2:
|
||||
return "MIXED_CONTENT_COMPATIBILITY_MODE";
|
||||
case 0:
|
||||
default:
|
||||
return "MIXED_CONTENT_ALWAYS_ALLOW";
|
||||
}
|
||||
}
|
||||
|
||||
///In this mode, the WebView will allow a secure origin to load content from any other origin, even if that origin is insecure.
|
||||
///This is the least secure mode of operation for the WebView, and where possible apps should not set this mode.
|
||||
static const MIXED_CONTENT_ALWAYS_ALLOW =
|
||||
const AndroidMixedContentMode._internal(0);
|
||||
|
||||
///In this mode, the WebView will not allow a secure origin to load content from an insecure origin.
|
||||
///This is the preferred and most secure mode of operation for the WebView and apps are strongly advised to use this mode.
|
||||
static const MIXED_CONTENT_NEVER_ALLOW =
|
||||
const AndroidMixedContentMode._internal(1);
|
||||
|
||||
///In this mode, the WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.
|
||||
///Some insecure content may be allowed to be loaded by a secure origin and other types of content will be blocked.
|
||||
///The types of content are allowed or blocked may change release to release and are not explicitly defined.
|
||||
///This mode is intended to be used by apps that are not in control of the content that they render but desire to operate in a reasonably secure environment.
|
||||
///For highest security, apps are recommended to use [AndroidMixedContentMode.MIXED_CONTENT_NEVER_ALLOW].
|
||||
static const MIXED_CONTENT_COMPATIBILITY_MODE =
|
||||
const AndroidMixedContentMode._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,205 @@
|
|||
///Class used to specify the modal presentation style when presenting a view controller.
|
||||
class ModalPresentationStyle {
|
||||
final int _value;
|
||||
|
||||
const ModalPresentationStyle._internal(this._value);
|
||||
|
||||
///Set of all values of [ModalPresentationStyle].
|
||||
static final Set<ModalPresentationStyle> values = [
|
||||
ModalPresentationStyle.FULL_SCREEN,
|
||||
ModalPresentationStyle.PAGE_SHEET,
|
||||
ModalPresentationStyle.FORM_SHEET,
|
||||
ModalPresentationStyle.CURRENT_CONTEXT,
|
||||
ModalPresentationStyle.CUSTOM,
|
||||
ModalPresentationStyle.OVER_FULL_SCREEN,
|
||||
ModalPresentationStyle.OVER_CURRENT_CONTEXT,
|
||||
ModalPresentationStyle.POPOVER,
|
||||
ModalPresentationStyle.NONE,
|
||||
ModalPresentationStyle.AUTOMATIC,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [ModalPresentationStyle] instance from an [int] value.
|
||||
static ModalPresentationStyle? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return ModalPresentationStyle.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "PAGE_SHEET";
|
||||
case 2:
|
||||
return "FORM_SHEET";
|
||||
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 8:
|
||||
return "NONE";
|
||||
case 9:
|
||||
return "AUTOMATIC";
|
||||
case 0:
|
||||
default:
|
||||
return "FULL_SCREEN";
|
||||
}
|
||||
}
|
||||
|
||||
///A presentation style in which the presented view covers the screen.
|
||||
static const FULL_SCREEN = const ModalPresentationStyle._internal(0);
|
||||
|
||||
///A presentation style that partially covers the underlying content.
|
||||
static const PAGE_SHEET = const ModalPresentationStyle._internal(1);
|
||||
|
||||
///A presentation style that displays the content centered in the screen.
|
||||
static const FORM_SHEET = const ModalPresentationStyle._internal(2);
|
||||
|
||||
///A presentation style where the content is displayed over another view controller’s content.
|
||||
static const CURRENT_CONTEXT = const ModalPresentationStyle._internal(3);
|
||||
|
||||
///A custom view presentation style that is managed by a custom presentation controller and one or more custom animator objects.
|
||||
static const CUSTOM = const ModalPresentationStyle._internal(4);
|
||||
|
||||
///A view presentation style in which the presented view covers the screen.
|
||||
static const OVER_FULL_SCREEN = const ModalPresentationStyle._internal(5);
|
||||
|
||||
///A presentation style where the content is displayed over another view controller’s content.
|
||||
static const OVER_CURRENT_CONTEXT = const ModalPresentationStyle._internal(6);
|
||||
|
||||
///A presentation style where the content is displayed in a popover view.
|
||||
static const POPOVER = const ModalPresentationStyle._internal(7);
|
||||
|
||||
///A presentation style that indicates no adaptations should be made.
|
||||
static const NONE = const ModalPresentationStyle._internal(8);
|
||||
|
||||
///The default presentation style chosen by the system.
|
||||
///
|
||||
///**NOTE**: available on iOS 13.0+.
|
||||
static const AUTOMATIC = const ModalPresentationStyle._internal(9);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An iOS-specific class used to specify the modal presentation style when presenting a view controller.
|
||||
///Use [ModalPresentationStyle] instead.
|
||||
@Deprecated("Use ModalPresentationStyle instead")
|
||||
class IOSUIModalPresentationStyle {
|
||||
final int _value;
|
||||
|
||||
const IOSUIModalPresentationStyle._internal(this._value);
|
||||
|
||||
///Set of all values of [IOSUIModalPresentationStyle].
|
||||
static final Set<IOSUIModalPresentationStyle> values = [
|
||||
IOSUIModalPresentationStyle.FULL_SCREEN,
|
||||
IOSUIModalPresentationStyle.PAGE_SHEET,
|
||||
IOSUIModalPresentationStyle.FORM_SHEET,
|
||||
IOSUIModalPresentationStyle.CURRENT_CONTEXT,
|
||||
IOSUIModalPresentationStyle.CUSTOM,
|
||||
IOSUIModalPresentationStyle.OVER_FULL_SCREEN,
|
||||
IOSUIModalPresentationStyle.OVER_CURRENT_CONTEXT,
|
||||
IOSUIModalPresentationStyle.POPOVER,
|
||||
IOSUIModalPresentationStyle.NONE,
|
||||
IOSUIModalPresentationStyle.AUTOMATIC,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [IOSUIModalPresentationStyle] instance from an [int] value.
|
||||
static IOSUIModalPresentationStyle? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return IOSUIModalPresentationStyle.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "PAGE_SHEET";
|
||||
case 2:
|
||||
return "FORM_SHEET";
|
||||
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 8:
|
||||
return "NONE";
|
||||
case 9:
|
||||
return "AUTOMATIC";
|
||||
case 0:
|
||||
default:
|
||||
return "FULL_SCREEN";
|
||||
}
|
||||
}
|
||||
|
||||
///A presentation style in which the presented view covers the screen.
|
||||
static const FULL_SCREEN = const IOSUIModalPresentationStyle._internal(0);
|
||||
|
||||
///A presentation style that partially covers the underlying content.
|
||||
static const PAGE_SHEET = const IOSUIModalPresentationStyle._internal(1);
|
||||
|
||||
///A presentation style that displays the content centered in the screen.
|
||||
static const FORM_SHEET = const IOSUIModalPresentationStyle._internal(2);
|
||||
|
||||
///A presentation style where the content is displayed over another view controller’s content.
|
||||
static const CURRENT_CONTEXT = const IOSUIModalPresentationStyle._internal(3);
|
||||
|
||||
///A custom view presentation style that is managed by a custom presentation controller and one or more custom animator objects.
|
||||
static const CUSTOM = const IOSUIModalPresentationStyle._internal(4);
|
||||
|
||||
///A view presentation style in which the presented view covers the screen.
|
||||
static const OVER_FULL_SCREEN =
|
||||
const IOSUIModalPresentationStyle._internal(5);
|
||||
|
||||
///A presentation style where the content is displayed over another view controller’s content.
|
||||
static const OVER_CURRENT_CONTEXT =
|
||||
const IOSUIModalPresentationStyle._internal(6);
|
||||
|
||||
///A presentation style where the content is displayed in a popover view.
|
||||
static const POPOVER = const IOSUIModalPresentationStyle._internal(7);
|
||||
|
||||
///A presentation style that indicates no adaptations should be made.
|
||||
static const NONE = const IOSUIModalPresentationStyle._internal(8);
|
||||
|
||||
///The default presentation style chosen by the system.
|
||||
///
|
||||
///**NOTE**: available on iOS 13.0+.
|
||||
static const AUTOMATIC = const IOSUIModalPresentationStyle._internal(9);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
///Class used to specify the transition style when presenting a view controller.
|
||||
class ModalTransitionStyle {
|
||||
final int _value;
|
||||
|
||||
const ModalTransitionStyle._internal(this._value);
|
||||
|
||||
///Set of all values of [ModalTransitionStyle].
|
||||
static final Set<ModalTransitionStyle> values = [
|
||||
ModalTransitionStyle.COVER_VERTICAL,
|
||||
ModalTransitionStyle.FLIP_HORIZONTAL,
|
||||
ModalTransitionStyle.CROSS_DISSOLVE,
|
||||
ModalTransitionStyle.PARTIAL_CURL,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [ModalTransitionStyle] instance from an [int] value.
|
||||
static ModalTransitionStyle? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return ModalTransitionStyle.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "FLIP_HORIZONTAL";
|
||||
case 2:
|
||||
return "CROSS_DISSOLVE";
|
||||
case 3:
|
||||
return "PARTIAL_CURL";
|
||||
case 0:
|
||||
default:
|
||||
return "COVER_VERTICAL";
|
||||
}
|
||||
}
|
||||
|
||||
///When the view controller is presented, its view slides up from the bottom of the screen.
|
||||
///On dismissal, the view slides back down. This is the default transition style.
|
||||
static const COVER_VERTICAL = const ModalTransitionStyle._internal(0);
|
||||
|
||||
///When the view controller is presented, the current view initiates a horizontal 3D flip from right-to-left,
|
||||
///resulting in the revealing of the new view as if it were on the back of the previous view.
|
||||
///On dismissal, the flip occurs from left-to-right, returning to the original view.
|
||||
static const FLIP_HORIZONTAL = const ModalTransitionStyle._internal(1);
|
||||
|
||||
///When the view controller is presented, the current view fades out while the new view fades in at the same time.
|
||||
///On dismissal, a similar type of cross-fade is used to return to the original view.
|
||||
static const CROSS_DISSOLVE = const ModalTransitionStyle._internal(2);
|
||||
|
||||
///When the view controller is presented, one corner of the current view curls up to reveal the presented view underneath.
|
||||
///On dismissal, the curled up page unfurls itself back on top of the presented view.
|
||||
///A view controller presented using this transition is itself prevented from presenting any additional view controllers.
|
||||
static const PARTIAL_CURL = const ModalTransitionStyle._internal(3);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
||||
|
||||
///An iOS-specific class used to specify the transition style when presenting a view controller.
|
||||
///Use [ModalTransitionStyle] instead.
|
||||
@Deprecated("Use ModalTransitionStyle instead")
|
||||
class IOSUIModalTransitionStyle {
|
||||
final int _value;
|
||||
|
||||
const IOSUIModalTransitionStyle._internal(this._value);
|
||||
|
||||
///Set of all values of [IOSUIModalTransitionStyle].
|
||||
static final Set<IOSUIModalTransitionStyle> values = [
|
||||
IOSUIModalTransitionStyle.COVER_VERTICAL,
|
||||
IOSUIModalTransitionStyle.FLIP_HORIZONTAL,
|
||||
IOSUIModalTransitionStyle.CROSS_DISSOLVE,
|
||||
IOSUIModalTransitionStyle.PARTIAL_CURL,
|
||||
].toSet();
|
||||
|
||||
///Gets a possible [IOSUIModalTransitionStyle] instance from an [int] value.
|
||||
static IOSUIModalTransitionStyle? fromValue(int? value) {
|
||||
if (value != null) {
|
||||
try {
|
||||
return IOSUIModalTransitionStyle.values
|
||||
.firstWhere((element) => element.toValue() == value);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
switch (_value) {
|
||||
case 1:
|
||||
return "FLIP_HORIZONTAL";
|
||||
case 2:
|
||||
return "CROSS_DISSOLVE";
|
||||
case 3:
|
||||
return "PARTIAL_CURL";
|
||||
case 0:
|
||||
default:
|
||||
return "COVER_VERTICAL";
|
||||
}
|
||||
}
|
||||
|
||||
///When the view controller is presented, its view slides up from the bottom of the screen.
|
||||
///On dismissal, the view slides back down. This is the default transition style.
|
||||
static const COVER_VERTICAL = const IOSUIModalTransitionStyle._internal(0);
|
||||
|
||||
///When the view controller is presented, the current view initiates a horizontal 3D flip from right-to-left,
|
||||
///resulting in the revealing of the new view as if it were on the back of the previous view.
|
||||
///On dismissal, the flip occurs from left-to-right, returning to the original view.
|
||||
static const FLIP_HORIZONTAL = const IOSUIModalTransitionStyle._internal(1);
|
||||
|
||||
///When the view controller is presented, the current view fades out while the new view fades in at the same time.
|
||||
///On dismissal, a similar type of cross-fade is used to return to the original view.
|
||||
static const CROSS_DISSOLVE = const IOSUIModalTransitionStyle._internal(2);
|
||||
|
||||
///When the view controller is presented, one corner of the current view curls up to reveal the presented view underneath.
|
||||
///On dismissal, the curled up page unfurls itself back on top of the presented view.
|
||||
///A view controller presented using this transition is itself prevented from presenting any additional view controllers.
|
||||
static const PARTIAL_CURL = const IOSUIModalTransitionStyle._internal(3);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
import 'url_request.dart';
|
||||
import 'navigation_type.dart';
|
||||
import 'frame_info.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;
|
||||
|
||||
///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
|
||||
///gesture.
|
||||
///
|
||||
///**NOTE**: available only on Android. On Android < 24, this is always `false`.
|
||||
bool? hasGesture;
|
||||
|
||||
///Use [isRedirect] instead.
|
||||
@Deprecated('Use isRedirect instead')
|
||||
bool? androidIsRedirect;
|
||||
|
||||
///Gets whether the request was a result of a server-side redirect.
|
||||
///
|
||||
///**NOTE**: available only on Android.
|
||||
///If the request is associated to the [WebView.onCreateWindow] event, this is always `false`.
|
||||
///Also, on Android < 21, this is always `false`.
|
||||
bool? isRedirect;
|
||||
|
||||
///Use [navigationType] instead.
|
||||
@Deprecated("Use navigationType instead")
|
||||
IOSWKNavigationType? iosWKNavigationType;
|
||||
|
||||
///The type of action triggering the navigation.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
NavigationType? navigationType;
|
||||
|
||||
///Use [sourceFrame] instead.
|
||||
@Deprecated("Use sourceFrame instead")
|
||||
IOSWKFrameInfo? iosSourceFrame;
|
||||
|
||||
///The frame that requested the navigation.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
FrameInfo? sourceFrame;
|
||||
|
||||
///Use [targetFrame] instead.
|
||||
@Deprecated("Use targetFrame instead")
|
||||
IOSWKFrameInfo? iosTargetFrame;
|
||||
|
||||
///The frame in which to display the new content.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
FrameInfo? targetFrame;
|
||||
|
||||
///A value indicating whether the web content used a download attribute to indicate that this should be downloaded.
|
||||
///
|
||||
///**NOTE**: available only on iOS.
|
||||
bool? shouldPerformDownload;
|
||||
|
||||
NavigationAction(
|
||||
{required this.request,
|
||||
required this.isForMainFrame,
|
||||
@Deprecated('Use hasGesture instead') this.androidHasGesture,
|
||||
this.hasGesture,
|
||||
@Deprecated('Use isRedirect instead') this.androidIsRedirect,
|
||||
this.isRedirect,
|
||||
@Deprecated("Use navigationType instead") this.iosWKNavigationType,
|
||||
this.navigationType,
|
||||
@Deprecated("Use sourceFrame instead") this.iosSourceFrame,
|
||||
this.sourceFrame,
|
||||
@Deprecated("Use targetFrame instead") this.iosTargetFrame,
|
||||
this.targetFrame,
|
||||
this.shouldPerformDownload}) {
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.hasGesture = this.hasGesture ?? this.androidHasGesture;
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.isRedirect = this.isRedirect ?? this.androidIsRedirect;
|
||||
this.navigationType = this.navigationType ??
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
NavigationType.fromValue(this.iosWKNavigationType?.toValue());
|
||||
this.sourceFrame =
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.sourceFrame ?? FrameInfo.fromMap(this.iosSourceFrame?.toMap());
|
||||
this.targetFrame =
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
this.targetFrame ?? FrameInfo.fromMap(this.iosTargetFrame?.toMap());
|
||||
}
|
||||
|
||||
///Gets a possible [NavigationAction] instance from a [Map] value.
|
||||
static NavigationAction? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return NavigationAction(
|
||||
request: URLRequest.fromMap(map["request"].cast<String, dynamic>())!,
|
||||
isForMainFrame: map["isForMainFrame"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidHasGesture: map["hasGesture"] ?? map["androidHasGesture"],
|
||||
hasGesture: map["hasGesture"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
androidIsRedirect: map["isRedirect"] ?? map["androidIsRedirect"],
|
||||
isRedirect: map["isRedirect"],
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosWKNavigationType:
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKNavigationType.fromValue(map["navigationType"]),
|
||||
navigationType: NavigationType.fromValue(map["navigationType"]),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosSourceFrame:
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKFrameInfo.fromMap(map["sourceFrame"]?.cast<String, dynamic>()),
|
||||
sourceFrame:
|
||||
FrameInfo.fromMap(map["sourceFrame"]?.cast<String, dynamic>()),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
iosTargetFrame:
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
IOSWKFrameInfo.fromMap(map["targetFrame"]?.cast<String, dynamic>()),
|
||||
targetFrame:
|
||||
FrameInfo.fromMap(map["targetFrame"]?.cast<String, dynamic>()),
|
||||
shouldPerformDownload: map["shouldPerformDownload"]);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"request": request.toMap(),
|
||||
"isForMainFrame": isForMainFrame,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"androidHasGesture": hasGesture ?? androidHasGesture,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"hasGesture": hasGesture ?? androidHasGesture,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"isRedirect": isRedirect ?? androidIsRedirect,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"androidIsRedirect": isRedirect ?? androidIsRedirect,
|
||||
"iosWKNavigationType":
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
navigationType?.toValue() ?? iosWKNavigationType?.toValue(),
|
||||
"navigationType":
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
navigationType?.toValue() ?? iosWKNavigationType?.toValue(),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"iosSourceFrame": sourceFrame?.toMap() ?? iosSourceFrame?.toMap(),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"sourceFrame": sourceFrame?.toMap() ?? iosSourceFrame?.toMap(),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"iosTargetFrame": targetFrame?.toMap() ?? iosTargetFrame?.toMap(),
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
"targetFrame": targetFrame?.toMap() ?? iosTargetFrame?.toMap(),
|
||||
"shouldPerformDownload": shouldPerformDownload
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
|
||||
///Class that is used by [WebView.shouldOverrideUrlLoading] event.
|
||||
///It represents the policy to pass back to the decision handler.
|
||||
class NavigationActionPolicy {
|
||||
final int _value;
|
||||
|
||||
const NavigationActionPolicy._internal(this._value);
|
||||
|
||||
///Gets [int] value.
|
||||
int toValue() => _value;
|
||||
|
||||
///Cancel the navigation.
|
||||
static const CANCEL = const NavigationActionPolicy._internal(0);
|
||||
|
||||
///Allow the navigation to continue.
|
||||
static const ALLOW = const NavigationActionPolicy._internal(1);
|
||||
|
||||
///Turn the navigation into a download.
|
||||
///
|
||||
///**NOTE**: available only on iOS 14.5+. It will fallback to [CANCEL].
|
||||
static const DOWNLOAD = const NavigationActionPolicy._internal(2);
|
||||
|
||||
bool operator ==(value) => value == _value;
|
||||
|
||||
@override
|
||||
int get hashCode => _value.hashCode;
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"action": _value,
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
import '../in_app_webview/webview.dart';
|
||||
import 'url_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 the response targets the web view’s main frame.
|
||||
bool isForMainFrame;
|
||||
|
||||
///A Boolean value that indicates whether WebKit is capable of displaying the response’s MIME type natively.
|
||||
bool canShowMIMEType;
|
||||
|
||||
NavigationResponse(
|
||||
{this.response,
|
||||
required this.isForMainFrame,
|
||||
required this.canShowMIMEType});
|
||||
|
||||
///Gets a possible [NavigationResponse] instance from a [Map] value.
|
||||
static NavigationResponse? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return NavigationResponse(
|
||||
response: URLResponse.fromMap(map["response"]?.cast<String, dynamic>()),
|
||||
isForMainFrame: map["isForMainFrame"],
|
||||
canShowMIMEType: map["canShowMIMEType"],
|
||||
);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"response": response?.toMap(),
|
||||
"isForMainFrame": isForMainFrame,
|
||||
"canShowMIMEType": canShowMIMEType,
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
||||
|
||||
///An iOS-specific Class that represents the navigation response used by the [WebView.onNavigationResponse] event.
|
||||
///Use [NavigationResponse] instead.
|
||||
@Deprecated("Use NavigationResponse instead")
|
||||
class IOSWKNavigationResponse {
|
||||
///The URL for the response.
|
||||
IOSURLResponse? response;
|
||||
|
||||
///A Boolean value that indicates whether the response targets the web view’s main frame.
|
||||
bool isForMainFrame;
|
||||
|
||||
///A Boolean value that indicates whether WebKit is capable of displaying the response’s MIME type natively.
|
||||
bool canShowMIMEType;
|
||||
|
||||
IOSWKNavigationResponse(
|
||||
{this.response,
|
||||
required this.isForMainFrame,
|
||||
required this.canShowMIMEType});
|
||||
|
||||
///Gets a possible [IOSWKNavigationResponse] instance from a [Map] value.
|
||||
static IOSWKNavigationResponse? fromMap(Map<String, dynamic>? map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
return IOSWKNavigationResponse(
|
||||
response:
|
||||
IOSURLResponse.fromMap(map["response"]?.cast<String, dynamic>()),
|
||||
isForMainFrame: map["isForMainFrame"],
|
||||
canShowMIMEType: map["canShowMIMEType"],
|
||||
);
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"response": response?.toMap(),
|
||||
"isForMainFrame": isForMainFrame,
|
||||
"canShowMIMEType": canShowMIMEType,
|
||||
};
|
||||
}
|
||||
|
||||
///Converts instance to a map.
|
||||
Map<String, dynamic> toJson() {
|
||||
return this.toMap();
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return toMap().toString();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue