- Merge "Fix abstract method error && swift version error" [#155](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/155)(thanks to [AlexVincent525](https://github.com/AlexVincent525))
- Merge "migrating to swift 5.0" [#162](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/162)(thanks to [fattiger00](https://github.com/fattiger00))
- Merge "Update readme example" [#178](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/178)(thanks to [SebastienBtr](https://github.com/SebastienBtr))
- Merge "handle choose file callback in android" [#183](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/183)(thanks to [crazecoder](https://github.com/crazecoder))
- Merge "add initialScale in android" [#186](https://github.com/pichillilorenzo/flutter_inappbrowser/pull/186)(thanks to [crazecoder](https://github.com/crazecoder))
- Added `horizontalScrollBarEnabled` and `verticalScrollBarEnabled` options to enable/disable the corresponding scrollbar of the WebView [#165](https://github.com/pichillilorenzo/flutter_inappbrowser/issues/165)
- Added `onDownloadStart` event and `useOnDownloadStart` option: event fires when the WebView recognizes and starts a downloadable file.
- Added `onLoadResourceCustomScheme` event and `resourceCustomSchemes` option to set custom schemes that WebView must handle to load resources
...
...
@@ -43,6 +45,7 @@
- Renamed `injectScriptCode` to `evaluateJavascript`
- Renamed `injectStyleCode` to `injectCSSCode`
- Renamed `injectStyleFile` to `injectCSSFileFromUrl`
- No need to listen to `window.addEventListener("flutterInAppBrowserPlatformReady", fuction(){ })` javascript event anymore to call `window.flutter_inappbrowser.callHandler(handlerName <String>, ...args)` to use the JavaScript message handlers
///This class uses native [Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android
///and [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) on iOS.
///
///[browserFallback] represents the [InAppBrowser] instance fallback in case [Chrome Custom Tabs]/[SFSafariViewController] is not available.
///[browserFallback] represents the [InAppBrowser] instance fallback in case `Chrome Custom Tabs`/`SFSafariViewController` is not available.
classChromeSafariBrowser{
Stringuuid;
InAppBrowserbrowserFallback;
bool_isOpened=false;
///Initialize the [ChromeSafariBrowser] instance with an [InAppBrowser] fallback instance or `null`.
ChromeSafariBrowser(bf){
ChromeSafariBrowser({bFallback}){
uuid=uuidGenerator.v4();
browserFallback=bf;
browserFallback=bFallback;
ChannelManager.addListener(uuid,handleMethod);
_isOpened=false;
}
...
...
@@ -45,32 +46,14 @@ class ChromeSafariBrowser {
///Opens an [url] in a new [ChromeSafariBrowser] instance.
///
///- [url]: The [url] to load. Call [encodeUriComponent()] on this if the [url] contains Unicode characters.
///[url]: The [url] to load. Call [encodeUriComponent()] on this if the [url] contains Unicode characters.
///
///- [options]: Options for the [ChromeSafariBrowser].
///[options]: Options for the [ChromeSafariBrowser].
///
///- [headersFallback]: The additional header of the [InAppBrowser] instance fallback to be used in the HTTP request for this URL, specified as a map from name to value.
///[headersFallback]: The additional header of the [InAppBrowser] instance fallback to be used in the HTTP request for this URL, specified as a map from name to value.
///
///- [optionsFallback]: Options used by the [InAppBrowser] instance fallback.
///
///**Android** supports these options:
///
///- __addShareButton__: Set to `false` if you don't want the default share button. The default value is `true`.
///- __showTitle__: Set to `false` if the title shouldn't be shown in the custom tab. The default value is `true`.
///- __toolbarBackgroundColor__: Set the custom background color of the toolbar.
///- __enableUrlBarHiding__: Set to `true` to enable the url bar to hide as the user scrolls down on the page. The default value is `false`.
///- __instantAppsEnabled__: Set to `true` to enable Instant Apps. The default value is `false`.
///
///**iOS** supports these options:
///
///- __entersReaderIfAvailable__: Set to `true` if Reader mode should be entered automatically when it is available for the webpage. The default value is `false`.
///- __barCollapsingEnabled__: Set to `true` to enable bar collapsing. The default value is `false`.
///- __dismissButtonStyle__: Set the custom style for the dismiss button. The default value is `0 //done`. See [SFSafariViewController.DismissButtonStyle](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/dismissbuttonstyle) for all the available styles.
///- __preferredBarTintColor__: Set the custom background color of the navigation bar and the toolbar.
///- __preferredControlTintColor__: Set the custom color of the control buttons on the navigation bar and the toolbar.
///- __presentationStyle__: Set the custom modal presentation style when presenting the WebView. The default value is `0 //fullscreen`. See [UIModalPresentationStyle](https://developer.apple.com/documentation/uikit/uimodalpresentationstyle) for all the available styles.
///- __transitionStyle__: Set to the custom transition style when presenting the WebView. The default value is `0 //crossDissolve`. See [UIModalTransitionStyle](https://developer.apple.com/documentation/uikit/uimodaltransitionStyle) for all the available styles.
///ContentBlocker class represents a set of rules to use block content in the browser window.
///
///On iOS, it uses [WKContentRuleListStore](https://developer.apple.com/documentation/webkit/wkcontentruleliststore).
///On Android, it uses a custom implementation because such functionality doesn't exist.
///
///In general, this [article](https://developer.apple.com/documentation/safariservices/creating_a_content_blocker) can be used to get an overview about this functionality
///but on Android there are two types of [action] that are unavailable: `block-cookies` and `ignore-previous-rules`.
classContentBlocker{
///Trigger of the content blocker. The trigger tells to the WebView when to perform the corresponding action.
ContentBlockerTriggertrigger;
///Action associated to the trigger. The action tells to the WebView what to do when the trigger is matched.
///Trigger of the content blocker. The trigger tells to the WebView when to perform the corresponding action.
///A trigger dictionary must include an [ContentBlockerTrigger.urlFilter], which specifies a pattern to match the URL against.
///The remaining properties are optional and modify the behavior of the trigger.
///For example, you can limit the trigger to specific domains or have it not apply when a match is found on a specific domain.
classContentBlockerTrigger{
///A regular expression pattern to match the URL against.
StringurlFilter;
///Used only by iOS. A Boolean value. The default value is false.
boolurlFilterIsCaseSensitive;
///A list of [ContentBlockerTriggerResourceType] representing the resource types (how the browser intends to use the resource) that the rule should match.
///If not specified, the rule matches all resource types.
///A list of strings matched to a URL's domain; limits action to a list of specific domains.
///Values must be lowercase ASCII, or punycode for non-ASCII. Add * in front to match domain and subdomains. Can't be used with [ContentBlockerTrigger.unlessDomain].
List<String>ifDomain;
///A list of strings matched to a URL's domain; acts on any site except domains in a provided list.
///Values must be lowercase ASCII, or punycode for non-ASCII. Add * in front to match domain and subdomains. Can't be used with [ContentBlockerTrigger.ifDomain].
List<String>unlessDomain;
///A list of [ContentBlockerTriggerLoadType] that can include one of two mutually exclusive values. If not specified, the rule matches all load types.
List<ContentBlockerTriggerLoadType>loadType;
///A list of strings matched to the entire main document URL; limits the action to a specific list of URL patterns.
///Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with [ContentBlockerTrigger.unlessTopUrl].
List<String>ifTopUrl;
///An array of strings matched to the entire main document URL; acts on any site except URL patterns in provided list.
///Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with [ContentBlockerTrigger.ifTopUrl].
///Hides elements of the page based on a CSS selector. A selector field contains the selector list. Any matching element has its display property set to none, which hides it.
///
///**NOTE**: on Android, JavaScript must be enabled.
///HttpAuthCredentialDatabase class implements a singleton object (shared instance) which manages the shared HTTP auth credentials cache.
///On iOS, this class uses the [URLCredentialStorage](https://developer.apple.com/documentation/foundation/urlcredentialstorage) class.
///On Android, this class has a custom implementation using `android.database.sqlite.SQLiteDatabase` because [WebViewDatabase](https://developer.android.com/reference/android/webkit/WebViewDatabase)
///doesn't offer the same functionalities as iOS `URLCredentialStorage`.
///Opens an [url] in a new [InAppBrowser] instance.
///
///- [url]: The [url] to load. Call [encodeUriComponent()] on this if the [url] contains Unicode characters. The default value is `about:blank`.
///
///- [headers]: The additional headers to be used in the HTTP request for this URL, specified as a map from name to value.
///
///- [options]: Options for the [InAppBrowser].
///
/// - All platforms support:
/// - __useShouldOverrideUrlLoading__: Set to `true` to be able to listen at the [shouldOverrideUrlLoading()] event. The default value is `false`.
/// - __useOnLoadResource__: Set to `true` to be able to listen at the [onLoadResource()] event. The default value is `false`.
/// - __useOnDownloadStart__: Set to `true` to be able to listen at the [onDownloadStart()] event. The default value is `false`.
/// - __useOnTargetBlank__: Set to `true` to be able to listen at the [onTargetBlank()] event. The default value is `false`.
/// - __clearCache__: Set to `true` to have all the browser's cache cleared before the new window is opened. The default value is `false`.
/// - __userAgent__: Set the custom WebView's user-agent.
/// - __javaScriptEnabled__: Set to `true` to enable JavaScript. The default value is `true`.
/// - __javaScriptCanOpenWindowsAutomatically__: Set to `true` to allow JavaScript open windows without user interaction. The default value is `false`.
/// - __hidden__: Set to `true` to create the browser and load the page, but not show it. The `onLoadStop` event fires when loading is complete. Omit or set to `false` (default) to have the browser open and load normally.
/// - __toolbarTop__: Set to `false` to hide the toolbar at the top of the WebView. The default value is `true`.
/// - __toolbarTopBackgroundColor__: Set the custom background color of the toolbar at the top.
/// - __hideUrlBar__: Set to `true` to hide the url bar on the toolbar at the top. The default value is `false`.
/// - __mediaPlaybackRequiresUserGesture__: Set to `true` to prevent HTML5 audio or video from autoplaying. The default value is `true`.
/// - __transparentBackground__: Set to `true` to make the background of the WebView transparent. If your app has a dark theme, this can prevent a white flash on initialization. The default value is `false`.
/// - __resourceCustomSchemes__: List of custom schemes that [InAppBrowser] must handle. Use the [onLoadResourceCustomScheme()] event to intercept resource requests with custom scheme.
///
/// - **Android** supports these additional options:
///
/// - __hideTitleBar__: Set to `true` if you want the title should be displayed. The default value is `false`.
/// - __closeOnCannotGoBack__: Set to `false` to not close the InAppBrowser when the user click on the back button and the WebView cannot go back to the history. The default value is `true`.
/// - __clearSessionCache__: Set to `true` to have the session cookie cache cleared before the new window is opened.
/// - __builtInZoomControls__: Set to `true` if the WebView should use its built-in zoom mechanisms. The default value is `false`.
/// - __displayZoomControls__: Set to `true` if the WebView should display on-screen zoom controls when using the built-in zoom mechanisms. The default value is `false`.
/// - __supportZoom__: Set to `false` if the WebView should not support zooming using its on-screen zoom controls and gestures. The default value is `true`.
/// - __databaseEnabled__: Set to `true` if you want the database storage API is enabled. The default value is `false`.
/// - __domStorageEnabled__: Set to `true` if you want the DOM storage API is enabled. The default value is `false`.
/// - __useWideViewPort__: Set to `true` if the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is false, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is true and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used. The default value is `true`.
/// - __safeBrowsingEnabled__: Set to `true` if you want the Safe Browsing is enabled. Safe Browsing allows WebView to protect against malware and phishing attacks by verifying the links. The default value is `true`.
/// - __progressBar__: Set to `false` to hide the progress bar at the bottom of the toolbar at the top. The default value is `true`.
/// - __textZoom__: Set text scaling of the WebView. The default value is `100`.
/// - __mixedContentMode__: Configures the WebView's behavior when a secure origin attempts to load a resource from an insecure origin. By default, apps that target `Build.VERSION_CODES.KITKAT` or below default to `MIXED_CONTENT_ALWAYS_ALLOW`. Apps targeting `Build.VERSION_CODES.LOLLIPOP` default to `MIXED_CONTENT_NEVER_ALLOW`. The preferred and most secure mode of operation for the WebView is `MIXED_CONTENT_NEVER_ALLOW` and use of `MIXED_CONTENT_ALWAYS_ALLOW` is strongly discouraged.
///
/// - **iOS** supports these additional options:
///
/// - __disallowOverScroll__: Set to `true` to disable the bouncing of the WebView when the scrolling has reached an edge of the content. The default value is `false`.
/// - __toolbarBottom__: Set to `false` to hide the toolbar at the bottom of the WebView. The default value is `true`.
/// - __toolbarBottomBackgroundColor__: Set the custom background color of the toolbar at the bottom.
/// - __toolbarBottomTranslucent__: Set to `true` to set the toolbar at the bottom translucent. The default value is `true`.
/// - __closeButtonCaption__: Set the custom text for the close button.
/// - __closeButtonColor__: Set the custom color for the close button.
/// - __presentationStyle__: Set the custom modal presentation style when presenting the WebView. The default value is `0 //fullscreen`. See [UIModalPresentationStyle](https://developer.apple.com/documentation/uikit/uimodalpresentationstyle) for all the available styles.
/// - __transitionStyle__: Set to the custom transition style when presenting the WebView. The default value is `0 //crossDissolve`. See [UIModalTransitionStyle](https://developer.apple.com/documentation/uikit/uimodaltransitionStyle) for all the available styles.
/// - __enableViewportScale__: Set to `true` to allow a viewport meta tag to either disable or restrict the range of user scaling. The default value is `false`.
/// - __suppressesIncrementalRendering__: Set to `true` if you want the WebView suppresses content rendering until it is fully loaded into memory.. The default value is `false`.
/// - __allowsAirPlayForMediaPlayback__: Set to `true` to allow AirPlay. The default value is `true`.
/// - __allowsBackForwardNavigationGestures__: Set to `true` to allow the horizontal swipe gestures trigger back-forward list navigations. The default value is `true`.
/// - __allowsLinkPreview__: Set to `true` to allow that pressing on a link displays a preview of the destination for the link. The default value is `true`.
/// - __ignoresViewportScaleLimits__: Set to `true` if you want that the WebView should always allow scaling of the webpage, regardless of the author's intent. The ignoresViewportScaleLimits property overrides the `user-scalable` HTML property in a webpage. The default value is `false`.
/// - __allowsInlineMediaPlayback__: Set to `true` to allow HTML5 media playback to appear inline within the screen layout, using browser-supplied controls rather than native controls. For this to work, add the `webkit-playsinline` attribute to any `<video>` elements. The default value is `false`.
/// - __allowsPictureInPictureMediaPlayback__: Set to `true` to allow HTML5 videos play picture-in-picture. The default value is `true`.
/// - __spinner__: Set to `false` to hide the spinner when the WebView is loading a page. The default value is `true`.
///[url]: The [url] to load. Call `encodeUriComponent()` on this if the [url] contains Unicode characters. The default value is `about:blank`.
///
///[headers]: The additional headers to be used in the HTTP request for this URL, specified as a map from name to value.
///Opens the given [assetFilePath] file in a new [InAppBrowser] instance. The other arguments are the same of [InAppBrowser.open()].
///Opens the given [assetFilePath] file in a new [InAppBrowser] instance. The other arguments are the same of [InAppBrowser.open].
///
///To be able to load your local files (assets, js, css, etc.), you need to add them in the `assets` section of the `pubspec.yaml` file, otherwise they cannot be found!
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView.
///
///**NOTE**: In order to be able to listen this event, you need to set `useShouldOverrideUrlLoading` option to `true`.
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldOverrideUrlLoading] option to `true`.
voidshouldOverrideUrlLoading(Stringurl){
}
///Event fires when the [InAppBrowser] webview loads a resource.
///
///**NOTE**: In order to be able to listen this event, you need to set `useOnLoadResource` option to `true`.
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnLoadResource] and [InAppWebViewOptions.javaScriptEnabled] options to `true`.
voidonLoadResource(LoadedResourceresource){
}
...
...
@@ -386,6 +342,8 @@ class InAppBrowser {
///Event fires when [InAppBrowser] recognizes and starts a downloadable file.
///
///[url] represents the url of the file.
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnDownloadStart] option to `true`.
///Event fires 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].
///Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree.
///
///All platforms support these options:
/// - __useShouldOverrideUrlLoading__: Set to `true` to be able to listen at the [InAppWebView.shouldOverrideUrlLoading()] event. The default value is `false`.
/// - __useOnLoadResource__: Set to `true` to be able to listen at the [InAppWebView.onLoadResource()] event. The default value is `false`.
/// - __useOnDownloadStart__: Set to `true` to be able to listen at the [InAppWebView.onDownloadStart()] event. The default value is `false`.
/// - __useOnTargetBlank__: Set to `true` to be able to listen at the [InAppWebView.onTargetBlank()] event. The default value is `false`.
/// - __clearCache__: Set to `true` to have all the browser's cache cleared before the new window is opened. The default value is `false`.
/// - __userAgent___: Set the custom WebView's user-agent.
/// - __javaScriptEnabled__: Set to `true` to enable JavaScript. The default value is `true`.
/// - __javaScriptCanOpenWindowsAutomatically__: Set to `true` to allow JavaScript open windows without user interaction. The default value is `false`.
/// - __mediaPlaybackRequiresUserGesture__: Set to `true` to prevent HTML5 audio or video from autoplaying. The default value is `true`.
/// - __transparentBackground__: Set to `true` to make the background of the WebView transparent. If your app has a dark theme, this can prevent a white flash on initialization. The default value is `false`.
/// - __resourceCustomSchemes__: List of custom schemes that [InAppWebView] must handle. Use the [InAppWebView.onLoadResourceCustomScheme()] event to intercept resource requests with custom scheme.
///
/// **Android** supports these additional options:
///
/// - __clearSessionCache__: Set to `true` to have the session cookie cache cleared before the new window is opened.
/// - __builtInZoomControls__: Set to `true` if the WebView should use its built-in zoom mechanisms. The default value is `false`.
/// - __displayZoomControls__: Set to `true` if the WebView should display on-screen zoom controls when using the built-in zoom mechanisms. The default value is `false`.
/// - __supportZoom__: Set to `false` if the WebView should not support zooming using its on-screen zoom controls and gestures. The default value is `true`.
/// - __databaseEnabled__: Set to `true` if you want injectScriptFilethe database storage API is enabled. The default value is `false`.
/// - __domStorageEnabled__: Set to `true` if you want the DOM storage API is enabled. The default value is `false`.
/// - __useWideViewPort__: Set to `true` if the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is false, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is true and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used. The default value is `true`.
/// - __safeBrowsingEnabled__: Set to `true` if you want the Safe Browsing is enabled. Safe Browsing allows WebView to protect against malware and phishing attacks by verifying the links. The default value is `true`.
/// - __textZoom__: Set text scaling of the WebView. The default value is `100`.
/// - __mixedContentMode__: Configures the WebView's behavior when a secure origin attempts to load a resource from an insecure origin. By default, apps that target `Build.VERSION_CODES.KITKAT` or below default to `MIXED_CONTENT_ALWAYS_ALLOW`. Apps targeting `Build.VERSION_CODES.LOLLIPOP` default to `MIXED_CONTENT_NEVER_ALLOW`. The preferred and most secure mode of operation for the WebView is `MIXED_CONTENT_NEVER_ALLOW` and use of `MIXED_CONTENT_ALWAYS_ALLOW` is strongly discouraged.
///
/// **iOS** supports these additional options:
///
/// - __disallowOverScroll__: Set to `true` to disable the bouncing of the WebView when the scrolling has reached an edge of the content. The default value is `false`.
/// - __enableViewportScale__: Set to `true` to allow a viewport meta tag to either disable or restrict the range of user scaling. The default value is `false`.
/// - __suppressesIncrementalRendering__: Set to `true` if you want the WebView suppresses content rendering until it is fully loaded into memory.. The default value is `false`.
/// - __allowsAirPlayForMediaPlayback__: Set to `true` to allow AirPlay. The default value is `true`.
/// - __allowsBackForwardNavigationGestures__: Set to `true` to allow the horizontal swipe gestures trigger back-forward list navigations. The default value is `true`.
/// - __allowsLinkPreview__: Set to `true` to allow that pressing on a link displays a preview of the destination for the link. The default value is `true`.
/// - __ignoresViewportScaleLimits__: Set to `true` if you want that the WebView should always allow scaling of the webpage, regardless of the author's intent. The ignoresViewportScaleLimits property overrides the `user-scalable` HTML property in a webpage. The default value is `false`.
/// - __allowsInlineMediaPlayback__: Set to `true` to allow HTML5 media playback to appear inline within the screen layout, using browser-supplied controls rather than native controls. For this to work, add the `webkit-playsinline` attribute to any `<video>` elements. The default value is `false`.
/// - __allowsPictureInPictureMediaPlayback__: Set to `true` to allow HTML5 videos play picture-in-picture. The default value is `true`.
classInAppWebViewextendsStatefulWidget{
///Event fires when the [InAppWebView] is created.
...
...
@@ -81,14 +43,12 @@ class InAppWebView extends StatefulWidget {
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView.
///
///**NOTE**: In order to be able to listen this event, you need to set `useShouldOverrideUrlLoading` option to `true`.
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldOverrideUrlLoading] option to `true`.
///Event fires when the [InAppWebView] loads a resource.
///
///**NOTE**: In order to be able to listen this event, you need to set `useOnLoadResource` option to `true`.
///
///**NOTE only for Android**: to be able to listen this event, you need also the enable javascript.
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnLoadResource] and [InAppWebViewOptions.javaScriptEnabled] options to `true`.
///Event fires when the [InAppWebView] 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`.
...
...
@@ -113,6 +75,8 @@ class InAppWebView extends StatefulWidget {
///Event fires when the [InAppWebView] tries to open a link with `target="_blank"`.
///
///[url] represents the url of the link.
///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnTargetBlank] option to `true`.
///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.
...
...
@@ -154,15 +118,23 @@ class InAppWebView extends StatefulWidget {
///Event fires 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].
///Returns a boolean value indicating whether the [InAppWebView] can go back or forward the given number of steps. Steps is negative if backward and positive if forward.
Future<bool>canGoBackOrForward(intsteps)async{
///Returns a boolean value indicating whether the WebView can go back or forward the given number of steps. Steps is negative if backward and positive if forward.
///Adds a JavaScript message handler [callback] ([JavaScriptHandlerCallback]) that listen to post messages sent from JavaScript by the handler with name [handlerName].
...
...
@@ -1112,14 +1111,6 @@ class InAppWebViewController {
///The JavaScript function that can be used to call the handler is `window.flutter_inappbrowser.callHandler(handlerName <String>, ...args)`, where `args` are [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
///The `args` will be stringified automatically using `JSON.stringify(args)` method and then they will be decoded on the Dart side.
///
///In order to call `window.flutter_inappbrowser.callHandler(handlerName <String>, ...args)` properly, you need to wait and listen the JavaScript event `flutterInAppBrowserPlatformReady`.
///This event will be dispatch as soon as the platform (Android or iOS) is ready to handle the `callHandler` method.
///`window.flutter_inappbrowser.callHandler` returns a JavaScript [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
///that can be used to get the json result returned by [JavaScriptHandlerCallback].
///In this case, simply return data that you want to send and it will be automatically json encoded using [jsonEncode] from the `dart:convert` library.
...
...
@@ -1127,7 +1118,6 @@ class InAppWebViewController {
///So, on the JavaScript side, to get data coming from the Dart side, you will use:
///SafeBrowsingResponse class represents the response used by the [onSafeBrowsingHit] event.
///It is used to indicate an action to take when hitting a malicious URL.
classSafeBrowsingResponse{
///If reporting is enabled, all reports will be sent according to the privacy policy referenced by [InAppWebViewController.getSafeBrowsingPrivacyPolicyUrl].
boolreport;
///Indicate the [SafeBrowsingResponseAction] to take when hitting a malicious URL.
///TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make the text readable when viewing a wide-viewport layout in the overview mode.
///It is recommended to enable zoom support [AndroidInAppWebViewOptions.supportZoom] when using this mode.
///AndroidInAppWebViewMixedContentMode class represents an Android-specific class used to configure the WebView's behavior when a secure origin attempts to load a resource from an insecure origin.
///In this mode, the WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.
///Some insecure content may be allowed to be loaded by a secure origin and other types of content will be blocked.
///The types of content are allowed or blocked may change release to release and are not explicitly defined.
///This mode is intended to be used by apps that are not in control of the content that they render but desire to operate in a reasonably secure environment.
///For highest security, apps are recommended to use [AndroidInAppWebViewMixedContentMode.MIXED_CONTENT_NEVER_ALLOW].
///IosInAppWebViewSelectionGranularity class represents an iOS-specific class used to set the level of granularity with which the user can interactively select content in the web view.
///IosInAppWebViewDataDetectorTypes class represents an iOS-specific class used to specify a dataDetectoryTypes value that adds interactivity to web content that matches the value.
///All of the above data types are turned into links when detected. Choosing this value will automatically include any new detection type that is added.
///IosWebViewOptionsPresentationStyle class represents an iOS-specific class used to specify the modal presentation style when presenting a view controller.
///AjaxRequest class represents a JavaScript [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object.
classAjaxRequest{
///Data passed as a parameter to the `XMLHttpRequest.send()` method.
dynamicdata;
///The HTTP request method of the `XMLHttpRequest` request.
Stringmethod;
///The URL of the `XMLHttpRequest` request.
Stringurl;
///An optional Boolean parameter, defaulting to true, indicating whether or not the request is performed asynchronously.
boolisAsync;
///The optional user name to use for authentication purposes; by default, this is the null value.
Stringuser;
///The optional password to use for authentication purposes; by default, this is the null value.
Stringpassword;
///The XMLHttpRequest.withCredentials property is a Boolean that indicates whether or not cross-site Access-Control requests
///should be made using credentials such as cookies, authorization headers or TLS client certificates.
///Setting withCredentials has no effect on same-site requests.
///In addition, this flag is also used to indicate when cookies are to be ignored in the response. The default is false.
boolwithCredentials;
///The HTTP request headers.
Map<dynamic,dynamic>headers;
///The state of the `XMLHttpRequest` request.
AjaxRequestReadyStatereadyState;
///The numerical HTTP [status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) of the `XMLHttpRequest`'s response.
intstatus;
///The serialized URL of the response or the empty string if the URL is null.
///If the URL is returned, any URL fragment present in the URL will be stripped away.
///The value of responseURL will be the final URL obtained after any redirects.
StringresponseURL;
///It is an enumerated string value specifying the type of data contained in the response.
///It also lets the author change the [response type](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType).
///If an empty string is set as the value of responseType, the default value of text is used.
StringresponseType;
///The response's body content. The content-type depends on the [AjaxRequest.reponseType].
dynamicresponse;
///The text received from a server following a request being sent.
StringresponseText;
///The HTML or XML string retrieved by the request or null if the request was unsuccessful, has not yet been sent, or if the data can't be parsed as XML or HTML.
StringresponseXML;
///A String containing the response's status message as returned by the HTTP server.
///Unlike [AjaxRequest.status] which indicates a numerical status code, this property contains the text of the response status, such as "OK" or "Not Found".
///If the request's readyState is in [AjaxRequestReadyState.UNSENT] or [AjaxRequestReadyState.OPENED] state, the value of statusText will be an empty string.
///If the server response doesn't explicitly specify a status text, statusText will assume the default value "OK".
StringstatusText;
///All the response headers or returns null if no response has been received. If a network error happened, an empty string is returned.
Map<dynamic,dynamic>responseHeaders;
///Event type of the `XMLHttpRequest` request.
AjaxRequestEventevent;
///Indicates the [AjaxRequestAction] that can be used to control the `XMLHttpRequest` request.
///FetchRequestCredential class is an interface for [FetchRequestCredentialDefault], [FetchRequestFederatedCredential] and [FetchRequestPasswordCredential] classes.
classFetchRequestCredential{
///Type of credentials.
Stringtype;
FetchRequestCredential({this.type});
...
...
@@ -833,8 +1045,9 @@ class FetchRequestCredential {
}
}
///
///FetchRequestCredentialDefault class represents the default credentials used by an [FetchRequest].
@@ -847,12 +1060,17 @@ class FetchRequestCredentialDefault extends FetchRequestCredential {
}
}
///
///FetchRequestFederatedCredential class represents a [FederatedCredential](https://developer.mozilla.org/en-US/docs/Web/API/FederatedCredential) type of credentials.
///The name associated with a credential. It should be a human-readable, public name.
Stringname;
///Credential's federated identity protocol.
Stringprotocol;
///Credential's federated identity provider.
Stringprovider;
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
@@ -869,11 +1087,15 @@ class FetchRequestFederatedCredential extends FetchRequestCredential {
}
}
///
///FetchRequestPasswordCredential class represents a [PasswordCredential](https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential) type of credentials.
///The name associated with a credential. It should be a human-readable, public name.
Stringname;
///The password of the credential.
Stringpassword;
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
@@ -889,20 +1111,33 @@ class FetchRequestPasswordCredential extends FetchRequestCredential {
}
}
///
///FetchRequest class represents a HTTP request created with JavaScript using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).
classFetchRequest{
///The URL of the request.
Stringurl;
///The HTTP request method used of the request.
Stringmethod;
///The HTTP request headers.
Map<String,dynamic>headers;
///Body of the request.
Uint8Listbody;
///The mode used by the request.
Stringmode;
///The request credentials used by the request.
FetchRequestCredentialcredentials;
///The cache mode used by the request.
Stringcache;
///The redirect mode used by the request.
Stringredirect;
///A String specifying no-referrer, client, or a URL.
Stringreferrer;
///The value of the referer HTTP header.
StringreferrerPolicy;
///Contains the subresource integrity value of the request.
Stringintegrity;
///The keepalive option used to allow the request to outlive the page.
boolkeepalive;
///Indicates the [FetchRequestAction] that can be used to control the request.
///Set to `true` to be able to listen at the [shouldOverrideUrlLoading] event. The default value is `false`.
booluseShouldOverrideUrlLoading;
///Set to `true` to be able to listen at the [onLoadResource] event. The default value is `false`.
booluseOnLoadResource;
///Set to `true` to be able to listen at the [onDownloadStart] event. The default value is `false`.
booluseOnDownloadStart;
///Set to `true` to be able to listen at the [onTargetBlank] event. The default value is `false`.
booluseOnTargetBlank;
///Set to `true` to have all the browser's cache cleared before the new window is opened. The default value is `false`.
boolclearCache;
///Sets the user-agent for the WebView.
///
///**NOTE**: available on iOS 9.0+.
StringuserAgent;
///Append to the existing user-agent. Setting userAgent will override this.
///
///**NOTE**: available on Android 17+ and on iOS 9.0+.
StringapplicationNameForUserAgent;
///Set to `true` to enable JavaScript. The default value is `true`.
booljavaScriptEnabled;
///Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application.
///This flag can be enabled in order to facilitate debugging of web layouts and JavaScript code running inside WebViews. The default is `false`.
///
///**NOTE**: on iOS the debugging mode is always enabled.
booldebuggingEnabled;
///Set to `true` to allow JavaScript open windows without user interaction. The default value is `false`.
booljavaScriptCanOpenWindowsAutomatically;
///Set to `true` to prevent HTML5 audio or video from autoplaying. The default value is `true`.
///
///**NOTE**: available on iOS 10.0+.
boolmediaPlaybackRequiresUserGesture;
inttextZoom;
///Sets the minimum font size. The default value is `8` for Android, `0` for iOS.
intminimumFontSize;
///Define whether the vertical scrollbar should be drawn or not. The default value is `true`.
boolverticalScrollBarEnabled;
///Define whether the horizontal scrollbar should be drawn or not. The default value is `true`.
boolhorizontalScrollBarEnabled;
///List of custom schemes that the WebView must handle. Use the [onLoadResourceCustomScheme] event to intercept resource requests with custom scheme.
///
///**NOTE**: available on iOS 11.0+.
List<String>resourceCustomSchemes;
///List of [ContentBlocker] that are a set of rules used to block content in the browser window.
///
///**NOTE**: available on iOS 11.0+.
List<ContentBlocker>contentBlockers;
///Sets the content mode that the WebView needs to use when loading and rendering a webpage. The default value is [InAppWebViewUserPreferredContentMode.RECOMMENDED].
///Set to `true` to be able to listen at the [shouldInterceptAjaxRequest] event. The default value is `false`.
booluseShouldInterceptAjaxRequest;
///Set to `true` to be able to listen at the [shouldInterceptFetchRequest] event. The default value is `false`.
booluseShouldInterceptFetchRequest;
///Set to `true` to open a browser window with incognito mode. The default value is `false`.
///
///**NOTE**: available on iOS 9.0+.
boolincognito;
///Sets whether WebView should use browser caching. The default value is `true`.
///
///**NOTE**: available on iOS 9.0+.
boolcacheEnabled;
///Set to `true` to make the background of the WebView transparent. If your app has a dark theme, this can prevent a white flash on initialization. The default value is `false`.
///Enables or disables content URL access within WebView. Content URL access allows WebView to load content from a content provider installed in the system. The default value is `true`.
boolallowContentAccess;
///Enables or disables file access within WebView. Note that this enables or disables file system access only.
///Assets and resources are still accessible using \file:///android_asset` and `file:///android_res`. The default value is `true`.
boolallowFileAccess;
///Sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs.
///Note that the value of this setting is ignored if the value of [allowFileAccessFromFileURLs] is `true`.
///Note too, that this setting affects only JavaScript access to file scheme resources. The default value is `false`.
boolallowFileAccessFromFileURLs;
///Sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin.
///Note that this setting affects only JavaScript access to file scheme resources.
///This includes access to content from other file scheme URLs. The default value is `false`.
boolallowUniversalAccessFromFileURLs;
///Sets the path to the Application Caches files. In order for the Application Caches API to be enabled, this option must be set a path to which the application can write.
///This option is used one time: repeated calls are ignored.
StringappCachePath;
///Sets whether the WebView should not load image resources from the network (resources accessed via http and https URI schemes). The default value is `false`.
boolblockNetworkImage;
///Sets whether the WebView should not load resources from the network. The default value is `false`.
boolblockNetworkLoads;
///Overrides the way the cache is used. The way the cache is used is based on the navigation type. For a normal page load, the cache is checked and content is re-validated as needed.
///When navigating back, content is not revalidated, instead the content is just retrieved from the cache. The default value is [AndroidInAppWebViewCacheMode.LOAD_DEFAULT].
AndroidInAppWebViewCacheModecacheMode;
///Sets the cursive font family name. The default value is `"cursive"`.
StringcursiveFontFamily;
///Sets the default fixed font size. The default value is `16`.
intdefaultFixedFontSize;
///Sets the default font size. The default value is `16`.
intdefaultFontSize;
///Sets the default text encoding name to use when decoding html pages. The default value is `"UTF-8"`.
StringdefaultTextEncodingName;
///Disables the action mode menu items according to menuItems flag.
///Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on screen by width.
///This setting is taken into account when the content width is greater than the width of the WebView control, for example, when [useWideViewPort] is enabled.
///The default value is `false`.
boolloadWithOverviewMode;
///Sets whether the WebView should load image resources. Note that this method controls loading of all images, including those embedded using the data URI scheme.
///Note that if the value of this setting is changed from false to true, all images resources referenced by content currently displayed by the WebView are loaded automatically.
///The default value is `true`.
boolloadsImagesAutomatically;
///Sets the minimum logical font size. The default is `8`.
intminimumLogicalFontSize;
///Sets the initial scale for this WebView. 0 means default.The behavior for the default scale depends on the state of [useWideViewPort] and [loadWithOverviewMode].
///If the content fits into the WebView control by width, then the zoom is set to 100%. For wide content, the behavior depends on the state of [loadWithOverviewMode].
///If its value is true, the content will be zoomed out to be fit by width into the WebView control, otherwise not.
///If initial scale is greater than 0, WebView starts with this value as initial scale.
///Please note that unlike the scale properties in the viewport meta tag, this method doesn't take the screen density into account.
///The default is `0`.
intinitialScale;
///Tells the WebView whether it needs to set a node. The default value is `true`.
boolneedInitialFocus;
///Sets whether this WebView should raster tiles when it is offscreen but attached to a window.
///Turning this on can avoid rendering artifacts when animating an offscreen WebView on-screen.
///Offscreen WebViews in this mode use more memory. The default value is `false`.
///
///**NOTE**: available on Android 23+.
booloffscreenPreRaster;
///Sets the sans-serif font family name. The default value is `"sans-serif"`.
StringsansSerifFontFamily;
///Sets the serif font family name. The default value is `"sans-serif"`.
StringserifFontFamily;
///Sets the standard font family name. The default value is `"sans-serif"`.
StringstandardFontFamily;
///Sets whether the WebView should save form data. In Android O, the platform has implemented a fully functional Autofill feature to store form data.
///Therefore, the Webview form data save feature is disabled. Note that the feature will continue to be supported on older versions of Android as before.
boolsaveFormData;
///Boolean value to enable third party cookies in the WebView.
///Used on Android Lollipop and above only as third party cookies are enabled by default on Android Kitkat and below and on iOS.
///The default value is `true`.
///
///**NOTE**: available on Android 21+.
boolthirdPartyCookiesEnabled;
///Boolean value to enable Hardware Acceleration in the WebView.
///Specifying a dataDetectoryTypes value adds interactivity to web content that matches the value.
///For example, Safari adds a link to “apple.com” in the text “Visit apple.com” if the dataDetectorTypes property is set to [IosInAppWebViewDataDetectorTypes.LINK].
///The default value is [IosInAppWebViewDataDetectorTypes.NONE].
///Set to `true` if you want the title should be displayed. The default value is `false`.
boolhideTitleBar;
///Set the action bar's title.
StringtoolbarTopFixedTitle;
///Set to `false` to not close the InAppBrowser when the user click on the back button and the WebView cannot go back to the history. The default value is `true`.
boolcloseOnCannotGoBack;
///Set to `false` to hide the progress bar at the bottom of the toolbar at the top. The default value is `true`.