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 ' ;
2022-10-08 12:19:35 +00:00
import ' ../find_interaction/find_interaction_controller.dart ' ;
2021-03-05 22:19:50 +00:00
import ' ../pull_to_refresh/pull_to_refresh_controller.dart ' ;
2021-02-22 11:16:23 +00:00
import ' ../context_menu.dart ' ;
2022-04-26 23:03:42 +00:00
import ' ../types/main.dart ' ;
2020-05-21 01:34:39 +00:00
2020-05-11 00:48:41 +00:00
import ' in_app_webview_controller.dart ' ;
2022-04-19 23:31:14 +00:00
import ' in_app_webview_settings.dart ' ;
2020-05-29 12:51:26 +00:00
import ' headless_in_app_webview.dart ' ;
2022-10-11 15:14:48 +00:00
import ' in_app_webview.dart ' ;
import ' ../in_app_browser/in_app_browser.dart ' ;
2022-05-11 22:19:43 +00:00
import ' ../print_job/main.dart ' ;
2020-05-11 00:48:41 +00:00
2022-05-02 21:53:09 +00:00
import ' ../debug_logging_settings.dart ' ;
2022-05-02 16:59:29 +00:00
2022-04-26 13:45:36 +00:00
///Abstract class that represents a WebView. Used by [InAppWebView], [HeadlessInAppWebView] and the WebView of [InAppBrowser].
2020-05-11 00:48:41 +00:00
abstract class WebView {
2022-05-02 16:59:29 +00:00
///Debug settings used by [InAppWebView], [HeadlessInAppWebView] and [InAppBrowser].
2022-05-11 22:19:43 +00:00
///The default value excludes the [WebView.onScrollChanged], [WebView.onOverScrolled] and [WebView.onReceivedIcon] events.
2022-05-02 21:53:09 +00:00
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings (
2022-10-13 19:18:07 +00:00
maxLogMessageLength: 1000 ,
2022-05-11 22:19:43 +00:00
excludeFilter: [
RegExp ( r"onScrollChanged" ) ,
RegExp ( r"onOverScrolled" ) ,
RegExp ( r"onReceivedIcon" )
] ) ;
2022-04-26 10:16:47 +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-11 00:48:41 +00:00
///Event fired when the [WebView] is created.
2022-04-19 23:31:14 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
2022-04-22 00:24:50 +00:00
///- Web
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onWebViewCreated ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] starts to load an [url].
2020-05-28 23:03:45 +00:00
///
2022-04-22 12:41:05 +00:00
///**NOTE for Web**: it will be dispatched at the same time of [onLoadStop] event
2022-04-22 11:39:21 +00:00
///because there isn't any way to capture the real load start event from an iframe.
2022-04-25 21:21:26 +00:00
///If `window.location.href` isn't accessible inside the iframe,
///the [url] parameter will have the current value of the `iframe.src` attribute.
2022-04-22 11:39:21 +00:00
///
2022-04-15 17:20:35 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onPageStarted](https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview))
2022-04-22 00:24:50 +00:00
///- Web
2021-02-22 22:54:09 +00:00
final void Function ( InAppWebViewController controller , Uri ? url ) ? onLoadStart ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] finishes loading an [url].
2020-05-28 23:03:45 +00:00
///
2022-04-25 21:21:26 +00:00
///**NOTE for Web**: If `window.location.href` isn't accessible inside the iframe,
///the [url] parameter will have the current value of the `iframe.src` attribute.
///
2022-04-15 17:20:35 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onPageFinished](https://developer.android.com/reference/android/webkit/WebViewClient#onPageFinished(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview))
2022-04-22 00:24:50 +00:00
///- Web ([Official API - Window.onload](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event))
2021-02-22 11:16:23 +00:00
final void Function ( InAppWebViewController controller , Uri ? url ) ? onLoadStop ;
2020-05-11 00:48:41 +00:00
2022-05-01 15:06:16 +00:00
///Use [onReceivedError] instead.
@ Deprecated ( " Use onReceivedError instead " )
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
2022-05-01 15:06:16 +00:00
///Event fired when the [WebView] encounters an [error] loading a [request].
2020-05-11 00:48:41 +00:00
///
2022-05-01 15:06:16 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceError)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
final void Function ( InAppWebViewController controller ,
WebResourceRequest request , WebResourceError error ) ? onReceivedError ;
///Use [onReceivedHttpError] instead.
@ Deprecated ( " Use onReceivedHttpError instead " )
final void Function ( InAppWebViewController controller , Uri ? url ,
int statusCode , String description ) ? onLoadHttpError ;
///Event fired when the [WebView] receives an HTTP error.
2020-05-11 00:48:41 +00:00
///
2022-05-01 15:06:16 +00:00
///[request] represents the originating request.
2020-05-11 00:48:41 +00:00
///
2022-05-01 15:06:16 +00:00
///[errorResponse] represents the information about the error occurred.
2020-05-11 00:48:41 +00:00
///
///**NOTE**: available on Android 23+.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedHttpError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpError(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20android.webkit.WebResourceResponse)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
2022-05-01 15:06:16 +00:00
final void Function (
InAppWebViewController controller ,
WebResourceRequest request ,
WebResourceResponse errorResponse ) ? onReceivedHttpError ;
2020-05-11 00:48:41 +00:00
///Event fired when the current [progress] of loading a page is changed.
2020-05-28 23:03:45 +00:00
///
2022-04-15 17:20:35 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onProgressChanged](https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int)))
///- iOS
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
///Event fired when the [WebView] receives a [ConsoleMessage].
2020-05-28 23:03:45 +00:00
///
2022-04-22 12:41:05 +00:00
///**NOTE for Web**: this event will be called only if the iframe has the same origin.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onConsoleMessage](https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)))
///- iOS
2022-04-22 12:41:05 +00:00
///- Web
2020-05-11 00:48:41 +00:00
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
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. This event is not called on the initial load of the WebView.
///
///Note that on Android there isn't any way to load an URL for a frame that is not the main frame, so if the request is not for the main frame, the navigation is allowed by default.
2022-04-19 23:31:14 +00:00
///However, if you want to cancel requests for subframes, you can use the [InAppWebViewSettings.regexToCancelSubFramesLoading] option
2020-05-11 00:48:41 +00:00
///to write a Regular Expression that, if the url request of a subframe matches, then the request of that subframe is canceled.
///
///Also, on Android, this method is not called for POST requests.
///
2021-02-22 11:16:23 +00:00
///[navigationAction] represents an object that contains information about an action that causes navigation to occur.
2020-05-11 00:48:41 +00:00
///
2022-04-19 23:31:14 +00:00
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldOverrideUrlLoading] option to `true`.
2021-02-22 11:16:23 +00:00
///Also, on Android this event is not called on the first page load.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.shouldOverrideUrlLoading](https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview))
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-11 00:48:41 +00:00
///Event fired when the [WebView] loads a resource.
///
2022-04-19 23:31:14 +00:00
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnLoadResource] and [InAppWebViewSettings.javaScriptEnabled] options to `true`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
2020-05-11 00:48:41 +00:00
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
///Event fired when the [WebView] scrolls.
///
///[x] represents the current horizontal scroll origin in pixels.
///
///[y] represents the current vertical scroll origin in pixels.
2020-05-28 23:03:45 +00:00
///
2022-04-22 12:41:05 +00:00
///**NOTE for Web**: this event will be called only if the iframe has the same origin.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.onScrollChanged](https://developer.android.com/reference/android/webkit/WebView#onScrollChanged(int,%20int,%20int,%20int)))
///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidScroll](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll))
2022-04-22 12:41:05 +00:00
///- Web ([Official API - Window.onscroll](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onscroll))
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
2022-04-17 14:19:31 +00:00
///Use [onDownloadStartRequest] instead
2022-04-19 23:31:14 +00:00
@ Deprecated ( ' Use onDownloadStartRequest instead ' )
2022-04-17 14:19:31 +00:00
final void Function ( InAppWebViewController controller , Uri url ) ?
onDownloadStart ;
2020-05-29 08:49:08 +00:00
///Event fired when [WebView] recognizes a downloadable file.
///To download the file, you can use the [flutter_downloader](https://pub.dev/packages/flutter_downloader) plugin.
2020-05-11 00:48:41 +00:00
///
2022-04-17 14:19:31 +00:00
///[downloadStartRequest] represents the request of the file to download.
2020-05-11 00:48:41 +00:00
///
2022-04-19 23:31:14 +00:00
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnDownloadStart] option to `true`.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.setDownloadListener](https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener)))
///- iOS
2022-04-18 22:42:57 +00:00
final void Function ( InAppWebViewController controller ,
DownloadStartRequest downloadStartRequest ) ? onDownloadStartRequest ;
2020-05-11 00:48:41 +00:00
2022-05-08 13:08:34 +00:00
///Use [onLoadResourceWithCustomScheme] instead.
@ Deprecated ( ' Use onLoadResourceWithCustomScheme instead ' )
final Future < CustomSchemeResponse ? > Function (
InAppWebViewController controller , Uri url ) ? onLoadResourceCustomScheme ;
///Event fired when the [WebView] finds the `custom-scheme` while loading a resource.
///Here you can handle the url [request] and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler))
2021-01-28 16:10:15 +00:00
final Future < CustomSchemeResponse ? > Function (
2022-05-11 22:19:43 +00:00
InAppWebViewController controller , WebResourceRequest request ) ?
onLoadResourceWithCustomScheme ;
2020-05-11 00:48:41 +00:00
///Event fired when the [WebView] requests the host application to create a new window,
///for example when trying to open a link with `target="_blank"` or when `window.open()` is called by JavaScript side.
2020-06-30 08:58:59 +00:00
///If the host application chooses to honor this request, it should return `true` from this method, create a new WebView to host the window.
///If the host application chooses not to honor the request, it should return `false` from this method.
///The default implementation of this method does nothing and hence returns `false`.
2020-05-11 00:48:41 +00:00
///
2021-03-30 16:15:50 +00:00
///- [createWindowAction] represents the request.
2020-05-11 00:48:41 +00:00
///
2022-04-19 23:31:14 +00:00
///**NOTE**: to allow JavaScript to open windows, you need to set [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically] option to `true`.
2020-07-02 15:30:55 +00:00
///
2022-04-22 12:41:05 +00:00
///**NOTE for Android**: you need to set [InAppWebViewSettings.supportMultipleWindows] option to `true`.
2021-03-30 16:15:50 +00:00
///Also, if the request has been created using JavaScript (`window.open()`), then there are some limitation: check the [NavigationAction] class.
2020-05-28 23:03:45 +00:00
///
2022-04-22 12:41:05 +00:00
///**NOTE for iOS**: setting these initial options: [InAppWebViewSettings.supportZoom], [InAppWebViewSettings.useOnLoadResource], [InAppWebViewSettings.useShouldInterceptAjaxRequest],
2022-04-19 23:31:14 +00:00
///[InAppWebViewSettings.useShouldInterceptFetchRequest], [InAppWebViewSettings.applicationNameForUserAgent], [InAppWebViewSettings.javaScriptCanOpenWindowsAutomatically],
///[InAppWebViewSettings.javaScriptEnabled], [InAppWebViewSettings.minimumFontSize], [InAppWebViewSettings.preferredContentMode], [InAppWebViewSettings.incognito],
///[InAppWebViewSettings.cacheEnabled], [InAppWebViewSettings.mediaPlaybackRequiresUserGesture],
///[InAppWebViewSettings.resourceCustomSchemes], [InAppWebViewSettings.sharedCookiesEnabled],
///[InAppWebViewSettings.enableViewportScale], [InAppWebViewSettings.allowsAirPlayForMediaPlayback],
///[InAppWebViewSettings.allowsPictureInPictureMediaPlayback], [InAppWebViewSettings.isFraudulentWebsiteWarningEnabled],
///[InAppWebViewSettings.allowsInlineMediaPlayback], [InAppWebViewSettings.suppressesIncrementalRendering], [InAppWebViewSettings.selectionGranularity],
///[InAppWebViewSettings.ignoresViewportScaleLimits], [InAppWebViewSettings.limitsNavigationsToAppBoundDomains],
2022-04-26 10:16:47 +00:00
///[InAppWebViewSettings.upgradeKnownHostsToHTTPS],
2020-06-30 08:58:59 +00:00
///will have no effect due to a `WKWebView` limitation when creating the new window WebView: it's impossible to return the new `WKWebView`
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
///with a different `WKWebViewConfiguration` instance (see https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview).
///So, these options will be inherited from the caller WebView.
2022-04-19 23:31:14 +00:00
///Also, note that calling [InAppWebViewController.setSettings] method using the controller of the new created WebView,
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
///it will update also the WebView options of the caller WebView.
///
2022-04-28 14:48:39 +00:00
///**NOTE for Web**: this event will be called only if the iframe has the same origin. It works only for `window.open()` javascript calls.
2022-04-23 20:10:02 +00:00
///Also, there is no way to block the opening the window in a synchronous way, so returning `true` will just close it quickly.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onCreateWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCreateWindow(android.webkit.WebView,%20boolean,%20boolean,%20android.os.Message)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview))
2022-04-23 20:10:02 +00:00
///- Web
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
///Event fired when the host application should close the given WebView and remove it from the view system if necessary.
///At this point, WebCore has stopped any loading in this window and has removed any cross-scripting ability in javascript.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onCloseWindow](https://developer.android.com/reference/android/webkit/WebChromeClient#onCloseWindow(android.webkit.WebView)))
///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
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
///Event fired when the JavaScript `window` object of the WebView has received focus.
///This is the result of the `focus` JavaScript event applied to the `window` object.
2022-04-19 23:31:14 +00:00
///
2022-04-23 20:10:02 +00:00
///**NOTE for Web**: this event will be called only if the iframe has the same origin.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
2022-04-23 20:10:02 +00:00
///- Web ([Official API - Window.onfocus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event))
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
///Event fired when the JavaScript `window` object of the WebView has lost focus.
///This is the result of the `blur` JavaScript event applied to the `window` object.
2022-04-19 23:31:14 +00:00
///
2022-04-23 20:10:02 +00:00
///**NOTE for Web**: this event will be called only if the iframe has the same origin.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
2022-04-23 20:10:02 +00:00
///- Web ([Official API - Window.onblur](https://developer.mozilla.org/en-US/docs/Web/API/Window/blur_event))
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onWindowBlur ;
2020-05-11 00:48:41 +00:00
///Event fired when javascript calls the `alert()` method to display an alert dialog.
///If [JsAlertResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///
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
///[jsAlertRequest] contains the message to be displayed in the alert dialog and the of the page requesting the dialog.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsAlert](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsAlert(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview))
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
///Event fired when javascript calls the `confirm()` method to display a confirm dialog.
///If [JsConfirmResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///
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
///[jsConfirmRequest] contains the message to be displayed in the confirm dialog and the of the page requesting the dialog.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsConfirm](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsConfirm(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview))
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
///Event fired when javascript calls the `prompt()` method to display a prompt dialog.
///If [JsPromptResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///
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
///[jsPromptRequest] contains the message to be displayed in the prompt dialog, the default value displayed in the prompt dialog, and the of the page requesting the dialog.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult)))
///- iOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview))
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
///Event fired when the WebView received an HTTP authentication request. The default behavior is to cancel the request.
///
2021-02-10 01:32:05 +00:00
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [URLAuthenticationChallenge].
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedHttpAuthRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
2021-02-22 22:54:09 +00:00
final Future < HttpAuthResponse ? > Function ( InAppWebViewController controller ,
HttpAuthenticationChallenge challenge ) ? onReceivedHttpAuthRequest ;
2020-05-11 00:48:41 +00:00
///Event fired when the WebView need to perform server trust authentication (certificate validation).
///The host application must return either [ServerTrustAuthResponse] instance with [ServerTrustAuthResponseAction.CANCEL] or [ServerTrustAuthResponseAction.PROCEED].
///
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ServerTrustChallenge].
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedSslError](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
2021-01-28 16:10:15 +00:00
final Future < ServerTrustAuthResponse ? > Function (
InAppWebViewController controller , ServerTrustChallenge challenge ) ?
2020-05-29 17:56:03 +00:00
onReceivedServerTrustAuthRequest ;
2020-05-11 00:48:41 +00:00
///Notify the host application to handle an SSL client certificate request.
///Webview stores the response in memory (for the life of the application) if [ClientCertResponseAction.PROCEED] or [ClientCertResponseAction.CANCEL]
///is called and does not call [onReceivedClientCertRequest] again for the same host and port pair.
///Note that, multiple layers in chromium network stack might be caching the responses.
///
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ClientCertChallenge].
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedClientCertRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
2021-01-28 16:10:15 +00:00
final Future < ClientCertResponse ? > Function (
InAppWebViewController controller , ClientCertChallenge challenge ) ?
2020-05-29 17:56:03 +00:00
onReceivedClientCertRequest ;
2020-05-11 00:48:41 +00:00
2022-10-08 12:19:35 +00:00
///Use [FindInteractionController.onFindResultReceived] instead.
@ Deprecated ( ' Use FindInteractionController.onFindResultReceived instead ' )
2020-05-11 00:48:41 +00:00
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
///Event fired when an `XMLHttpRequest` is sent to a server.
///It gives the host application a chance to take control over the request before sending it.
///
///[ajaxRequest] represents the `XMLHttpRequest`.
///
2022-04-19 23:31:14 +00:00
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] option to `true`.
2020-05-11 00:48:41 +00:00
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
2022-04-19 23:31:14 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
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
///Event fired whenever the `readyState` attribute of an `XMLHttpRequest` changes.
///It gives the host application a chance to abort the request.
///
///[ajaxRequest] represents the [XMLHttpRequest].
///
2022-04-19 23:31:14 +00:00
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] option to `true`.
2020-05-11 00:48:41 +00:00
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
2022-04-19 23:31:14 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
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
///Event fired as an `XMLHttpRequest` progress.
///It gives the host application a chance to abort the request.
///
///[ajaxRequest] represents the [XMLHttpRequest].
///
2022-04-19 23:31:14 +00:00
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptAjaxRequest] option to `true`.
2020-05-11 00:48:41 +00:00
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
2022-04-19 23:31:14 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
2021-01-28 16:10:15 +00:00
final Future < AjaxRequestAction ? > Function (
InAppWebViewController controller , AjaxRequest ajaxRequest ) ?
2020-05-29 17:56:03 +00:00
onAjaxProgress ;
2020-05-11 00:48:41 +00:00
///Event fired when a request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API).
///It gives the host application a chance to take control over the request before sending it.
///
///[fetchRequest] represents a resource request.
///
2022-04-19 23:31:14 +00:00
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptFetchRequest] option to `true`.
2020-05-11 00:48:41 +00:00
///Also, unlike iOS that has [WKUserScript](https://developer.apple.com/documentation/webkit/wkuserscript) that
///can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code
///used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the fetch requests will be intercept for sure.
2022-04-19 23:31:14 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
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
///Event fired when the host application updates its visited links database.
///This event is also fired when the navigation state of the [WebView] changes through the usage of
///javascript **[History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API)** functions (`pushState()`, `replaceState()`) and `onpopstate` event
///or, also, when the javascript `window.location` changes without reloading the webview (for example appending or modifying an hash to the url).
///
///[url] represents the url being visited.
///
2022-04-19 23:31:14 +00:00
///[isReload] indicates if this url is being reloaded. Available only on Android.
2020-05-28 23:03:45 +00:00
///
2022-04-22 12:41:05 +00:00
///**NOTE for Web**: this event will be called only if the iframe has the same origin.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.doUpdateVisitedHistory](https://developer.android.com/reference/android/webkit/WebViewClient#doUpdateVisitedHistory(android.webkit.WebView,%20java.lang.String,%20boolean)))
///- iOS
2022-04-22 11:39:21 +00:00
///- Web
2020-05-11 00:48:41 +00:00
final void Function (
2022-04-19 23:31:14 +00:00
InAppWebViewController controller , Uri ? url , bool ? isReload ) ?
2020-05-29 17:56:03 +00:00
onUpdateVisitedHistory ;
2020-05-11 00:48:41 +00:00
2022-05-11 22:19:43 +00:00
///Use [onPrintRequest] instead
@ Deprecated ( " Use onPrintRequest instead " )
final void Function ( InAppWebViewController controller , Uri ? url ) ? onPrint ;
2020-05-11 00:48:41 +00:00
///Event fired when `window.print()` is called from JavaScript side.
2022-05-11 22:19:43 +00:00
///Return `true` if you want to handle the print job.
///Otherwise return `false`, so the [PrintJobController] will be handled and disposed automatically by the system.
2020-05-11 00:48:41 +00:00
///
///[url] represents the url on which is called.
///
2022-05-11 22:19:43 +00:00
///[printJobController] represents the controller of the print job created.
///**NOTE**: on Web, it is always `null`
///
2022-04-23 20:10:02 +00:00
///**NOTE for Web**: this event will be called only if the iframe has the same origin.
///
2022-04-15 17:20:35 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
2022-04-23 20:10:02 +00:00
///- Web
2022-05-11 22:19:43 +00:00
final Future < bool ? > Function ( InAppWebViewController controller , Uri ? url ,
PrintJobController ? printJobController ) ? onPrintRequest ;
2020-05-11 00:48:41 +00:00
///Event fired when an HTML element of the webview has been clicked and held.
///
///[hitTestResult] represents the hit result for hitting an HTML elements.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - View.setOnLongClickListener](https://developer.android.com/reference/android/view/View#setOnLongClickListener(android.view.View.OnLongClickListener)))
///- iOS ([Official API - UILongPressGestureRecognizer](https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer))
2020-05-11 00:48:41 +00:00
final void Function ( InAppWebViewController controller ,
2021-01-28 16:10:15 +00:00
InAppWebViewHitTestResult hitTestResult ) ? onLongPressHitTestResult ;
2020-05-11 00:48:41 +00:00
2020-05-23 17:33:54 +00:00
///Event fired when the current page has entered full screen mode.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onShowCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onShowCustomView(android.view.View,%20android.webkit.WebChromeClient.CustomViewCallback)))
///- iOS ([Official API - UIWindow.didBecomeVisibleNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621621-didbecomevisiblenotification))
2022-04-23 20:10:02 +00:00
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onEnterFullscreen ;
2020-05-23 17:33:54 +00:00
///Event fired when the current page has exited full screen mode.
2020-05-28 23:03:45 +00:00
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onHideCustomView()
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-28 23:03:45 +00:00
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiwindow/1621617-didbecomehiddennotification
2022-04-19 23:31:14 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onHideCustomView](https://developer.android.com/reference/android/webkit/WebChromeClient#onHideCustomView()))
///- iOS ([Official API - UIWindow.didBecomeHiddenNotification](https://developer.apple.com/documentation/uikit/uiwindow/1621617-didbecomehiddennotification))
2022-04-23 20:10:02 +00:00
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ? onExitFullscreen ;
2020-05-23 17:33:54 +00:00
2020-05-28 23:03:45 +00:00
///Called when the web view begins to receive web content.
///
///This event occurs early in the document loading process, and as such
///you should expect that linked resources (for example, CSS and images) may not be available.
///
///[url] represents the URL corresponding to the page navigation that triggered this callback.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onPageCommitVisible](https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String)))
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
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-28 23:03:45 +00:00
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
///Event fired when a change in the document title occurred.
///
///[title] represents the string containing the new title of the document.
///
2022-04-23 20:10:02 +00:00
///**NOTE for Web**: this event will be called only if the iframe has the same origin.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onReceivedTitle](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String)))
///- iOS
2022-04-23 20:10:02 +00:00
///- Web
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
2021-03-22 15:21:56 +00:00
///Event fired to respond to the results of an over-scroll operation.
///
///[x] represents the new X scroll value in pixels.
///
///[y] represents the new Y scroll value in pixels.
///
///[clampedX] is `true` if [x] was clamped to an over-scroll boundary.
///
///[clampedY] is `true` if [y] was clamped to an over-scroll boundary.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebView.onOverScrolled](https://developer.android.com/reference/android/webkit/WebView#onOverScrolled(int,%20int,%20boolean,%20boolean)))
///- iOS
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
2021-03-26 20:04:44 +00:00
///Event fired when the zoom scale of the WebView has changed.
///
///[oldScale] The old zoom scale factor.
///
///[newScale] The new zoom scale factor.
///
2022-04-23 20:10:02 +00:00
///**NOTE for Web**: this event will be called only if the iframe has the same origin.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onScaleChanged](https://developer.android.com/reference/android/webkit/WebViewClient#onScaleChanged(android.webkit.WebView,%20float,%20float)))
///- iOS ([Official API - UIScrollViewDelegate.scrollViewDidZoom](https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619409-scrollviewdidzoom))
2022-04-23 20:10:02 +00:00
///- Web
2021-03-26 20:04:44 +00:00
final void Function (
2021-03-28 02:17:09 +00:00
InAppWebViewController controller , double oldScale , double newScale ) ?
onZoomScaleChanged ;
2021-03-26 20:04:44 +00:00
2022-04-19 23:31:14 +00:00
///Use [onSafeBrowsingHit] instead.
@ Deprecated ( " Use onSafeBrowsingHit instead " )
final Future < SafeBrowsingResponse ? > Function (
InAppWebViewController controller ,
Uri url ,
SafeBrowsingThreat ? threatType ) ? androidOnSafeBrowsingHit ;
2020-05-11 00:48:41 +00:00
///Event fired when the webview notifies that a loading URL has been flagged by Safe Browsing.
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
///
///[url] represents the url of the request.
///
///[threatType] represents the reason the resource was caught by Safe Browsing, corresponding to a [SafeBrowsingThreat].
///
///**NOTE**: available only on Android 27+.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onSafeBrowsingHit](https://developer.android.com/reference/android/webkit/WebViewClient#onSafeBrowsingHit(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20int,%20android.webkit.SafeBrowsingResponse)))
2021-02-22 22:54:09 +00:00
final Future < SafeBrowsingResponse ? > Function (
InAppWebViewController controller ,
Uri url ,
2022-04-19 23:31:14 +00:00
SafeBrowsingThreat ? threatType ) ? onSafeBrowsingHit ;
///Use [onPermissionRequest] instead.
@ Deprecated ( " Use onPermissionRequest instead " )
final Future < PermissionRequestResponse ? > Function (
InAppWebViewController controller ,
String origin ,
List < String > resources ) ? androidOnPermissionRequest ;
2020-05-11 00:48:41 +00:00
///Event fired when the WebView is requesting permission to access the specified resources and the permission currently isn't granted or denied.
///
///[origin] represents the origin of the web page which is trying to access the restricted resources.
///
///[resources] represents the array of resources the web content wants to access.
///
2022-05-02 16:59:29 +00:00
///**NOTE for Android**: available only on Android 23+.
///
///**NOTE for iOS**: available only on iOS 15.0+. The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onPermissionRequest](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest)))
2022-05-02 16:59:29 +00:00
///- iOS
2022-04-23 12:00:47 +00:00
final Future < PermissionResponse ? > Function ( InAppWebViewController controller ,
2022-04-21 10:20:48 +00:00
PermissionRequest permissionRequest ) ? onPermissionRequest ;
2022-04-19 23:31:14 +00:00
///Use [onGeolocationPermissionsShowPrompt] instead.
@ Deprecated ( " Use onGeolocationPermissionsShowPrompt instead " )
final Future < GeolocationPermissionShowPromptResponse ? > Function (
InAppWebViewController controller , String origin ) ?
androidOnGeolocationPermissionsShowPrompt ;
2020-05-11 00:48:41 +00:00
///Event that notifies the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin.
///Note that for applications targeting Android N and later SDKs (API level > `Build.VERSION_CODES.M`) this method is only called for requests originating from secure origins such as https.
///On non-secure origins geolocation requests are automatically denied.
///
///[origin] represents the origin of the web content attempting to use the Geolocation API.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsShowPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)))
2021-01-28 16:10:15 +00:00
final Future < GeolocationPermissionShowPromptResponse ? > Function (
2022-04-20 01:05:46 +00:00
InAppWebViewController controller , String origin ) ?
onGeolocationPermissionsShowPrompt ;
2022-04-19 23:31:14 +00:00
///Use [onGeolocationPermissionsHidePrompt] instead.
@ Deprecated ( " Use onGeolocationPermissionsHidePrompt instead " )
final void Function ( InAppWebViewController controller ) ?
androidOnGeolocationPermissionsHidePrompt ;
2020-05-11 00:48:41 +00:00
2022-04-19 23:31:14 +00:00
///Notify the host application that a request for Geolocation permissions, made with a previous call to [onGeolocationPermissionsShowPrompt] has been canceled.
2020-05-11 00:48:41 +00:00
///Any related UI should therefore be hidden.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsHidePrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt()))
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ?
2022-04-20 01:05:46 +00:00
onGeolocationPermissionsHidePrompt ;
2022-04-19 23:31:14 +00:00
///Use [shouldInterceptRequest] instead.
@ Deprecated ( " Use shouldInterceptRequest instead " )
final Future < WebResourceResponse ? > Function (
InAppWebViewController controller , WebResourceRequest request ) ?
androidShouldInterceptRequest ;
2020-05-11 00:48:41 +00:00
2020-05-28 23:03:45 +00:00
///Notify the host application of a resource request and allow the application to return the data.
///If the return value is `null`, the WebView will continue to load the resource as usual.
///Otherwise, the return response and data will be used.
///
///This callback is invoked for a variety of URL schemes (e.g., `http(s):`, `data:`, `file:`, etc.),
///not only those schemes which send requests over the network.
///This is not called for `javascript:` URLs, `blob:` URLs, or for assets accessed via `file:///android_asset/` or `file:///android_res/` URLs.
///
///In the case of redirects, this is only called for the initial resource URL, not any subsequent redirect URLs.
///
///[request] Object containing the details of the request.
///
2022-04-19 23:31:14 +00:00
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useShouldInterceptRequest] option to `true`.
2020-05-28 23:03:45 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.shouldInterceptRequest](https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)))
2021-01-28 16:10:15 +00:00
final Future < WebResourceResponse ? > Function (
2022-04-20 01:05:46 +00:00
InAppWebViewController controller , WebResourceRequest request ) ?
shouldInterceptRequest ;
2022-04-19 23:31:14 +00:00
///Use [onRenderProcessUnresponsive] instead.
@ Deprecated ( " Use onRenderProcessUnresponsive instead " )
final Future < WebViewRenderProcessAction ? > Function (
InAppWebViewController controller , Uri ? url ) ?
androidOnRenderProcessUnresponsive ;
2020-05-28 23:03:45 +00:00
///Event called when the renderer currently associated with the WebView becomes unresponsive as a result of a long running blocking task such as the execution of JavaScript.
///
///If a WebView fails to process an input event, or successfully navigate to a new URL within a reasonable time frame, the renderer is considered to be unresponsive, and this callback will be called.
///
///This callback will continue to be called at regular intervals as long as the renderer remains unresponsive.
2022-04-19 23:31:14 +00:00
///If the renderer becomes responsive again, [onRenderProcessResponsive] will be called once,
2020-05-28 23:03:45 +00:00
///and this method will not subsequently be called unless another period of unresponsiveness is detected.
///
2022-04-19 23:31:14 +00:00
///The minimum interval between successive calls to [onRenderProcessUnresponsive] is 5 seconds.
2020-05-28 23:03:45 +00:00
///
///No action is taken by WebView as a result of this method call.
///Applications may choose to terminate the associated renderer via the object that is passed to this callback,
2022-04-19 23:31:14 +00:00
///if in multiprocess mode, however this must be accompanied by correctly handling [onRenderProcessGone] for this WebView,
2020-05-28 23:03:45 +00:00
///and all other WebViews associated with the same renderer. Failure to do so will result in application termination.
///
///**NOTE**: available only on Android 29+.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessUnresponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)))
final Future < WebViewRenderProcessAction ? > Function (
2022-04-20 01:05:46 +00:00
InAppWebViewController controller , Uri ? url ) ? onRenderProcessUnresponsive ;
2022-04-19 23:31:14 +00:00
///Use [onRenderProcessResponsive] instead.
@ Deprecated ( " Use onRenderProcessResponsive instead " )
2021-01-28 16:10:15 +00:00
final Future < WebViewRenderProcessAction ? > Function (
2021-02-22 11:16:23 +00:00
InAppWebViewController controller , Uri ? url ) ?
2022-04-19 23:31:14 +00:00
androidOnRenderProcessResponsive ;
2020-05-28 23:03:45 +00:00
///Event called once when an unresponsive renderer currently associated with the WebView becomes responsive.
///
2022-04-19 23:31:14 +00:00
///After a WebView renderer becomes unresponsive, which is notified to the application by [onRenderProcessUnresponsive],
2020-05-28 23:03:45 +00:00
///it is possible for the blocking renderer task to complete, returning the renderer to a responsive state.
///In that case, this method is called once to indicate responsiveness.
///
///No action is taken by WebView as a result of this method call.
///
///**NOTE**: available only on Android 29+.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessResponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)))
2021-01-28 16:10:15 +00:00
final Future < WebViewRenderProcessAction ? > Function (
2022-04-20 01:05:46 +00:00
InAppWebViewController controller , Uri ? url ) ? onRenderProcessResponsive ;
2022-04-19 23:31:14 +00:00
///Use [onRenderProcessGone] instead.
@ Deprecated ( " Use onRenderProcessGone instead " )
final void Function (
InAppWebViewController controller , RenderProcessGoneDetail detail ) ?
androidOnRenderProcessGone ;
2020-05-28 23:03:45 +00:00
///Event fired when the given WebView's render process has exited.
///The application's implementation of this callback should only attempt to clean up the WebView.
///The WebView should be removed from the view hierarchy, all references to it should be cleaned up.
///
///[detail] the reason why it exited.
///
///**NOTE**: available only on Android 26+.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onRenderProcessGone](https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail)))
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 (
2022-04-20 01:05:46 +00:00
InAppWebViewController controller , RenderProcessGoneDetail detail ) ?
onRenderProcessGone ;
2022-04-19 23:31:14 +00:00
///Use [onFormResubmission] instead.
@ Deprecated ( ' Use onFormResubmission instead ' )
final Future < FormResubmissionAction ? > Function (
InAppWebViewController controller , Uri ? url ) ? androidOnFormResubmission ;
2020-05-28 23:03:45 +00:00
///As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onFormResubmission](https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)))
2021-01-28 16:10:15 +00:00
final Future < FormResubmissionAction ? > Function (
2022-04-19 23:31:14 +00:00
InAppWebViewController controller , Uri ? url ) ? onFormResubmission ;
2020-05-28 23:03:45 +00:00
2021-03-26 20:04:44 +00:00
///Use [onZoomScaleChanged] instead.
2022-04-19 23:31:14 +00:00
@ Deprecated ( ' Use onZoomScaleChanged instead ' )
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 ;
2020-05-28 23:03:45 +00:00
2022-04-19 23:31:14 +00:00
///Use [onReceivedIcon] instead.
@ Deprecated ( ' Use onReceivedIcon instead ' )
final void Function ( InAppWebViewController controller , Uint8List icon ) ?
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
///Event fired when there is new favicon for the current page.
///
///[icon] represents the favicon for the current page.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onReceivedIcon](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap)))
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller , Uint8List icon ) ?
2022-04-20 01:05:46 +00:00
onReceivedIcon ;
2022-04-19 23:31:14 +00:00
///Use [onReceivedTouchIconUrl] instead.
@ Deprecated ( ' Use onReceivedTouchIconUrl instead ' )
final void Function (
InAppWebViewController controller , Uri url , bool precomposed ) ?
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
///Event fired when there is an url for an apple-touch-icon.
///
///[url] represents the icon url.
///
///[precomposed] is `true` if the url is for a precomposed touch icon.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onReceivedTouchIconUrl](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean)))
2020-06-29 14:37:36 +00:00
final void Function (
2022-04-20 01:05:46 +00:00
InAppWebViewController controller , Uri url , bool precomposed ) ?
onReceivedTouchIconUrl ;
2022-04-19 23:31:14 +00:00
///Use [onJsBeforeUnload] instead.
@ Deprecated ( ' Use onJsBeforeUnload instead ' )
final Future < JsBeforeUnloadResponse ? > Function (
InAppWebViewController controller ,
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
///Event fired when the client should display a dialog to confirm navigation away from the current page.
///This is the result of the `onbeforeunload` javascript event.
///If [JsBeforeUnloadResponse.handledByClient] is `true`, WebView will assume that the client will handle the confirm dialog.
///If [JsBeforeUnloadResponse.handledByClient] is `false`, a default value of `true` will be returned to javascript to accept navigation away from the current page.
///The default behavior is to return `false`.
///Setting the [JsBeforeUnloadResponse.action] to [JsBeforeUnloadResponseAction.CONFIRM] will navigate away from the current page,
///[JsBeforeUnloadResponseAction.CANCEL] will cancel the navigation.
///
///[jsBeforeUnloadRequest] contains the message to be displayed in the alert dialog and the of the page requesting the dialog.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onJsBeforeUnload](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsBeforeUnload(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
2021-01-28 16:10:15 +00:00
final Future < JsBeforeUnloadResponse ? > Function (
2020-06-29 14:37:36 +00:00
InAppWebViewController controller ,
2022-04-19 23:31:14 +00:00
JsBeforeUnloadRequest jsBeforeUnloadRequest ) ? onJsBeforeUnload ;
///Use [onReceivedLoginRequest] instead.
@ Deprecated ( ' Use onReceivedLoginRequest instead ' )
final void Function (
InAppWebViewController controller , LoginRequest loginRequest ) ?
androidOnReceivedLoginRequest ;
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
///Event fired when a request to automatically log in the user has been processed.
///
///[loginRequest] contains the realm, account and args of the login request.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebViewClient.onReceivedLoginRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedLoginRequest(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String)))
2020-06-29 14:37:36 +00:00
final void Function (
2022-04-20 01:05:46 +00:00
InAppWebViewController controller , LoginRequest loginRequest ) ?
onReceivedLoginRequest ;
2022-04-19 23:31:14 +00:00
///Use [onWebContentProcessDidTerminate] instead.
@ Deprecated ( ' Use onWebContentProcessDidTerminate instead ' )
final void Function ( InAppWebViewController controller ) ?
iosOnWebContentProcessDidTerminate ;
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
///Invoked when the web view's web content process is terminated.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ?
2022-04-20 01:05:46 +00:00
onWebContentProcessDidTerminate ;
2022-04-19 23:31:14 +00:00
///Use [onDidReceiveServerRedirectForProvisionalNavigation] instead.
@ Deprecated ( ' Use onDidReceiveServerRedirectForProvisionalNavigation instead ' )
final void Function ( InAppWebViewController controller ) ?
iosOnDidReceiveServerRedirectForProvisionalNavigation ;
2020-05-11 00:48:41 +00:00
///Called when a web view receives a server redirect.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
2021-01-28 16:10:15 +00:00
final void Function ( InAppWebViewController controller ) ?
2022-04-20 01:05:46 +00:00
onDidReceiveServerRedirectForProvisionalNavigation ;
2022-04-19 23:31:14 +00:00
///Use [onNavigationResponse] instead.
@ Deprecated ( ' Use onNavigationResponse instead ' )
final Future < IOSNavigationResponseAction ? > Function (
InAppWebViewController controller ,
IOSWKNavigationResponse navigationResponse ) ? iosOnNavigationResponse ;
2020-05-11 00:48:41 +00:00
2021-02-09 23:15:10 +00:00
///Called when a web view asks for permission to navigate to new content after the response to the navigation request is known.
///
///[navigationResponse] represents the navigation response.
///
2022-04-19 23:31:14 +00:00
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewSettings.useOnNavigationResponse] option to `true`.
2021-02-10 01:35:07 +00:00
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
final Future < NavigationResponseAction ? > Function (
2021-02-22 22:54:09 +00:00
InAppWebViewController controller ,
2022-04-19 23:31:14 +00:00
NavigationResponse navigationResponse ) ? onNavigationResponse ;
///Use [shouldAllowDeprecatedTLS] instead.
@ Deprecated ( ' Use shouldAllowDeprecatedTLS instead ' )
final Future < IOSShouldAllowDeprecatedTLSAction ? > Function (
InAppWebViewController controller ,
URLAuthenticationChallenge challenge ) ? iosShouldAllowDeprecatedTLS ;
2021-02-09 23:15:10 +00:00
2021-02-10 01:32:05 +00:00
///Called when a web view asks whether to continue with a connection that uses a deprecated version of TLS (v1.0 and v1.1).
///
///[challenge] represents the authentication challenge.
///
///**NOTE**: available only on iOS 14.0+.
///
2022-04-19 23:31:14 +00:00
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview))
final Future < ShouldAllowDeprecatedTLSAction ? > Function (
2021-02-22 22:54:09 +00:00
InAppWebViewController controller ,
2022-04-19 23:31:14 +00:00
URLAuthenticationChallenge challenge ) ? shouldAllowDeprecatedTLS ;
2021-02-10 01:32:05 +00:00
2022-05-02 14:54:34 +00:00
///Event fired when a change in the camera capture state occurred.
///
///**NOTE**: available only on iOS 15.0+.
///
///**Supported Platforms/Implementations**:
///- iOS
final Future < void > Function (
InAppWebViewController controller ,
MediaCaptureState ? oldState ,
MediaCaptureState ? newState ,
) ? onCameraCaptureStateChanged ;
///Event fired when a change in the microphone capture state occurred.
///
///**NOTE**: available only on iOS 15.0+.
///
///**Supported Platforms/Implementations**:
///- iOS
final Future < void > Function (
InAppWebViewController controller ,
MediaCaptureState ? oldState ,
MediaCaptureState ? newState ,
) ? onMicrophoneCaptureStateChanged ;
2021-02-22 11:16:23 +00:00
///Initial url request that will be loaded.
2021-02-22 22:38:30 +00:00
///
///**NOTE for Android**: when loading an URL Request using "POST" method, headers are ignored.
2022-04-21 21:14:51 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- Web
2021-02-22 11:16:23 +00:00
final URLRequest ? initialUrlRequest ;
2020-05-11 00:48:41 +00:00
///Initial asset file that will be loaded. See [InAppWebViewController.loadFile] for explanation.
2022-04-21 21:14:51 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- Web
2021-01-28 16:10:15 +00:00
final String ? initialFile ;
2020-05-11 00:48:41 +00:00
///Initial [InAppWebViewInitialData] that will be loaded.
2022-04-21 21:14:51 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- Web
2021-01-28 16:10:15 +00:00
final InAppWebViewInitialData ? initialData ;
2020-05-11 00:48:41 +00:00
2022-04-19 23:31:14 +00:00
///Use [initialSettings] instead.
@ Deprecated ( ' Use initialSettings instead ' )
2021-01-28 16:10:15 +00:00
final InAppWebViewGroupOptions ? initialOptions ;
2020-05-11 00:48:41 +00:00
2022-04-19 23:31:14 +00:00
///Initial settings that will be used.
2022-04-21 21:14:51 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- Web
2022-04-19 23:31:14 +00:00
final InAppWebViewSettings ? initialSettings ;
2020-05-21 01:34:39 +00:00
///Context menu which contains custom menu items to be shown when [ContextMenu] is presented.
2022-04-21 21:14:51 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
2021-01-28 16:10:15 +00:00
final ContextMenu ? contextMenu ;
2020-05-21 01:34:39 +00:00
2021-02-01 14:55:27 +00:00
///Initial list of user scripts to be loaded at start or end of a page loading.
///To add or remove user scripts, you have to use the [InAppWebViewController]'s methods such as [InAppWebViewController.addUserScript],
///[InAppWebViewController.removeUserScript], [InAppWebViewController.removeAllUserScripts], etc.
2021-02-22 11:16:23 +00:00
///
///**NOTE for iOS**: this property will be ignored if the [WebView.windowId] has been set.
///There isn't any way to add/remove user scripts specific to iOS window WebViews.
///This is a limitation of the native iOS WebKit APIs.
2022-04-21 21:14:51 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
2021-02-01 14:55:27 +00:00
final UnmodifiableListView < UserScript > ? initialUserScripts ;
2021-03-05 22:19:50 +00:00
///Represents the pull-to-refresh feature controller.
2021-03-06 15:10:31 +00:00
///
2022-04-19 23:31:14 +00:00
///**NOTE for Android**: to be able to use the "pull-to-refresh" feature, [InAppWebViewSettings.useHybridComposition] must be `true`.
2022-04-21 21:14:51 +00:00
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
2021-03-05 22:19:50 +00:00
final PullToRefreshController ? pullToRefreshController ;
2022-10-08 12:19:35 +00:00
///Represents the find interaction feature controller.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
final FindInteractionController ? findInteractionController ;
2022-04-15 17:20:35 +00:00
///Represents the WebView native implementation to be used.
///The default value is [WebViewImplementation.NATIVE].
final WebViewImplementation implementation ;
2020-05-29 17:56:03 +00:00
WebView (
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 ,
2022-05-01 15:06:16 +00:00
@ Deprecated ( ' Use onReceivedError instead ' )
this . onLoadError ,
this . onReceivedError ,
2022-05-02 14:54:34 +00:00
@ Deprecated ( " Use onReceivedHttpError instead " )
this . onLoadHttpError ,
2022-05-01 15:06:16 +00:00
this . onReceivedHttpError ,
2020-05-29 17:56:03 +00:00
this . onProgressChanged ,
this . onConsoleMessage ,
this . shouldOverrideUrlLoading ,
this . onLoadResource ,
this . onScrollChanged ,
2022-04-19 23:31:14 +00:00
@ Deprecated ( ' Use onDownloadStartRequest instead ' )
2022-04-18 22:42:57 +00:00
this . onDownloadStart ,
2022-04-17 14:19:31 +00:00
this . onDownloadStartRequest ,
2022-05-11 22:19:43 +00:00
@ Deprecated ( ' Use onLoadResourceWithCustomScheme instead ' )
this . onLoadResourceCustomScheme ,
2022-05-08 13:08:34 +00:00
this . onLoadResourceWithCustomScheme ,
2020-05-29 17:56:03 +00:00
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 ,
2022-10-08 12:19:35 +00:00
@ Deprecated ( ' Use FindInteractionController.onFindResultReceived instead ' )
2022-10-11 14:19:36 +00:00
this . onFindResultReceived ,
2020-05-29 17:56:03 +00:00
this . shouldInterceptAjaxRequest ,
this . onAjaxReadyStateChange ,
this . onAjaxProgress ,
this . shouldInterceptFetchRequest ,
this . onUpdateVisitedHistory ,
2022-05-11 22:19:43 +00:00
@ Deprecated ( " Use onPrintRequest instead " )
this . onPrint ,
this . onPrintRequest ,
2020-05-29 17:56:03 +00:00
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 ,
2021-03-26 20:04:44 +00:00
this . onZoomScaleChanged ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onSafeBrowsingHit instead ' )
this . androidOnSafeBrowsingHit ,
2022-04-19 23:31:14 +00:00
this . onSafeBrowsingHit ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onPermissionRequest instead ' )
this . androidOnPermissionRequest ,
2022-04-19 23:31:14 +00:00
this . onPermissionRequest ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onGeolocationPermissionsShowPrompt instead ' )
this . androidOnGeolocationPermissionsShowPrompt ,
2022-04-19 23:31:14 +00:00
this . onGeolocationPermissionsShowPrompt ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onGeolocationPermissionsHidePrompt instead ' )
this . androidOnGeolocationPermissionsHidePrompt ,
2022-04-19 23:31:14 +00:00
this . onGeolocationPermissionsHidePrompt ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use shouldInterceptRequest instead ' )
this . androidShouldInterceptRequest ,
2022-04-19 23:31:14 +00:00
this . shouldInterceptRequest ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onRenderProcessGone instead ' )
this . androidOnRenderProcessGone ,
2022-04-19 23:31:14 +00:00
this . onRenderProcessGone ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onRenderProcessResponsive instead ' )
this . androidOnRenderProcessResponsive ,
2022-04-19 23:31:14 +00:00
this . onRenderProcessResponsive ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onRenderProcessUnresponsive instead ' )
this . androidOnRenderProcessUnresponsive ,
2022-04-19 23:31:14 +00:00
this . onRenderProcessUnresponsive ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onFormResubmission instead ' )
this . androidOnFormResubmission ,
2022-04-19 23:31:14 +00:00
this . onFormResubmission ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onZoomScaleChanged instead ' )
this . androidOnScaleChanged ,
@ Deprecated ( ' Use onReceivedIcon instead ' )
this . androidOnReceivedIcon ,
2022-04-19 23:31:14 +00:00
this . onReceivedIcon ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onReceivedTouchIconUrl instead ' )
this . androidOnReceivedTouchIconUrl ,
2022-04-19 23:31:14 +00:00
this . onReceivedTouchIconUrl ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onJsBeforeUnload instead ' )
this . androidOnJsBeforeUnload ,
2022-04-19 23:31:14 +00:00
this . onJsBeforeUnload ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onReceivedLoginRequest instead ' )
this . androidOnReceivedLoginRequest ,
2022-04-19 23:31:14 +00:00
this . onReceivedLoginRequest ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onWebContentProcessDidTerminate instead ' )
this . iosOnWebContentProcessDidTerminate ,
2022-04-19 23:31:14 +00:00
this . onWebContentProcessDidTerminate ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onDidReceiveServerRedirectForProvisionalNavigation instead ' )
this . iosOnDidReceiveServerRedirectForProvisionalNavigation ,
2022-04-19 23:31:14 +00:00
this . onDidReceiveServerRedirectForProvisionalNavigation ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use onNavigationResponse instead ' )
this . iosOnNavigationResponse ,
2022-04-19 23:31:14 +00:00
this . onNavigationResponse ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use shouldAllowDeprecatedTLS instead ' )
this . iosShouldAllowDeprecatedTLS ,
2022-04-19 23:31:14 +00:00
this . shouldAllowDeprecatedTLS ,
2022-05-02 14:54:34 +00:00
this . onCameraCaptureStateChanged ,
this . onMicrophoneCaptureStateChanged ,
2021-02-22 11:16:23 +00:00
this . initialUrlRequest ,
2020-05-29 17:56:03 +00:00
this . initialFile ,
this . initialData ,
2022-04-20 01:05:46 +00:00
@ Deprecated ( ' Use initialSettings instead ' )
this . initialOptions ,
2022-04-19 23:31:14 +00:00
this . initialSettings ,
2021-02-01 14:55:27 +00:00
this . contextMenu ,
2021-03-05 22:19:50 +00:00
this . initialUserScripts ,
2022-04-15 17:20:35 +00:00
this . pullToRefreshController ,
2022-10-08 12:19:35 +00:00
this . findInteractionController ,
2022-04-15 17:20:35 +00:00
this . implementation = WebViewImplementation . NATIVE } ) ;
2020-05-29 17:56:03 +00:00
}