Commit 08b392e8 authored by Lorenzo Pichilli's avatar Lorenzo Pichilli

updated docs, updated README.md

parent 3dd7d175
This diff is collapsed.
This diff is collapsed.
...@@ -14,8 +14,6 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> { ...@@ -14,8 +14,6 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
String url = ""; String url = "";
double progress = 0; double progress = 0;
TextEditingController _textFieldController = TextEditingController();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -24,16 +22,14 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> { ...@@ -24,16 +22,14 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
_textFieldController.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text( title: Text("InAppWebView")
"InAppWebView", ),
)),
drawer: myDrawer(context: context), drawer: myDrawer(context: context),
body: Container( body: Container(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
...@@ -58,7 +54,6 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> { ...@@ -58,7 +54,6 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
initialOptions: InAppWebViewWidgetOptions( initialOptions: InAppWebViewWidgetOptions(
inAppWebViewOptions: InAppWebViewOptions( inAppWebViewOptions: InAppWebViewOptions(
debuggingEnabled: true, debuggingEnabled: true,
clearCache: true
) )
), ),
onWebViewCreated: (InAppWebViewController controller) { onWebViewCreated: (InAppWebViewController controller) {
...@@ -111,6 +106,7 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> { ...@@ -111,6 +106,7 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
), ),
], ],
), ),
]))); ]))
);
} }
} }
...@@ -42,7 +42,6 @@ flutter: ...@@ -42,7 +42,6 @@ flutter:
uses-material-design: true uses-material-design: true
assets: assets:
- assets/certificate.pfx
- assets/index.html - assets/index.html
- assets/page-1.html - assets/page-1.html
- assets/page-2.html - assets/page-2.html
......
...@@ -105,6 +105,7 @@ class ChromeSafariBrowser { ...@@ -105,6 +105,7 @@ class ChromeSafariBrowser {
} }
///Returns `true` if the [ChromeSafariBrowser] instance is opened, otherwise `false`.
bool isOpened() { bool isOpened() {
return this._isOpened; return this._isOpened;
} }
......
...@@ -5,13 +5,14 @@ import 'package:flutter/services.dart'; ...@@ -5,13 +5,14 @@ import 'package:flutter/services.dart';
import 'types.dart'; import 'types.dart';
///Manages the cookies used by WebView instances. ///CookieManager class implements a singleton object (shared instance) which manages the cookies used by WebView instances.
/// ///
///**NOTE for iOS**: available from iOS 11.0+. ///**NOTE for iOS**: available from iOS 11.0+.
class CookieManager { class CookieManager {
static CookieManager _instance; static CookieManager _instance;
static const MethodChannel _channel = const MethodChannel('com.pichillilorenzo/flutter_inappbrowser_cookiemanager'); static const MethodChannel _channel = const MethodChannel('com.pichillilorenzo/flutter_inappbrowser_cookiemanager');
///Gets the cookie manager shared instance.
static CookieManager instance() { static CookieManager instance() {
return (_instance != null) ? _instance : _init(); return (_instance != null) ? _instance : _init();
} }
......
...@@ -281,27 +281,32 @@ class InAppBrowser { ...@@ -281,27 +281,32 @@ class InAppBrowser {
return this._isOpened; return this._isOpened;
} }
///Event fires when the [InAppBrowser] is created. ///Event fired when the [InAppBrowser] is created.
void onBrowserCreated() { void onBrowserCreated() {
} }
///Event fires when the [InAppBrowser] starts to load an [url]. ///Event fired when the [InAppBrowser] window is closed.
void onExit() {
}
///Event fired when the [InAppBrowser] starts to load an [url].
void onLoadStart(String url) { void onLoadStart(String url) {
} }
///Event fires when the [InAppBrowser] finishes loading an [url]. ///Event fired when the [InAppBrowser] finishes loading an [url].
void onLoadStop(String url) { void onLoadStop(String url) {
} }
///Event fires when the [InAppBrowser] encounters an error loading an [url]. ///Event fired when the [InAppBrowser] encounters an error loading an [url].
void onLoadError(String url, int code, String message) { void onLoadError(String url, int code, String message) {
} }
///Event fires when the [InAppBrowser] main page receives an HTTP error. ///Event fired when the [InAppBrowser] main page receives an HTTP error.
/// ///
///[url] represents the url of the main page that received the HTTP error. ///[url] represents the url of the main page that received the HTTP error.
/// ///
...@@ -314,17 +319,12 @@ class InAppBrowser { ...@@ -314,17 +319,12 @@ class InAppBrowser {
} }
///Event fires when the current [progress] (range 0-100) of loading a page is changed. ///Event fired when the current [progress] (range 0-100) of loading a page is changed.
void onProgressChanged(int progress) { void onProgressChanged(int progress) {
} }
///Event fires when the [InAppBrowser] window is closed. ///Event fired when the [InAppBrowser] webview receives a [ConsoleMessage].
void onExit() {
}
///Event fires when the [InAppBrowser] webview receives a [ConsoleMessage].
void onConsoleMessage(ConsoleMessage consoleMessage) { void onConsoleMessage(ConsoleMessage consoleMessage) {
} }
...@@ -336,14 +336,14 @@ class InAppBrowser { ...@@ -336,14 +336,14 @@ class InAppBrowser {
} }
///Event fires when the [InAppBrowser] webview loads a resource. ///Event fired when the [InAppBrowser] webview loads a resource.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnLoadResource] and [InAppWebViewOptions.javaScriptEnabled] options to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnLoadResource] and [InAppWebViewOptions.javaScriptEnabled] options to `true`.
void onLoadResource(LoadedResource resource) { void onLoadResource(LoadedResource resource) {
} }
///Event fires when the [InAppBrowser] webview scrolls. ///Event fired when the [InAppBrowser] webview scrolls.
/// ///
///[x] represents the current horizontal scroll origin in pixels. ///[x] represents the current horizontal scroll origin in pixels.
/// ///
...@@ -352,7 +352,7 @@ class InAppBrowser { ...@@ -352,7 +352,7 @@ class InAppBrowser {
} }
///Event fires when [InAppBrowser] recognizes and starts a downloadable file. ///Event fired when [InAppBrowser] recognizes and starts a downloadable file.
/// ///
///[url] represents the url of the file. ///[url] represents the url of the file.
/// ///
...@@ -361,7 +361,7 @@ class InAppBrowser { ...@@ -361,7 +361,7 @@ class InAppBrowser {
} }
///Event fires when the [InAppBrowser] webview finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`. ///Event fired when the [InAppBrowser] webview finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`.
/// ///
///[scheme] represents the scheme of the url. ///[scheme] represents the scheme of the url.
/// ///
...@@ -371,7 +371,7 @@ class InAppBrowser { ...@@ -371,7 +371,7 @@ class InAppBrowser {
} }
///Event fires when the [InAppBrowser] webview tries to open a link with `target="_blank"`. ///Event fired when the [InAppBrowser] webview tries to open a link with `target="_blank"`.
/// ///
///[url] represents the url of the link. ///[url] represents the url of the link.
/// ///
...@@ -386,13 +386,13 @@ class InAppBrowser { ...@@ -386,13 +386,13 @@ class InAppBrowser {
/// ///
///[origin] represents the origin of the web content attempting to use the Geolocation API. ///[origin] represents the origin of the web content attempting to use the Geolocation API.
/// ///
///**NOTE**: available only for Android. ///**NOTE**: available only on Android.
// ignore: missing_return // ignore: missing_return
Future<GeolocationPermissionShowPromptResponse> onGeolocationPermissionsShowPrompt (String origin) { Future<GeolocationPermissionShowPromptResponse> onGeolocationPermissionsShowPrompt (String origin) {
} }
///Event fires when javascript calls the `alert()` method to display an alert dialog. ///Event fired when javascript calls the `alert()` method to display an alert dialog.
///If [JsAlertResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog. ///If [JsAlertResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
/// ///
///[message] represents the message to be displayed in the alert dialog. ///[message] represents the message to be displayed in the alert dialog.
...@@ -401,7 +401,7 @@ class InAppBrowser { ...@@ -401,7 +401,7 @@ class InAppBrowser {
} }
///Event fires when javascript calls the `confirm()` method to display a confirm dialog. ///Event fired when javascript calls the `confirm()` method to display a confirm dialog.
///If [JsConfirmResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog. ///If [JsConfirmResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
/// ///
///[message] represents the message to be displayed in the alert dialog. ///[message] represents the message to be displayed in the alert dialog.
...@@ -410,7 +410,7 @@ class InAppBrowser { ...@@ -410,7 +410,7 @@ class InAppBrowser {
} }
///Event fires when javascript calls the `prompt()` method to display a prompt dialog. ///Event fired when javascript calls the `prompt()` method to display a prompt dialog.
///If [JsPromptResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog. ///If [JsPromptResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
/// ///
///[message] represents the message to be displayed in the alert dialog. ///[message] represents the message to be displayed in the alert dialog.
...@@ -420,20 +420,20 @@ class InAppBrowser { ...@@ -420,20 +420,20 @@ class InAppBrowser {
} }
///Event fires when the webview notifies that a loading URL has been flagged by Safe Browsing. ///Event fired when the webview notifies that a loading URL has been flagged by Safe Browsing.
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible. ///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
/// ///
///[url] represents the url of the request. ///[url] represents the url of the request.
/// ///
///[threatType] represents the reason the resource was caught by Safe Browsing, corresponding to a [SafeBrowsingThreat]. ///[threatType] represents the reason the resource was caught by Safe Browsing, corresponding to a [SafeBrowsingThreat].
/// ///
///**NOTE**: available only for Android. ///**NOTE**: available only on Android.
// ignore: missing_return // ignore: missing_return
Future<SafeBrowsingResponse> onSafeBrowsingHit(String url, SafeBrowsingThreat threatType) { Future<SafeBrowsingResponse> onSafeBrowsingHit(String url, SafeBrowsingThreat threatType) {
} }
///Event fires when the WebView received an HTTP authentication request. The default behavior is to cancel the request. ///Event fired when the WebView received an HTTP authentication request. The default behavior is to cancel the request.
/// ///
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [HttpAuthChallenge]. ///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [HttpAuthChallenge].
// ignore: missing_return // ignore: missing_return
...@@ -441,7 +441,7 @@ class InAppBrowser { ...@@ -441,7 +441,7 @@ class InAppBrowser {
} }
///Event fires when the WebView need to perform server trust authentication (certificate validation). ///Event fired when the WebView need to perform server trust authentication (certificate validation).
///The host application must return either [ServerTrustAuthResponse] instance with [ServerTrustAuthResponseAction.CANCEL] or [ServerTrustAuthResponseAction.PROCEED]. ///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]. ///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ServerTrustChallenge].
...@@ -506,7 +506,7 @@ class InAppBrowser { ...@@ -506,7 +506,7 @@ class InAppBrowser {
} }
///Event fired when an request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API). ///Event fired when a request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API).
///It gives the host application a chance to take control over the request before sending it. ///It gives the host application a chance to take control over the request before sending it.
/// ///
///[fetchRequest] represents a resource request. ///[fetchRequest] represents a resource request.
......
This diff is collapsed.
...@@ -193,7 +193,7 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti ...@@ -193,7 +193,7 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti
///This class represents all the Android-only WebView options available. ///This class represents all the Android-only WebView options available.
class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOptions { class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOptions {
///Sets the text zoom of the page in percent. The default is `100`. ///Sets the text zoom of the page in percent. The default value is `100`.
int textZoom; int textZoom;
///Set to `true` to have the session cookie cache cleared before the new window is opened. ///Set to `true` to have the session cookie cache cleared before the new window is opened.
bool clearSessionCache; bool clearSessionCache;
...@@ -278,7 +278,7 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr ...@@ -278,7 +278,7 @@ class AndroidInAppWebViewOptions implements WebViewOptions, BrowserOptions, Andr
bool loadsImagesAutomatically; bool loadsImagesAutomatically;
///Sets the minimum logical font size. The default is `8`. ///Sets the minimum logical font size. The default is `8`.
int minimumLogicalFontSize; int minimumLogicalFontSize;
///Sets the initial scale for this WebView. 0 means default.The behavior for the default scale depends on the state of [useWideViewPort] and [loadWithOverviewMode]. ///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 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 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. ///If initial scale is greater than 0, WebView starts with this value as initial scale.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment