updated docs

This commit is contained in:
Lorenzo Pichilli 2020-05-29 14:51:26 +02:00
parent a3e9aa3a4e
commit 7d88cd80be
8 changed files with 182 additions and 46 deletions

View File

@ -1306,6 +1306,9 @@ Future main() async {
This class implements a singleton object (shared instance) which manages the cookies used by WebView instances. This class implements a singleton object (shared instance) which manages the cookies used by WebView instances.
On Android, it is implemented using [CookieManager](https://developer.android.com/reference/android/webkit/CookieManager).
On iOS, it is implemented using [WKHTTPCookieStore](https://developer.apple.com/documentation/webkit/wkhttpcookiestore).
**NOTE for iOS**: available from iOS 11.0+. **NOTE for iOS**: available from iOS 11.0+.
#### `CookieManager` methods #### `CookieManager` methods

View File

@ -6,6 +6,8 @@ import 'package:flutter/services.dart';
import 'types.dart'; import 'types.dart';
///Class that implements a singleton object (shared instance) which manages the cookies used by WebView instances. ///Class that implements a singleton object (shared instance) which manages the cookies used by WebView instances.
///On Android, it is implemented using [CookieManager](https://developer.android.com/reference/android/webkit/CookieManager).
///On iOS, it is implemented using [WKHTTPCookieStore](https://developer.apple.com/documentation/webkit/wkhttpcookiestore).
/// ///
///**NOTE for iOS**: available from iOS 11.0+. ///**NOTE for iOS**: available from iOS 11.0+.
class CookieManager { class CookieManager {

View File

@ -7,7 +7,8 @@ import 'package:flutter/services.dart';
///Class that implements a singleton object (shared instance) which manages the shared HTTP auth credentials cache. ///Class that 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 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) ///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`. ///doesn't offer the same functionalities as iOS `URLCredentialStorage`.
class HttpAuthCredentialDatabase { class HttpAuthCredentialDatabase {
static HttpAuthCredentialDatabase _instance; static HttpAuthCredentialDatabase _instance;

View File

@ -11,17 +11,6 @@ import 'webview.dart';
import 'types.dart'; import 'types.dart';
import 'in_app_webview_controller.dart'; import 'in_app_webview_controller.dart';
///List of forbidden names for JavaScript handlers.
const javaScriptHandlerForbiddenNames = [
"onLoadResource",
"shouldInterceptAjaxRequest",
"onAjaxReadyStateChange",
"onAjaxProgress",
"shouldInterceptFetchRequest",
"onPrint",
"androidKeyboardWorkaroundFocusoutEvent"
];
///Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree. ///Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree.
class InAppWebView extends StatefulWidget implements WebView { class InAppWebView extends StatefulWidget implements WebView {
/// `gestureRecognizers` specifies which gestures should be consumed by the web view. /// `gestureRecognizers` specifies which gestures should be consumed by the web view.

View File

@ -8,14 +8,27 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_inappwebview/src/webview.dart';
import 'package:html/parser.dart' show parse; import 'package:html/parser.dart' show parse;
import 'context_menu.dart';
import 'types.dart'; import 'types.dart';
import 'in_app_browser.dart'; import 'in_app_browser.dart';
import 'webview_options.dart'; import 'webview_options.dart';
import 'headless_in_app_webview.dart';
import 'webview.dart';
import 'in_app_webview.dart';
///List of forbidden names for JavaScript handlers.
const javaScriptHandlerForbiddenNames = [
"onLoadResource",
"shouldInterceptAjaxRequest",
"onAjaxReadyStateChange",
"onAjaxProgress",
"shouldInterceptFetchRequest",
"onPrint",
"androidKeyboardWorkaroundFocusoutEvent"
];
///Controls a WebView, such as an [InAppWebView] widget instance, a [HeadlessInAppWebView] instance or [InAppBrowser] WebView instance. ///Controls a WebView, such as an [InAppWebView] widget instance, a [HeadlessInAppWebView] instance or [InAppBrowser] WebView instance.
/// ///
@ -746,19 +759,28 @@ class InAppWebViewController {
} }
///Gets the URL for the current page. ///Gets the URL for the current page.
///This is not always the same as the URL passed to [InAppWebView.onLoadStarted] because although the load for that URL has begun, the current page may not have changed. ///This is not always the same as the URL passed to [WebView.onLoadStart] because although the load for that URL has begun, the current page may not have changed.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#getUrl()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1415005-url
Future<String> getUrl() async { Future<String> getUrl() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('getUrl', args); return await _channel.invokeMethod('getUrl', args);
} }
///Gets the title for the current page. ///Gets the title for the current page.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#getTitle()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1415015-title
Future<String> getTitle() async { Future<String> getTitle() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('getTitle', args); return await _channel.invokeMethod('getTitle', args);
} }
///Gets the progress for the current page. The progress value is between 0 and 100. ///Gets the progress for the current page. The progress value is between 0 and 100.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#getProgress()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1415007-estimatedprogress
Future<int> getProgress() async { Future<int> getProgress() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('getProgress', args); return await _channel.invokeMethod('getProgress', args);
@ -926,6 +948,9 @@ class InAppWebViewController {
} }
///Loads the given [url] with optional [headers] specified as a map from name to value. ///Loads the given [url] with optional [headers] specified as a map from name to value.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#loadUrl(java.lang.String)
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414954-load
Future<void> loadUrl( Future<void> loadUrl(
{@required String url, Map<String, String> headers = const {}}) async { {@required String url, Map<String, String> headers = const {}}) async {
assert(url != null && url.isNotEmpty); assert(url != null && url.isNotEmpty);
@ -936,6 +961,8 @@ class InAppWebViewController {
} }
///Loads the given [url] with [postData] using `POST` method into this WebView. ///Loads the given [url] with [postData] using `POST` method into this WebView.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#postUrl(java.lang.String,%20byte[])
Future<void> postUrl( Future<void> postUrl(
{@required String url, @required Uint8List postData}) async { {@required String url, @required Uint8List postData}) async {
assert(url != null && url.isNotEmpty); assert(url != null && url.isNotEmpty);
@ -953,6 +980,11 @@ class InAppWebViewController {
///The [encoding] parameter specifies the encoding of the data. The default value is `"utf8"`. ///The [encoding] parameter specifies the encoding of the data. The default value is `"utf8"`.
/// ///
///The [androidHistoryUrl] parameter is the URL to use as the history entry. The default value is `about:blank`. If non-null, this must be a valid URL. This parameter is used only on Android. ///The [androidHistoryUrl] parameter is the URL to use as the history entry. The default value is `about:blank`. If non-null, this must be a valid URL. This parameter is used only on Android.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#loadDataWithBaseURL(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)
///**Official iOS API**:
///- https://developer.apple.com/documentation/webkit/wkwebview/1415004-loadhtmlstring
///- https://developer.apple.com/documentation/webkit/wkwebview/1415011-load
Future<void> loadData( Future<void> loadData(
{@required String data, {@required String data,
String mimeType = "text/html", String mimeType = "text/html",
@ -1009,36 +1041,54 @@ class InAppWebViewController {
} }
///Reloads the WebView. ///Reloads the WebView.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#reload()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414969-reload
Future<void> reload() async { Future<void> reload() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('reload', args); await _channel.invokeMethod('reload', args);
} }
///Goes back in the history of the WebView. ///Goes back in the history of the WebView.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#goBack()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414952-goback
Future<void> goBack() async { Future<void> goBack() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('goBack', args); await _channel.invokeMethod('goBack', args);
} }
///Returns a boolean value indicating whether the WebView can move backward. ///Returns a boolean value indicating whether the WebView can move backward.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#canGoBack()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414966-cangoback
Future<bool> canGoBack() async { Future<bool> canGoBack() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('canGoBack', args); return await _channel.invokeMethod('canGoBack', args);
} }
///Goes forward in the history of the WebView. ///Goes forward in the history of the WebView.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#goForward()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414993-goforward
Future<void> goForward() async { Future<void> goForward() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('goForward', args); await _channel.invokeMethod('goForward', args);
} }
///Returns a boolean value indicating whether the WebView can move forward. ///Returns a boolean value indicating whether the WebView can move forward.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#canGoForward()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414962-cangoforward
Future<bool> canGoForward() async { Future<bool> canGoForward() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('canGoForward', args); return await _channel.invokeMethod('canGoForward', args);
} }
///Goes to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward. ///Goes to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#goBackOrForward(int)
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414991-go
Future<void> goBackOrForward({@required int steps}) async { Future<void> goBackOrForward({@required int steps}) async {
assert(steps != null); assert(steps != null);
@ -1048,6 +1098,8 @@ class InAppWebViewController {
} }
///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. ///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.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#canGoBackOrForward(int)
Future<bool> canGoBackOrForward({@required int steps}) async { Future<bool> canGoBackOrForward({@required int steps}) async {
assert(steps != null); assert(steps != null);
@ -1068,12 +1120,18 @@ class InAppWebViewController {
} }
///Stops the WebView from loading. ///Stops the WebView from loading.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#stopLoading()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414981-stoploading
Future<void> stopLoading() async { Future<void> stopLoading() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('stopLoading', args); await _channel.invokeMethod('stopLoading', args);
} }
///Evaluates JavaScript code into the WebView and returns the result of the evaluation. ///Evaluates JavaScript code into the WebView and returns the result of the evaluation.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#evaluateJavascript(java.lang.String,%20android.webkit.ValueCallback%3Cjava.lang.String%3E)
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript
Future<dynamic> evaluateJavascript({@required String source}) async { Future<dynamic> evaluateJavascript({@required String source}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('source', () => source); args.putIfAbsent('source', () => source);
@ -1180,6 +1238,8 @@ class InAppWebViewController {
///Takes a screenshot (in PNG format) of the WebView's visible viewport and returns a `Uint8List`. Returns `null` if it wasn't be able to take it. ///Takes a screenshot (in PNG format) of the WebView's visible viewport and returns a `Uint8List`. Returns `null` if it wasn't be able to take it.
/// ///
///**NOTE for iOS**: available from iOS 11.0+. ///**NOTE for iOS**: available from iOS 11.0+.
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/2873260-takesnapshot
Future<Uint8List> takeScreenshot() async { Future<Uint8List> takeScreenshot() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('takeScreenshot', args); return await _channel.invokeMethod('takeScreenshot', args);
@ -1219,6 +1279,9 @@ class InAppWebViewController {
///This contains only a snapshot of the current state. ///This contains only a snapshot of the current state.
///Multiple calls to this method may return different objects. ///Multiple calls to this method may return different objects.
///The object returned from this method will not be updated to reflect any new state. ///The object returned from this method will not be updated to reflect any new state.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#copyBackForwardList()
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414977-backforwardlist
Future<WebHistory> getCopyBackForwardList() async { Future<WebHistory> getCopyBackForwardList() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<dynamic, dynamic> result = Map<dynamic, dynamic> result =
@ -1256,6 +1319,8 @@ class InAppWebViewController {
///**NOTE**: on Android, it finds all instances asynchronously. Successive calls to this will cancel any pending searches. ///**NOTE**: on Android, it finds all instances asynchronously. Successive calls to this will cancel any pending searches.
/// ///
///**NOTE**: on iOS, this is implemented using CSS and Javascript. ///**NOTE**: on iOS, this is implemented using CSS and Javascript.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#findAllAsync(java.lang.String)
Future<void> findAllAsync({@required String find}) async { Future<void> findAllAsync({@required String find}) async {
assert(find != null); assert(find != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1268,6 +1333,8 @@ class InAppWebViewController {
///[forward] represents the direction to search. ///[forward] represents the direction to search.
/// ///
///**NOTE**: on iOS, this is implemented using CSS and Javascript. ///**NOTE**: on iOS, this is implemented using CSS and Javascript.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#findNext(boolean)
Future<void> findNext({@required bool forward}) async { Future<void> findNext({@required bool forward}) async {
assert(forward != null); assert(forward != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1278,6 +1345,8 @@ class InAppWebViewController {
///Clears the highlighting surrounding text matches created by [findAllAsync()]. ///Clears the highlighting surrounding text matches created by [findAllAsync()].
/// ///
///**NOTE**: on iOS, this is implemented using CSS and Javascript. ///**NOTE**: on iOS, this is implemented using CSS and Javascript.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#clearMatches()
Future<void> clearMatches() async { Future<void> clearMatches() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('clearMatches', args); await _channel.invokeMethod('clearMatches', args);
@ -1300,6 +1369,9 @@ class InAppWebViewController {
///[x] represents the x position to scroll to. ///[x] represents the x position to scroll to.
/// ///
///[y] represents the y position to scroll to. ///[y] represents the y position to scroll to.
///
///**Official Android API**: https://developer.android.com/reference/android/view/View#scrollTo(int,%20int)
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset
Future<void> scrollTo({@required int x, @required int y}) async { Future<void> scrollTo({@required int x, @required int y}) async {
assert(x != null && y != null); assert(x != null && y != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1313,6 +1385,9 @@ class InAppWebViewController {
///[x] represents the amount of pixels to scroll by horizontally. ///[x] represents the amount of pixels to scroll by horizontally.
/// ///
///[y] represents the amount of pixels to scroll by vertically. ///[y] represents the amount of pixels to scroll by vertically.
///
///**Official Android API**: https://developer.android.com/reference/android/view/View#scrollBy(int,%20int)
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset
Future<void> scrollBy({@required int x, @required int y}) async { Future<void> scrollBy({@required int x, @required int y}) async {
assert(x != null && y != null); assert(x != null && y != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1325,6 +1400,8 @@ class InAppWebViewController {
///This is a global requests, not restricted to just this WebView. This can be useful if the application has been paused. ///This is a global requests, not restricted to just this WebView. This can be useful if the application has been paused.
/// ///
///On iOS, it is restricted to just this WebView. ///On iOS, it is restricted to just this WebView.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#pauseTimers()
Future<void> pauseTimers() async { Future<void> pauseTimers() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('pauseTimers', args); await _channel.invokeMethod('pauseTimers', args);
@ -1333,6 +1410,8 @@ class InAppWebViewController {
///On Android, it resumes all layout, parsing, and JavaScript timers for all WebViews. This will resume dispatching all timers. ///On Android, it resumes all layout, parsing, and JavaScript timers for all WebViews. This will resume dispatching all timers.
/// ///
///On iOS, it resumes all layout, parsing, and JavaScript timers to just this WebView. ///On iOS, it resumes all layout, parsing, and JavaScript timers to just this WebView.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#resumeTimers()
Future<void> resumeTimers() async { Future<void> resumeTimers() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('resumeTimers', args); await _channel.invokeMethod('resumeTimers', args);
@ -1341,12 +1420,18 @@ class InAppWebViewController {
///Prints the current page. ///Prints the current page.
/// ///
///**NOTE**: available on Android 21+. ///**NOTE**: available on Android 21+.
///
///**Official Android API**: https://developer.android.com/reference/android/print/PrintManager
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller
Future<void> printCurrentPage() async { Future<void> printCurrentPage() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _channel.invokeMethod('printCurrentPage', args); await _channel.invokeMethod('printCurrentPage', args);
} }
///Gets the height of the HTML content. ///Gets the height of the HTML content.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#getContentHeight()
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619399-contentsize
Future<int> getContentHeight() async { Future<int> getContentHeight() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('getContentHeight', args); return await _channel.invokeMethod('getContentHeight', args);
@ -1357,6 +1442,9 @@ class InAppWebViewController {
///[zoomFactor] represents the zoom factor to apply. On Android, the zoom factor will be clamped to the Webview's zoom limits and, also, this value must be in the range 0.01 to 100.0 inclusive. ///[zoomFactor] represents the zoom factor to apply. On Android, the zoom factor will be clamped to the Webview's zoom limits and, also, this value must be in the range 0.01 to 100.0 inclusive.
/// ///
///**NOTE**: available on Android 21+. ///**NOTE**: available on Android 21+.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#zoomBy(float)
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619412-setzoomscale
Future<void> zoomBy(double zoomFactor) async { Future<void> zoomBy(double zoomFactor) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('zoomFactor', () => zoomFactor); args.putIfAbsent('zoomFactor', () => zoomFactor);
@ -1364,6 +1452,11 @@ class InAppWebViewController {
} }
///Gets the current scale of this WebView. ///Gets the current scale of this WebView.
///
///**Official Android API**:
///- https://developer.android.com/reference/android/util/DisplayMetrics#density
///- https://developer.android.com/reference/android/webkit/WebViewClient#onScaleChanged(android.webkit.WebView,%20float,%20float)
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619419-zoomscale
Future<double> getScale() async { Future<double> getScale() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel.invokeMethod('getScale', args); return await _channel.invokeMethod('getScale', args);
@ -1381,6 +1474,8 @@ class InAppWebViewController {
///Gets the hit result for hitting an HTML elements. ///Gets the hit result for hitting an HTML elements.
/// ///
///**NOTE**: On iOS it is implemented using JavaScript. ///**NOTE**: On iOS it is implemented using JavaScript.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#getHitTestResult()
Future<InAppWebViewHitTestResult> getHitTestResult() async { Future<InAppWebViewHitTestResult> getHitTestResult() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
var hitTestResultMap = var hitTestResultMap =
@ -1393,6 +1488,8 @@ class InAppWebViewController {
} }
///Gets the default user agent. ///Gets the default user agent.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebSettings#getDefaultUserAgent(android.content.Context)
static Future<String> getDefaultUserAgent() async { static Future<String> getDefaultUserAgent() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _staticChannel.invokeMethod('getDefaultUserAgent', args); return await _staticChannel.invokeMethod('getDefaultUserAgent', args);
@ -1416,12 +1513,16 @@ class AndroidInAppWebViewController {
///or [AndroidInAppWebViewOptions.safeBrowsingEnabled]. This prepares resources used for Safe Browsing. ///or [AndroidInAppWebViewOptions.safeBrowsingEnabled]. This prepares resources used for Safe Browsing.
/// ///
///**NOTE**: available only on Android 27+. ///**NOTE**: available only on Android 27+.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#startSafeBrowsing(android.content.Context,%20android.webkit.ValueCallback%3Cjava.lang.Boolean%3E)
Future<bool> startSafeBrowsing() async { Future<bool> startSafeBrowsing() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _controller._channel.invokeMethod('startSafeBrowsing', args); return await _controller._channel.invokeMethod('startSafeBrowsing', args);
} }
///Clears the SSL preferences table stored in response to proceeding with SSL certificate errors. ///Clears the SSL preferences table stored in response to proceeding with SSL certificate errors.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#clearSslPreferences()
Future<void> clearSslPreferences() async { Future<void> clearSslPreferences() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _controller._channel.invokeMethod('clearSslPreferences', args); await _controller._channel.invokeMethod('clearSslPreferences', args);
@ -1429,12 +1530,16 @@ class AndroidInAppWebViewController {
///Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation. Note that this call does not pause JavaScript. ///Does a best-effort attempt to pause any processing that can be paused safely, such as animations and geolocation. Note that this call does not pause JavaScript.
///To pause JavaScript globally, use [pauseTimers()]. To resume WebView, call [resume()]. ///To pause JavaScript globally, use [pauseTimers()]. To resume WebView, call [resume()].
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#onPause()
Future<void> pause() async { Future<void> pause() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _controller._channel.invokeMethod('pause', args); await _controller._channel.invokeMethod('pause', args);
} }
///Resumes a WebView after a previous call to [pause()]. ///Resumes a WebView after a previous call to [pause()].
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#onResume()
Future<void> resume() async { Future<void> resume() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _controller._channel.invokeMethod('resume', args); await _controller._channel.invokeMethod('resume', args);
@ -1443,6 +1548,8 @@ class AndroidInAppWebViewController {
///Gets the URL that was originally requested for the current page. ///Gets the URL that was originally requested for the current page.
///This is not always the same as the URL passed to [InAppWebView.onLoadStarted] because although the load for that URL has begun, ///This is not always the same as the URL passed to [InAppWebView.onLoadStarted] because although the load for that URL has begun,
///the current page may not have changed. Also, there may have been redirects resulting in a different URL to that originally requested. ///the current page may not have changed. Also, there may have been redirects resulting in a different URL to that originally requested.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#getOriginalUrl()
Future<String> getOriginalUrl() async { Future<String> getOriginalUrl() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _controller._channel.invokeMethod('getOriginalUrl', args); return await _controller._channel.invokeMethod('getOriginalUrl', args);
@ -1451,7 +1558,9 @@ class AndroidInAppWebViewController {
///Scrolls the contents of this WebView down by half the page size. ///Scrolls the contents of this WebView down by half the page size.
///Returns `true` if the page was scrolled. ///Returns `true` if the page was scrolled.
/// ///
///[bottom] `true` to jump to bottom of page ///[bottom] `true` to jump to bottom of page.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#pageDown(boolean)
Future<bool> pageDown({@required bool bottom}) async { Future<bool> pageDown({@required bool bottom}) async {
assert(bottom != null); assert(bottom != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1462,7 +1571,9 @@ class AndroidInAppWebViewController {
///Scrolls the contents of this WebView up by half the view size. ///Scrolls the contents of this WebView up by half the view size.
///Returns `true` if the page was scrolled. ///Returns `true` if the page was scrolled.
/// ///
///[bottom] `true` to jump to the top of the page ///[bottom] `true` to jump to the top of the page.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#pageUp(boolean)
Future<bool> pageUp({@required bool top}) async { Future<bool> pageUp({@required bool top}) async {
assert(top != null); assert(top != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1477,6 +1588,8 @@ class AndroidInAppWebViewController {
/// ///
///[autoname] if `false`, takes basename to be a file. ///[autoname] if `false`, takes basename to be a file.
///If `true`, [basename] is assumed to be a directory in which a filename will be chosen according to the URL of the current page. ///If `true`, [basename] is assumed to be a directory in which a filename will be chosen according to the URL of the current page.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#saveWebArchive(java.lang.String,%20boolean,%20android.webkit.ValueCallback%3Cjava.lang.String%3E)
Future<String> saveWebArchive({@required String basename, @required bool autoname}) async { Future<String> saveWebArchive({@required String basename, @required bool autoname}) async {
assert(basename != null && autoname != null); assert(basename != null && autoname != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1487,6 +1600,8 @@ class AndroidInAppWebViewController {
///Performs zoom in in this WebView. ///Performs zoom in in this WebView.
///Returns `true` if zoom in succeeds, `false` if no zoom changes. ///Returns `true` if zoom in succeeds, `false` if no zoom changes.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#zoomIn()
Future<bool> zoomIn() async { Future<bool> zoomIn() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _controller._channel.invokeMethod('zoomIn', args); return await _controller._channel.invokeMethod('zoomIn', args);
@ -1494,6 +1609,8 @@ class AndroidInAppWebViewController {
///Performs zoom out in this WebView. ///Performs zoom out in this WebView.
///Returns `true` if zoom out succeeds, `false` if no zoom changes. ///Returns `true` if zoom out succeeds, `false` if no zoom changes.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#zoomOut()
Future<bool> zoomOut() async { Future<bool> zoomOut() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _controller._channel.invokeMethod('zoomOut', args); return await _controller._channel.invokeMethod('zoomOut', args);
@ -1506,6 +1623,8 @@ class AndroidInAppWebViewController {
///**NOTE**: On iOS certificate-based credentials are never stored permanently. ///**NOTE**: On iOS certificate-based credentials are never stored permanently.
/// ///
///**NOTE**: available on Android 21+. ///**NOTE**: available on Android 21+.
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#clearClientCertPreferences(java.lang.Runnable)
static Future<void> clearClientCertPreferences() async { static Future<void> clearClientCertPreferences() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await InAppWebViewController._staticChannel await InAppWebViewController._staticChannel
@ -1515,6 +1634,8 @@ class AndroidInAppWebViewController {
///Returns a URL pointing to the privacy policy for Safe Browsing reporting. This value will never be `null`. ///Returns a URL pointing to the privacy policy for Safe Browsing reporting. This value will never be `null`.
/// ///
///**NOTE**: available only on Android 27+. ///**NOTE**: available only on Android 27+.
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewCompat#getSafeBrowsingPrivacyPolicyUrl()
static Future<String> getSafeBrowsingPrivacyPolicyUrl() async { static Future<String> getSafeBrowsingPrivacyPolicyUrl() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await InAppWebViewController._staticChannel return await InAppWebViewController._staticChannel
@ -1536,6 +1657,8 @@ class AndroidInAppWebViewController {
///[hosts] represents the list of hosts. This value must never be null. ///[hosts] represents the list of hosts. This value must never be null.
/// ///
///**NOTE**: available only on Android 27+. ///**NOTE**: available only on Android 27+.
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewCompat#getSafeBrowsingPrivacyPolicyUrl()
static Future<bool> setSafeBrowsingWhitelist( static Future<bool> setSafeBrowsingWhitelist(
{@required List<String> hosts}) async { {@required List<String> hosts}) async {
assert(hosts != null); assert(hosts != null);
@ -1554,6 +1677,8 @@ class AndroidInAppWebViewController {
///The next time the app starts and loads WebView it will use the new WebView package instead. ///The next time the app starts and loads WebView it will use the new WebView package instead.
/// ///
///**NOTE**: available only on Android 26+. ///**NOTE**: available only on Android 26+.
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewCompat#getCurrentWebViewPackage(android.content.Context)
static Future<AndroidWebViewPackageInfo> getCurrentWebViewPackage() async { static Future<AndroidWebViewPackageInfo> getCurrentWebViewPackage() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<String, dynamic> packageInfo = (await InAppWebViewController._staticChannel.invokeMethod('getCurrentWebViewPackage', args))?.cast<String, dynamic>(); Map<String, dynamic> packageInfo = (await InAppWebViewController._staticChannel.invokeMethod('getCurrentWebViewPackage', args))?.cast<String, dynamic>();
@ -1570,12 +1695,16 @@ class IOSInAppWebViewController {
} }
///Reloads the current page, performing end-to-end revalidation using cache-validating conditionals if possible. ///Reloads the current page, performing end-to-end revalidation using cache-validating conditionals if possible.
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414956-reloadfromorigin
Future<void> reloadFromOrigin() async { Future<void> reloadFromOrigin() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _controller._channel.invokeMethod('reloadFromOrigin', args); await _controller._channel.invokeMethod('reloadFromOrigin', args);
} }
///A Boolean value indicating whether all resources on the page have been loaded over securely encrypted connections. ///A Boolean value indicating whether all resources on the page have been loaded over securely encrypted connections.
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1415002-hasonlysecurecontent
Future<bool> hasOnlySecureContent() async { Future<bool> hasOnlySecureContent() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _controller._channel return await _controller._channel

View File

@ -1,15 +1,22 @@
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:convert';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'in_app_browser.dart';
import 'webview.dart'; import 'webview.dart';
import 'webview_options.dart'; import 'webview_options.dart';
import 'in_app_webview_controller.dart';
import 'http_auth_credentials_database.dart';
import 'chrome_safari_browser.dart';
import 'cookie_manager.dart';
import 'web_storage_manager.dart';
var uuidGenerator = new Uuid(); var uuidGenerator = new Uuid();
///This type represents a callback, added with [addJavaScriptHandler], that listens to post messages sent from JavaScript. ///This type represents a callback, added with [InAppWebViewController.addJavaScriptHandler], that listens to post messages sent from JavaScript.
/// ///
///The Android implementation uses [addJavascriptInterface](https://developer.android.com/reference/android/webkit/WebView#addJavascriptInterface(java.lang.Object,%20java.lang.String)). ///The Android implementation uses [addJavascriptInterface](https://developer.android.com/reference/android/webkit/WebView#addJavascriptInterface(java.lang.Object,%20java.lang.String)).
///The iOS implementation uses [addScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537172-addscriptmessagehandler?language=objc) ///The iOS implementation uses [addScriptMessageHandler](https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1537172-addscriptmessagehandler?language=objc)
@ -64,8 +71,8 @@ class ConsoleMessageLevel {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class representing a resource response of the [InAppBrowser] WebView. ///Class representing a resource response of the [WebView].
///It is used by the method [InAppBrowser.onLoadResource()]. ///It is used by the method [WebView.onLoadResource].
class LoadedResource { class LoadedResource {
///A string representing the type of resource. ///A string representing the type of resource.
String initiatorType; String initiatorType;
@ -82,7 +89,7 @@ class LoadedResource {
LoadedResource({this.initiatorType, this.url, this.startTime, this.duration}); LoadedResource({this.initiatorType, this.url, this.startTime, this.duration});
} }
///Initial [data] as a content for an [InAppWebView] instance, using [baseUrl] as the base URL for it. ///Initial [data] as a content for an [WebView] instance, using [baseUrl] as the base URL for it.
class InAppWebViewInitialData { class InAppWebViewInitialData {
///A String of data in the given encoding. ///A String of data in the given encoding.
String data; String data;
@ -233,7 +240,7 @@ class CustomSchemeResponse {
///Class representing a JavaScript console message from WebCore. ///Class representing a JavaScript console message from WebCore.
///This could be a issued by a call to one of the console logging functions (e.g. console.log('...')) or a JavaScript error on the page. ///This could be a issued by a call to one of the console logging functions (e.g. console.log('...')) or a JavaScript error on the page.
/// ///
///To receive notifications of these messages, use the [onConsoleMessage] event. ///To receive notifications of these messages, use the [WebView.onConsoleMessage] event.
class ConsoleMessage { class ConsoleMessage {
String message; String message;
ConsoleMessageLevel messageLevel; ConsoleMessageLevel messageLevel;
@ -242,7 +249,7 @@ class ConsoleMessage {
{this.message = "", this.messageLevel = ConsoleMessageLevel.LOG}); {this.message = "", this.messageLevel = ConsoleMessageLevel.LOG});
} }
///This class contains a snapshot of the current back/forward list for a WebView. ///This class contains a snapshot of the current back/forward list for a [WebView].
class WebHistory { class WebHistory {
///List of all [WebHistoryItem]s. ///List of all [WebHistoryItem]s.
List<WebHistoryItem> list; List<WebHistoryItem> list;
@ -253,7 +260,7 @@ class WebHistory {
WebHistory({this.list, this.currentIndex}); WebHistory({this.list, this.currentIndex});
} }
///A convenience class for accessing fields in an entry in the back/forward list of a WebView. Each WebHistoryItem is a snapshot of the requested history item. ///A convenience class for accessing fields in an entry in the back/forward list of a WebView. Each [WebHistoryItem] is a snapshot of the requested history item.
class WebHistoryItem { class WebHistoryItem {
///Original url of this history item. ///Original url of this history item.
String originalUrl; String originalUrl;
@ -274,7 +281,7 @@ class WebHistoryItem {
{this.originalUrl, this.title, this.url, this.index, this.offset}); {this.originalUrl, this.title, this.url, this.index, this.offset});
} }
///Class used by the host application to set the Geolocation permission state for an origin during the [androidOnGeolocationPermissionsShowPrompt] event. ///Class used by the host application to set the Geolocation permission state for an origin during the [WebView.androidOnGeolocationPermissionsShowPrompt] event.
class GeolocationPermissionShowPromptResponse { class GeolocationPermissionShowPromptResponse {
///The origin for which permissions are set. ///The origin for which permissions are set.
String origin; String origin;
@ -309,7 +316,7 @@ class JsAlertResponseAction {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class that represents the response used by the [onJsAlert] event to control a JavaScript alert dialog. ///Class that represents the response used by the [WebView.onJsAlert] event to control a JavaScript alert dialog.
class JsAlertResponse { class JsAlertResponse {
///Message to be displayed in the window. ///Message to be displayed in the window.
String message; String message;
@ -356,7 +363,7 @@ class JsConfirmResponseAction {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class that represents the response used by the [onJsConfirm] event to control a JavaScript confirm dialog. ///Class that represents the response used by the [WebView.onJsConfirm] event to control a JavaScript confirm dialog.
class JsConfirmResponse { class JsConfirmResponse {
///Message to be displayed in the window. ///Message to be displayed in the window.
String message; String message;
@ -408,7 +415,7 @@ class JsPromptResponseAction {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class that represents the response used by the [onJsPrompt] event to control a JavaScript prompt dialog. ///Class that represents the response used by the [WebView.onJsPrompt] event to control a JavaScript prompt dialog.
class JsPromptResponse { class JsPromptResponse {
///Message to be displayed in the window. ///Message to be displayed in the window.
String message; String message;
@ -524,10 +531,10 @@ class SafeBrowsingResponseAction {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class that represents the response used by the [androidOnSafeBrowsingHit] event. ///Class that represents the response used by the [WebView.androidOnSafeBrowsingHit] event.
///It is used to indicate an action to take when hitting a malicious URL. ///It is used to indicate an action to take when hitting a malicious URL.
class SafeBrowsingResponse { class SafeBrowsingResponse {
///If reporting is enabled, all reports will be sent according to the privacy policy referenced by [InAppWebViewController.androidGetSafeBrowsingPrivacyPolicyUrl]. ///If reporting is enabled, all reports will be sent according to the privacy policy referenced by [AndroidInAppWebViewController.getSafeBrowsingPrivacyPolicyUrl].
bool report; bool report;
///Indicate the [SafeBrowsingResponseAction] to take when hitting a malicious URL. ///Indicate the [SafeBrowsingResponseAction] to take when hitting a malicious URL.
@ -566,7 +573,7 @@ class HttpAuthResponseAction {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class that represents the response used by the [onReceivedHttpAuthRequest] event. ///Class that represents the response used by the [WebView.onReceivedHttpAuthRequest] event.
class HttpAuthResponse { class HttpAuthResponse {
///Represents the username used for the authentication if the [action] corresponds to [HttpAuthResponseAction.PROCEED] ///Represents the username used for the authentication if the [action] corresponds to [HttpAuthResponseAction.PROCEED]
String username; String username;
@ -596,7 +603,7 @@ class HttpAuthResponse {
} }
} }
///Class that represents the challenge of the [onReceivedHttpAuthRequest] event. ///Class that represents the challenge of the [WebView.onReceivedHttpAuthRequest] event.
///It provides all the information about the challenge. ///It provides all the information about the challenge.
class HttpAuthChallenge { class HttpAuthChallenge {
///A count of previous failed authentication attempts. ///A count of previous failed authentication attempts.
@ -664,7 +671,7 @@ class ServerTrustAuthResponseAction {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///ServerTrustAuthResponse class represents the response used by the [onReceivedServerTrustAuthRequest] event. ///ServerTrustAuthResponse class represents the response used by the [WebView.onReceivedServerTrustAuthRequest] event.
class ServerTrustAuthResponse { class ServerTrustAuthResponse {
///Indicate the [ServerTrustAuthResponseAction] to take in response of the server trust authentication challenge. ///Indicate the [ServerTrustAuthResponseAction] to take in response of the server trust authentication challenge.
ServerTrustAuthResponseAction action; ServerTrustAuthResponseAction action;
@ -676,7 +683,7 @@ class ServerTrustAuthResponse {
} }
} }
///Class that represents the challenge of the [onReceivedServerTrustAuthRequest] event. ///Class that represents the challenge of the [WebView.onReceivedServerTrustAuthRequest] event.
///It provides all the information about the challenge. ///It provides all the information about the challenge.
class ServerTrustChallenge { class ServerTrustChallenge {
///The protection space requiring authentication. ///The protection space requiring authentication.
@ -726,7 +733,7 @@ class ClientCertResponseAction {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class that represents the response used by the [onReceivedClientCertRequest] event. ///Class that represents the response used by the [WebView.onReceivedClientCertRequest] event.
class ClientCertResponse { class ClientCertResponse {
///The file path of the certificate to use. ///The file path of the certificate to use.
String certificatePath; String certificatePath;
@ -759,7 +766,7 @@ class ClientCertResponse {
} }
} }
///Class that represents the challenge of the [onReceivedClientCertRequest] event. ///Class that represents the challenge of the [WebView.onReceivedClientCertRequest] event.
///It provides all the information about the challenge. ///It provides all the information about the challenge.
class ClientCertChallenge { class ClientCertChallenge {
///The protection space requiring authentication. ///The protection space requiring authentication.
@ -1058,7 +1065,7 @@ class IOSWKSelectionGranularity {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class that represents an iOS-specific class used to specify a dataDetectoryTypes value that adds interactivity to web content that matches the value. ///Class that represents an iOS-specific class used to specify a `dataDetectoryTypes` value that adds interactivity to web content that matches the value.
/// ///
///**NOTE**: available on iOS 10.0+. ///**NOTE**: available on iOS 10.0+.
class IOSWKDataDetectorTypes { class IOSWKDataDetectorTypes {
@ -2126,7 +2133,7 @@ class PermissionRequestResponseAction {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class that represents the response used by the [androidOnPermissionRequest] event. ///Class that represents the response used by the [WebView.androidOnPermissionRequest] event.
class PermissionRequestResponse { class PermissionRequestResponse {
///Resources granted to be accessed by origin. ///Resources granted to be accessed by origin.
List<String> resources; List<String> resources;
@ -2143,7 +2150,7 @@ class PermissionRequestResponse {
} }
} }
///Class that is used by [shouldOverrideUrlLoading] event. ///Class that is used by [WebView.shouldOverrideUrlLoading] event.
///It represents the policy to pass back to the decision handler. ///It represents the policy to pass back to the decision handler.
class ShouldOverrideUrlLoadingAction { class ShouldOverrideUrlLoadingAction {
final int _value; final int _value;
@ -2170,7 +2177,7 @@ class ShouldOverrideUrlLoadingAction {
} }
} }
///Class that represents the type of action triggering a navigation on iOS for the [shouldOverrideUrlLoading] event. ///Class that represents the type of action triggering a navigation on iOS for the [WebView.shouldOverrideUrlLoading] event.
class IOSWKNavigationType { class IOSWKNavigationType {
final int _value; final int _value;
@ -2208,7 +2215,7 @@ class IOSWKNavigationType {
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }
///Class that represents the navigation request used by the [shouldOverrideUrlLoading] event. ///Class that represents the navigation request used by the [WebView.shouldOverrideUrlLoading] event.
class ShouldOverrideUrlLoadingRequest { class ShouldOverrideUrlLoadingRequest {
///Represents the url of the navigation request. ///Represents the url of the navigation request.
String url; String url;
@ -2246,7 +2253,7 @@ class ShouldOverrideUrlLoadingRequest {
this.iosWKNavigationType}); this.iosWKNavigationType});
} }
///Class that represents the navigation request used by the [shouldOverrideUrlLoading] event. ///Class that represents the navigation request used by the [WebView.onCreateWindow] event.
class OnCreateWindowRequest { class OnCreateWindowRequest {
///Represents the url of the navigation request. ///Represents the url of the navigation request.
String url; String url;
@ -2680,8 +2687,9 @@ class AndroidOverScrollMode {
///The scrollbars can be overlaid or inset. ///The scrollbars can be overlaid or inset.
///When inset, they add to the padding of the view. And the scrollbars can be drawn inside the padding area or on the edge of the view. ///When inset, they add to the padding of the view. And the scrollbars can be drawn inside the padding area or on the edge of the view.
///For example, if a view has a background drawable and you want to draw the scrollbars inside the padding specified by the drawable, ///For example, if a view has a background drawable and you want to draw the scrollbars inside the padding specified by the drawable,
///you can use SCROLLBARS_INSIDE_OVERLAY or SCROLLBARS_INSIDE_INSET. If you want them to appear at the edge of the view, ignoring the padding, ///you can use [AndroidScrollBarStyle.SCROLLBARS_INSIDE_OVERLAY] or [AndroidScrollBarStyle.SCROLLBARS_INSIDE_INSET].
///then you can use SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET. ///If you want them to appear at the edge of the view, ignoring the padding,
///then you can use [AndroidScrollBarStyle.SCROLLBARS_OUTSIDE_OVERLAY] or [AndroidScrollBarStyle.SCROLLBARS_OUTSIDE_INSET].
class AndroidScrollBarStyle { class AndroidScrollBarStyle {
final int _value; final int _value;
@ -2783,9 +2791,9 @@ class AndroidVerticalScrollbarPosition {
///Class that represents an Android WebView package info. ///Class that represents an Android WebView package info.
class AndroidWebViewPackageInfo { class AndroidWebViewPackageInfo {
///The version name of this package. ///The version name of this WebView package.
String versionName; String versionName;
///The name of this package. ///The name of this WebView package.
String packageName; String packageName;
AndroidWebViewPackageInfo({this.versionName, this.packageName}); AndroidWebViewPackageInfo({this.versionName, this.packageName});

View File

@ -6,6 +6,8 @@ import 'package:flutter/services.dart';
import 'types.dart'; import 'types.dart';
///Class that implements a singleton object (shared instance) which manages the web storage used by WebView instances. ///Class that implements a singleton object (shared instance) which manages the web storage used by WebView instances.
///On Android, it is implemented using [WebStorage](https://developer.android.com/reference/android/webkit/WebStorage.html).
///On iOS, it is implemented using [WKWebsiteDataStore.default()](https://developer.apple.com/documentation/webkit/wkwebsitedatastore).
/// ///
///**NOTE for iOS**: available from iOS 9.0+. ///**NOTE for iOS**: available from iOS 9.0+.
class WebStorageManager { class WebStorageManager {

View File

@ -2,6 +2,8 @@ import 'package:flutter_inappwebview/src/context_menu.dart';
import 'types.dart'; import 'types.dart';
import 'in_app_webview_controller.dart'; import 'in_app_webview_controller.dart';
import 'webview_options.dart';
import 'headless_in_app_webview.dart';
///Abstract class that represents a WebView. Used by [WebView] and [HeadlessInAppWebView]. ///Abstract class that represents a WebView. Used by [WebView] and [HeadlessInAppWebView].
abstract class WebView { abstract class WebView {