2021-02-01 14:55:27 +00:00
|
|
|
import 'dart:collection';
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
import 'dart:typed_data';
|
|
|
|
|
2020-05-11 00:48:41 +00:00
|
|
|
import 'package:flutter/services.dart';
|
2021-03-01 02:21:07 +00:00
|
|
|
import 'package:flutter_inappwebview/src/util.dart';
|
2020-05-11 00:48:41 +00:00
|
|
|
|
2021-02-22 11:16:23 +00:00
|
|
|
import '../context_menu.dart';
|
|
|
|
import '../types.dart';
|
2020-05-11 00:48:41 +00:00
|
|
|
import 'webview.dart';
|
|
|
|
import 'in_app_webview_controller.dart';
|
2021-02-22 11:16:23 +00:00
|
|
|
import 'in_app_webview_options.dart';
|
2021-03-05 22:19:50 +00:00
|
|
|
import '../pull_to_refresh/pull_to_refresh_controller.dart';
|
|
|
|
import '../pull_to_refresh/pull_to_refresh_options.dart';
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
///Class that represents a WebView in headless mode.
|
|
|
|
///It can be used to run a WebView in background without attaching an `InAppWebView` to the widget tree.
|
|
|
|
///
|
|
|
|
///Remember to dispose it when you don't need it anymore.
|
|
|
|
class HeadlessInAppWebView implements WebView {
|
2021-03-05 22:19:50 +00:00
|
|
|
///View ID.
|
|
|
|
late final String id;
|
|
|
|
|
2021-03-23 16:13:40 +00:00
|
|
|
bool _started = false;
|
|
|
|
bool _running = false;
|
|
|
|
|
2020-05-29 17:56:03 +00:00
|
|
|
static const MethodChannel _sharedChannel =
|
|
|
|
const MethodChannel('com.pichillilorenzo/flutter_headless_inappwebview');
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
///WebView Controller that can be used to access the [InAppWebViewController] API.
|
2021-01-28 16:10:15 +00:00
|
|
|
late InAppWebViewController webViewController;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
2021-02-22 11:16:23 +00:00
|
|
|
///The window id of a [CreateWindowAction.windowId].
|
2021-01-28 16:10:15 +00:00
|
|
|
final int? windowId;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
2020-05-29 17:56:03 +00:00
|
|
|
HeadlessInAppWebView(
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
{this.windowId,
|
|
|
|
this.onWebViewCreated,
|
2020-05-29 17:56:03 +00:00
|
|
|
this.onLoadStart,
|
|
|
|
this.onLoadStop,
|
|
|
|
this.onLoadError,
|
|
|
|
this.onLoadHttpError,
|
|
|
|
this.onProgressChanged,
|
|
|
|
this.onConsoleMessage,
|
|
|
|
this.shouldOverrideUrlLoading,
|
|
|
|
this.onLoadResource,
|
|
|
|
this.onScrollChanged,
|
|
|
|
this.onDownloadStart,
|
|
|
|
this.onLoadResourceCustomScheme,
|
|
|
|
this.onCreateWindow,
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
this.onCloseWindow,
|
2020-05-29 17:56:03 +00:00
|
|
|
this.onJsAlert,
|
|
|
|
this.onJsConfirm,
|
|
|
|
this.onJsPrompt,
|
|
|
|
this.onReceivedHttpAuthRequest,
|
|
|
|
this.onReceivedServerTrustAuthRequest,
|
|
|
|
this.onReceivedClientCertRequest,
|
|
|
|
this.onFindResultReceived,
|
|
|
|
this.shouldInterceptAjaxRequest,
|
|
|
|
this.onAjaxReadyStateChange,
|
|
|
|
this.onAjaxProgress,
|
|
|
|
this.shouldInterceptFetchRequest,
|
|
|
|
this.onUpdateVisitedHistory,
|
|
|
|
this.onPrint,
|
|
|
|
this.onLongPressHitTestResult,
|
|
|
|
this.onEnterFullscreen,
|
|
|
|
this.onExitFullscreen,
|
|
|
|
this.onPageCommitVisible,
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
this.onTitleChanged,
|
|
|
|
this.onWindowFocus,
|
|
|
|
this.onWindowBlur,
|
2021-03-22 15:21:56 +00:00
|
|
|
this.onOverScrolled,
|
2020-05-29 17:56:03 +00:00
|
|
|
this.androidOnSafeBrowsingHit,
|
|
|
|
this.androidOnPermissionRequest,
|
|
|
|
this.androidOnGeolocationPermissionsShowPrompt,
|
|
|
|
this.androidOnGeolocationPermissionsHidePrompt,
|
|
|
|
this.androidShouldInterceptRequest,
|
|
|
|
this.androidOnRenderProcessGone,
|
|
|
|
this.androidOnRenderProcessResponsive,
|
|
|
|
this.androidOnRenderProcessUnresponsive,
|
|
|
|
this.androidOnFormResubmission,
|
|
|
|
this.androidOnScaleChanged,
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
this.androidOnReceivedIcon,
|
|
|
|
this.androidOnReceivedTouchIconUrl,
|
|
|
|
this.androidOnJsBeforeUnload,
|
|
|
|
this.androidOnReceivedLoginRequest,
|
2020-05-29 17:56:03 +00:00
|
|
|
this.iosOnWebContentProcessDidTerminate,
|
|
|
|
this.iosOnDidReceiveServerRedirectForProvisionalNavigation,
|
2021-02-09 23:15:10 +00:00
|
|
|
this.iosOnNavigationResponse,
|
2021-02-10 01:32:05 +00:00
|
|
|
this.iosShouldAllowDeprecatedTLS,
|
2021-02-22 11:16:23 +00:00
|
|
|
this.initialUrlRequest,
|
2020-05-29 17:56:03 +00:00
|
|
|
this.initialFile,
|
|
|
|
this.initialData,
|
|
|
|
this.initialOptions,
|
2021-02-01 14:55:27 +00:00
|
|
|
this.contextMenu,
|
2021-03-05 22:19:50 +00:00
|
|
|
this.initialUserScripts,
|
|
|
|
this.pullToRefreshController}) {
|
2021-03-11 21:42:18 +00:00
|
|
|
id = IdGenerator.generate();
|
2021-03-01 02:21:07 +00:00
|
|
|
webViewController = new InAppWebViewController(id, this);
|
2020-05-11 00:48:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Future<dynamic> handleMethod(MethodCall call) async {
|
|
|
|
switch (call.method) {
|
|
|
|
case "onHeadlessWebViewCreated":
|
2021-03-05 22:19:50 +00:00
|
|
|
pullToRefreshController?.initMethodChannel(id);
|
2021-01-28 16:10:15 +00:00
|
|
|
if (onWebViewCreated != null) {
|
|
|
|
onWebViewCreated!(webViewController);
|
|
|
|
}
|
2020-05-11 00:48:41 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return webViewController.handleMethod(call);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///Runs the headless WebView.
|
|
|
|
Future<void> run() async {
|
2021-03-23 16:13:40 +00:00
|
|
|
if (_started) {
|
2020-05-11 00:48:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-03-23 16:13:40 +00:00
|
|
|
_started = true;
|
2020-05-11 00:48:41 +00:00
|
|
|
Map<String, dynamic> args = <String, dynamic>{};
|
2021-03-01 02:21:07 +00:00
|
|
|
args.putIfAbsent('id', () => id);
|
2020-05-29 17:56:03 +00:00
|
|
|
args.putIfAbsent(
|
|
|
|
'params',
|
|
|
|
() => <String, dynamic>{
|
2021-02-22 22:54:09 +00:00
|
|
|
'initialUrlRequest': (this.initialUrlRequest ??
|
|
|
|
URLRequest(url: Uri.parse("about:blank")))
|
|
|
|
.toMap(),
|
2020-05-29 17:56:03 +00:00
|
|
|
'initialFile': this.initialFile,
|
|
|
|
'initialData': this.initialData?.toMap(),
|
|
|
|
'initialOptions': this.initialOptions?.toMap() ?? {},
|
2021-01-28 16:10:15 +00:00
|
|
|
'contextMenu': this.contextMenu?.toMap() ?? {},
|
2021-02-01 14:55:27 +00:00
|
|
|
'windowId': this.windowId,
|
2021-02-22 22:54:09 +00:00
|
|
|
'initialUserScripts':
|
|
|
|
this.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
|
2021-03-05 22:32:49 +00:00
|
|
|
'pullToRefreshOptions':
|
|
|
|
this.pullToRefreshController?.options.toMap() ??
|
|
|
|
PullToRefreshOptions(enabled: false).toMap()
|
2020-05-29 17:56:03 +00:00
|
|
|
});
|
2020-05-11 00:48:41 +00:00
|
|
|
await _sharedChannel.invokeMethod('createHeadlessWebView', args);
|
2021-03-23 16:13:40 +00:00
|
|
|
_running = true;
|
2020-05-11 00:48:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///Disposes the headless WebView.
|
|
|
|
Future<void> dispose() async {
|
2021-03-23 16:13:40 +00:00
|
|
|
if (!_running) {
|
2020-05-11 00:48:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
Map<String, dynamic> args = <String, dynamic>{};
|
2021-03-01 02:21:07 +00:00
|
|
|
args.putIfAbsent('id', () => id);
|
2020-05-11 00:48:41 +00:00
|
|
|
await _sharedChannel.invokeMethod('disposeHeadlessWebView', args);
|
2021-03-23 16:13:40 +00:00
|
|
|
_started = false;
|
|
|
|
_running = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
///Indicates if the headless WebView is running or not.
|
|
|
|
bool isRunning() {
|
|
|
|
return _running;
|
2020-05-11 00:48:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller)?
|
2020-05-29 17:56:03 +00:00
|
|
|
androidOnGeolocationPermissionsHidePrompt;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<GeolocationPermissionShowPromptResponse?> Function(
|
|
|
|
InAppWebViewController controller, String origin)?
|
2020-05-29 17:56:03 +00:00
|
|
|
androidOnGeolocationPermissionsShowPrompt;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<PermissionRequestResponse?> Function(
|
2020-05-11 00:48:41 +00:00
|
|
|
InAppWebViewController controller,
|
|
|
|
String origin,
|
2021-01-28 16:10:15 +00:00
|
|
|
List<String> resources)? androidOnPermissionRequest;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-02-22 22:54:09 +00:00
|
|
|
final Future<SafeBrowsingResponse?> Function(
|
|
|
|
InAppWebViewController controller,
|
|
|
|
Uri url,
|
|
|
|
SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final InAppWebViewInitialData? initialData;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final String? initialFile;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final InAppWebViewGroupOptions? initialOptions;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
2020-05-21 01:34:39 +00:00
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final ContextMenu? contextMenu;
|
2020-05-21 01:34:39 +00:00
|
|
|
|
2020-05-11 00:48:41 +00:00
|
|
|
@override
|
2021-02-22 11:16:23 +00:00
|
|
|
final URLRequest? initialUrlRequest;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
2021-02-01 14:55:27 +00:00
|
|
|
@override
|
|
|
|
final UnmodifiableListView<UserScript>? initialUserScripts;
|
|
|
|
|
2021-03-05 22:19:50 +00:00
|
|
|
@override
|
|
|
|
final PullToRefreshController? pullToRefreshController;
|
|
|
|
|
2020-05-11 00:48:41 +00:00
|
|
|
@override
|
2021-02-22 11:16:23 +00:00
|
|
|
final void Function(InAppWebViewController controller, Uri? url)?
|
2020-05-29 17:56:03 +00:00
|
|
|
onPageCommitVisible;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller, String? title)?
|
2020-06-29 14:37:36 +00:00
|
|
|
onTitleChanged;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller)?
|
2020-05-29 17:56:03 +00:00
|
|
|
iosOnDidReceiveServerRedirectForProvisionalNavigation;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller)?
|
2020-05-29 17:56:03 +00:00
|
|
|
iosOnWebContentProcessDidTerminate;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
2021-02-09 23:15:10 +00:00
|
|
|
@override
|
2021-02-22 22:54:09 +00:00
|
|
|
final Future<IOSNavigationResponseAction?> Function(
|
|
|
|
InAppWebViewController controller,
|
|
|
|
IOSWKNavigationResponse navigationResponse)? iosOnNavigationResponse;
|
2021-02-09 23:15:10 +00:00
|
|
|
|
2021-02-10 01:32:05 +00:00
|
|
|
@override
|
2021-02-22 22:54:09 +00:00
|
|
|
final Future<IOSShouldAllowDeprecatedTLSAction?> Function(
|
|
|
|
InAppWebViewController controller,
|
|
|
|
URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS;
|
2021-02-10 01:32:05 +00:00
|
|
|
|
2020-05-11 00:48:41 +00:00
|
|
|
@override
|
|
|
|
final Future<AjaxRequestAction> Function(
|
2021-01-28 16:10:15 +00:00
|
|
|
InAppWebViewController controller, AjaxRequest ajaxRequest)?
|
2020-05-29 17:56:03 +00:00
|
|
|
onAjaxProgress;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<AjaxRequestAction?> Function(
|
|
|
|
InAppWebViewController controller, AjaxRequest ajaxRequest)?
|
2020-05-29 17:56:03 +00:00
|
|
|
onAjaxReadyStateChange;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
final void Function(
|
2021-01-28 16:10:15 +00:00
|
|
|
InAppWebViewController controller, ConsoleMessage consoleMessage)?
|
2020-05-29 17:56:03 +00:00
|
|
|
onConsoleMessage;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<bool?> Function(InAppWebViewController controller,
|
2021-02-22 11:16:23 +00:00
|
|
|
CreateWindowAction createWindowAction)? onCreateWindow;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller)? onCloseWindow;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller)? onWindowFocus;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller)? onWindowBlur;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
2020-05-11 00:48:41 +00:00
|
|
|
@override
|
2021-02-22 11:16:23 +00:00
|
|
|
final void Function(InAppWebViewController controller, Uri url)?
|
2020-05-29 17:56:03 +00:00
|
|
|
onDownloadStart;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
final void Function(InAppWebViewController controller, int activeMatchOrdinal,
|
2021-01-28 16:10:15 +00:00
|
|
|
int numberOfMatches, bool isDoneCounting)? onFindResultReceived;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<JsAlertResponse?> Function(
|
|
|
|
InAppWebViewController controller, JsAlertRequest jsAlertRequest)?
|
2020-06-29 14:37:36 +00:00
|
|
|
onJsAlert;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<JsConfirmResponse?> Function(
|
|
|
|
InAppWebViewController controller, JsConfirmRequest jsConfirmRequest)?
|
2020-06-29 14:37:36 +00:00
|
|
|
onJsConfirm;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<JsPromptResponse?> Function(
|
|
|
|
InAppWebViewController controller, JsPromptRequest jsPromptRequest)?
|
2020-06-29 14:37:36 +00:00
|
|
|
onJsPrompt;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-02-22 11:16:23 +00:00
|
|
|
final void Function(InAppWebViewController controller, Uri? url, int code,
|
2021-01-28 16:10:15 +00:00
|
|
|
String message)? onLoadError;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-02-22 11:16:23 +00:00
|
|
|
final void Function(InAppWebViewController controller, Uri? url,
|
2021-01-28 16:10:15 +00:00
|
|
|
int statusCode, String description)? onLoadHttpError;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
final void Function(
|
2021-01-28 16:10:15 +00:00
|
|
|
InAppWebViewController controller, LoadedResource resource)?
|
2020-05-29 17:56:03 +00:00
|
|
|
onLoadResource;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<CustomSchemeResponse?> Function(
|
2021-02-22 22:54:09 +00:00
|
|
|
InAppWebViewController controller, Uri url)? onLoadResourceCustomScheme;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-02-22 22:54:09 +00:00
|
|
|
final void Function(InAppWebViewController controller, Uri? url)? onLoadStart;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-02-22 11:16:23 +00:00
|
|
|
final void Function(InAppWebViewController controller, Uri? url)? onLoadStop;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
final void Function(InAppWebViewController controller,
|
2021-01-28 16:10:15 +00:00
|
|
|
InAppWebViewHitTestResult hitTestResult)? onLongPressHitTestResult;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-02-22 11:16:23 +00:00
|
|
|
final void Function(InAppWebViewController controller, Uri? url)? onPrint;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller, int progress)?
|
2020-05-29 17:56:03 +00:00
|
|
|
onProgressChanged;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-02-22 22:54:09 +00:00
|
|
|
final Future<ClientCertResponse?> Function(InAppWebViewController controller,
|
|
|
|
URLAuthenticationChallenge challenge)? onReceivedClientCertRequest;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-02-22 22:54:09 +00:00
|
|
|
final Future<HttpAuthResponse?> Function(InAppWebViewController controller,
|
|
|
|
URLAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<ServerTrustAuthResponse?> Function(
|
2021-02-22 22:54:09 +00:00
|
|
|
InAppWebViewController controller,
|
|
|
|
URLAuthenticationChallenge challenge)? onReceivedServerTrustAuthRequest;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller, int x, int y)?
|
2020-05-29 17:56:03 +00:00
|
|
|
onScrollChanged;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
final void Function(
|
2021-02-22 11:16:23 +00:00
|
|
|
InAppWebViewController controller, Uri? url, bool? androidIsReload)?
|
2020-05-29 17:56:03 +00:00
|
|
|
onUpdateVisitedHistory;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller)? onWebViewCreated;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<AjaxRequest?> Function(
|
|
|
|
InAppWebViewController controller, AjaxRequest ajaxRequest)?
|
2020-05-29 17:56:03 +00:00
|
|
|
shouldInterceptAjaxRequest;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<FetchRequest?> Function(
|
|
|
|
InAppWebViewController controller, FetchRequest fetchRequest)?
|
2020-05-29 17:56:03 +00:00
|
|
|
shouldInterceptFetchRequest;
|
2020-05-11 00:48:41 +00:00
|
|
|
|
|
|
|
@override
|
2021-02-22 11:16:23 +00:00
|
|
|
final Future<NavigationActionPolicy?> Function(
|
|
|
|
InAppWebViewController controller, NavigationAction navigationAction)?
|
2020-05-29 17:56:03 +00:00
|
|
|
shouldOverrideUrlLoading;
|
2020-05-23 17:33:54 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller)? onEnterFullscreen;
|
2020-05-23 17:33:54 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller)? onExitFullscreen;
|
2020-05-28 23:03:45 +00:00
|
|
|
|
2021-03-22 15:21:56 +00:00
|
|
|
@override
|
2021-03-22 15:39:58 +00:00
|
|
|
final void Function(InAppWebViewController controller, int x, int y,
|
|
|
|
bool clampedX, bool clampedY)? onOverScrolled;
|
2021-03-22 15:21:56 +00:00
|
|
|
|
2020-05-28 23:03:45 +00:00
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<WebResourceResponse?> Function(
|
|
|
|
InAppWebViewController controller, WebResourceRequest request)?
|
2020-05-29 17:56:03 +00:00
|
|
|
androidShouldInterceptRequest;
|
2020-05-28 23:03:45 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<WebViewRenderProcessAction?> Function(
|
2021-02-22 11:16:23 +00:00
|
|
|
InAppWebViewController controller, Uri? url)?
|
2020-05-29 17:56:03 +00:00
|
|
|
androidOnRenderProcessUnresponsive;
|
2020-05-28 23:03:45 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<WebViewRenderProcessAction?> Function(
|
2021-02-22 11:16:23 +00:00
|
|
|
InAppWebViewController controller, Uri? url)?
|
2020-05-29 17:56:03 +00:00
|
|
|
androidOnRenderProcessResponsive;
|
2020-05-28 23:03:45 +00:00
|
|
|
|
|
|
|
@override
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
final void Function(
|
2021-01-28 16:10:15 +00:00
|
|
|
InAppWebViewController controller, RenderProcessGoneDetail detail)?
|
2020-05-29 17:56:03 +00:00
|
|
|
androidOnRenderProcessGone;
|
2020-05-28 23:03:45 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<FormResubmissionAction?> Function(
|
2021-02-22 11:16:23 +00:00
|
|
|
InAppWebViewController controller, Uri? url)? androidOnFormResubmission;
|
2020-05-28 23:03:45 +00:00
|
|
|
|
|
|
|
@override
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
final void Function(
|
2021-01-28 16:10:15 +00:00
|
|
|
InAppWebViewController controller, double oldScale, double newScale)?
|
2020-05-29 17:56:03 +00:00
|
|
|
androidOnScaleChanged;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final void Function(InAppWebViewController controller, Uint8List icon)?
|
2020-06-29 14:37:36 +00:00
|
|
|
androidOnReceivedIcon;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
|
|
|
@override
|
2020-06-29 14:37:36 +00:00
|
|
|
final void Function(
|
2021-02-22 11:16:23 +00:00
|
|
|
InAppWebViewController controller, Uri url, bool precomposed)?
|
2020-06-29 14:37:36 +00:00
|
|
|
androidOnReceivedTouchIconUrl;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-28 16:10:15 +00:00
|
|
|
final Future<JsBeforeUnloadResponse?> Function(
|
2020-06-29 14:37:36 +00:00
|
|
|
InAppWebViewController controller,
|
2021-01-28 16:10:15 +00:00
|
|
|
JsBeforeUnloadRequest jsBeforeUnloadRequest)? androidOnJsBeforeUnload;
|
Updated onCreateWindow, onJsAlert, onJsConfirm, and onJsPrompt webview events, added onCloseWindow, onTitleChanged, onWindowFocus, and onWindowBlur webview events, added androidOnRequestFocus, androidOnReceivedIcon, androidOnReceivedTouchIconUrl, androidOnJsBeforeUnload, and androidOnReceivedLoginRequest Android-specific webview events, fix #403
2020-06-29 14:34:08 +00:00
|
|
|
|
|
|
|
@override
|
2020-06-29 14:37:36 +00:00
|
|
|
final void Function(
|
2021-01-28 16:10:15 +00:00
|
|
|
InAppWebViewController controller, LoginRequest loginRequest)?
|
2020-06-29 14:37:36 +00:00
|
|
|
androidOnReceivedLoginRequest;
|
2020-05-29 17:56:03 +00:00
|
|
|
}
|