updated code docs
This commit is contained in:
parent
bb0e7f70c7
commit
44c17d1efe
|
@ -15,11 +15,17 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
|
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/ContentBlocker/ContentBlockerHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/ContentBlocker/ContentBlockerHandler.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewOptions.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewOptions.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/example/lib/webview_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/webview_example.screen.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/chrome_safari_browser.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/chrome_safari_browser.dart" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/lib/src/content_blocker.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/content_blocker.dart" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/lib/src/content_blocker.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/content_blocker.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/cookie_manager.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/cookie_manager.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/in_app_browser.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/in_app_browser.dart" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/lib/src/in_app_webview.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/in_app_webview.dart" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/lib/src/in_app_webview.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/in_app_webview.dart" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/lib/src/types.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/types.dart" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/.dart_tool/" />
|
<ignored path="$PROJECT_DIR$/.dart_tool/" />
|
||||||
<ignored path="$PROJECT_DIR$/.idea/" />
|
<ignored path="$PROJECT_DIR$/.idea/" />
|
||||||
|
@ -39,11 +45,11 @@
|
||||||
<component name="ExecutionTargetManager" SELECTED_TARGET="Pixel_3_XL_API_24" />
|
<component name="ExecutionTargetManager" SELECTED_TARGET="Pixel_3_XL_API_24" />
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="65">
|
<state relative-caret-position="194">
|
||||||
<caret line="590" column="27" selection-start-line="590" selection-start-column="27" selection-end-line="590" selection-end-column="27" />
|
<caret line="563" column="118" selection-start-line="563" selection-start-column="118" selection-end-line="563" selection-end-column="118" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#17#0" expanded="true" />
|
<element signature="e#0#17#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -51,11 +57,11 @@
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart">
|
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="45">
|
<state relative-caret-position="323">
|
||||||
<caret line="6" column="32" selection-start-line="6" selection-start-column="6" selection-end-line="6" selection-end-column="32" />
|
<caret line="244" column="116" selection-start-line="244" selection-start-column="116" selection-end-line="244" selection-end-column="116" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -64,52 +70,22 @@
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/content_blocker.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="90">
|
<state relative-caret-position="204">
|
||||||
<caret line="6" selection-start-line="6" selection-end-line="6" />
|
<caret line="188" column="66" selection-start-line="188" selection-start-column="61" selection-end-line="188" selection-end-column="66" />
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/webview_options.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="205">
|
|
||||||
<caret line="41" column="34" selection-start-line="41" selection-start-column="7" selection-end-line="41" selection-end-column="34" />
|
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#17#0" expanded="true" />
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state>
|
|
||||||
<caret line="88" column="53" lean-forward="true" selection-start-line="88" selection-start-column="53" selection-end-line="88" selection-end-column="53" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="285">
|
<state relative-caret-position="613">
|
||||||
<caret line="21" column="9" selection-start-line="21" selection-start-column="9" selection-end-line="21" selection-end-column="9" />
|
<caret line="128" selection-start-line="128" selection-end-line="128" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="24">
|
|
||||||
<caret line="289" column="28" selection-start-line="289" selection-start-column="28" selection-end-line="289" selection-end-column="28" />
|
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -120,8 +96,8 @@
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/chrome_safari_browser.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/chrome_safari_browser.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="960">
|
<state relative-caret-position="180">
|
||||||
<caret line="71" column="133" selection-start-line="71" selection-start-column="28" selection-end-line="71" selection-end-column="133" />
|
<caret line="24" column="32" lean-forward="true" selection-start-line="24" selection-start-column="32" selection-end-line="24" selection-end-column="32" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -141,8 +117,6 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="FindInProjectRecents">
|
<component name="FindInProjectRecents">
|
||||||
<findStrings>
|
<findStrings>
|
||||||
<find>JsAlertResponse</find>
|
|
||||||
<find>JsConfirmResponse</find>
|
|
||||||
<find>InAppWebViewUserPreferredContentMode</find>
|
<find>InAppWebViewUserPreferredContentMode</find>
|
||||||
<find>onSag</find>
|
<find>onSag</find>
|
||||||
<find>ServerTrustAuthResponse</find>
|
<find>ServerTrustAuthResponse</find>
|
||||||
|
@ -171,6 +145,8 @@
|
||||||
<find>should</find>
|
<find>should</find>
|
||||||
<find>resourceCustomSchemes</find>
|
<find>resourceCustomSchemes</find>
|
||||||
<find>shouldInterceptAjaxRequest</find>
|
<find>shouldInterceptAjaxRequest</find>
|
||||||
|
<find>evaluateJavascript</find>
|
||||||
|
<find>WebHistory</find>
|
||||||
</findStrings>
|
</findStrings>
|
||||||
<replaceStrings>
|
<replaceStrings>
|
||||||
<replace>activity.getPreferences(0)</replace>
|
<replace>activity.getPreferences(0)</replace>
|
||||||
|
@ -223,8 +199,6 @@
|
||||||
<option value="$PROJECT_DIR$/lib/src/credentials_database.dart" />
|
<option value="$PROJECT_DIR$/lib/src/credentials_database.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
|
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/channel_manager.dart" />
|
<option value="$PROJECT_DIR$/lib/src/channel_manager.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/cookie_manager.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/android/build.gradle" />
|
<option value="$PROJECT_DIR$/android/build.gradle" />
|
||||||
<option value="$PROJECT_DIR$/lib/t_rex_runner/index.js" />
|
<option value="$PROJECT_DIR$/lib/t_rex_runner/index.js" />
|
||||||
<option value="$PROJECT_DIR$/lib/t_rex_runner/index.css" />
|
<option value="$PROJECT_DIR$/lib/t_rex_runner/index.css" />
|
||||||
|
@ -233,20 +207,22 @@
|
||||||
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||||
<option value="$PROJECT_DIR$/lib/t_rex_runner/t-rex.css" />
|
<option value="$PROJECT_DIR$/lib/t_rex_runner/t-rex.css" />
|
||||||
<option value="$PROJECT_DIR$/example/lib/test.dart" />
|
<option value="$PROJECT_DIR$/example/lib/test.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/lib/webview_example.screen.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/src/chrome_safari_browser.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
|
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
|
||||||
<option value="$PROJECT_DIR$/ios/flutter_inappbrowser.podspec" />
|
<option value="$PROJECT_DIR$/ios/flutter_inappbrowser.podspec" />
|
||||||
<option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" />
|
<option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" />
|
||||||
<option value="$PROJECT_DIR$/example/assets/index.html" />
|
<option value="$PROJECT_DIR$/example/assets/index.html" />
|
||||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/in_app_browser.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/src/webview_options.dart" />
|
<option value="$PROJECT_DIR$/lib/src/webview_options.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/types.dart" />
|
|
||||||
<option value="$PROJECT_DIR$/lib/src/content_blocker.dart" />
|
<option value="$PROJECT_DIR$/lib/src/content_blocker.dart" />
|
||||||
<option value="$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
|
<option value="$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/cookie_manager.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/chrome_safari_browser.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/in_app_browser.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/example/lib/webview_example.screen.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/lib/src/types.dart" />
|
||||||
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
|
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
|
||||||
|
<option value="$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
@ -503,7 +479,7 @@
|
||||||
<window_info id="Resources Explorer" order="8" />
|
<window_info id="Resources Explorer" order="8" />
|
||||||
<window_info anchor="bottom" id="Message" order="0" />
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32642487" />
|
<window_info anchor="bottom" id="Find" order="1" weight="0.32642487" />
|
||||||
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49574015" visible="true" weight="0.5647668" />
|
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49574015" weight="0.39170983" />
|
||||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.34196892" />
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.34196892" />
|
||||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||||
|
@ -515,7 +491,7 @@
|
||||||
<window_info anchor="bottom" id="Messages" order="11" weight="0.3253886" />
|
<window_info anchor="bottom" id="Messages" order="11" weight="0.3253886" />
|
||||||
<window_info anchor="bottom" id="Dependency Viewer" order="12" weight="0.32800853" />
|
<window_info anchor="bottom" id="Dependency Viewer" order="12" weight="0.32800853" />
|
||||||
<window_info anchor="bottom" id="Logcat" order="13" weight="0.32953367" />
|
<window_info anchor="bottom" id="Logcat" order="13" weight="0.32953367" />
|
||||||
<window_info anchor="bottom" id="Dart Analysis" order="14" sideWeight="0.4968051" weight="0.3253886" />
|
<window_info active="true" anchor="bottom" id="Dart Analysis" order="14" sideWeight="0.4968051" visible="true" weight="0.3253886" />
|
||||||
<window_info anchor="bottom" id="Flutter Performance" order="15" sideWeight="0.5042598" side_tool="true" weight="0.5160622" />
|
<window_info anchor="bottom" id="Flutter Performance" order="15" sideWeight="0.5042598" side_tool="true" weight="0.5160622" />
|
||||||
<window_info anchor="bottom" id="Build" order="16" />
|
<window_info anchor="bottom" id="Build" order="16" />
|
||||||
<window_info anchor="bottom" id="Thumbnails" order="17" weight="0.32953367" />
|
<window_info anchor="bottom" id="Thumbnails" order="17" weight="0.32953367" />
|
||||||
|
@ -655,26 +631,6 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/example/lib/webview_example.screen.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="465">
|
|
||||||
<caret line="131" column="14" selection-start-line="131" selection-start-column="14" selection-end-line="131" selection-end-column="14" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="600">
|
|
||||||
<caret line="45" column="53" lean-forward="true" selection-start-line="45" selection-start-column="53" selection-end-line="45" selection-end-column="53" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#0#39#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/build/app/outputs/apk/debug/output.json">
|
<entry file="file://$PROJECT_DIR$/example/build/app/outputs/apk/debug/output.json">
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -712,16 +668,6 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_browser.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="189">
|
|
||||||
<caret line="468" column="167" selection-start-line="468" selection-start-column="167" selection-end-line="468" selection-end-column="167" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="315">
|
<state relative-caret-position="315">
|
||||||
|
@ -729,37 +675,17 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="17325">
|
<state>
|
||||||
<caret line="1155" column="33" lean-forward="true" selection-start-line="1155" selection-start-column="33" selection-end-line="1155" selection-end-column="33" />
|
<caret line="88" column="53" selection-start-line="88" selection-start-column="53" selection-end-line="88" selection-end-column="53" />
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="45">
|
|
||||||
<caret line="6" column="32" selection-start-line="6" selection-start-column="6" selection-end-line="6" selection-end-column="32" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/content_blocker.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="90">
|
|
||||||
<caret line="6" selection-start-line="6" selection-end-line="6" />
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="285">
|
<state relative-caret-position="613">
|
||||||
<caret line="21" column="9" selection-start-line="21" selection-start-column="9" selection-end-line="21" selection-end-column="9" />
|
<caret line="128" selection-start-line="128" selection-end-line="128" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -768,51 +694,101 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/chrome_safari_browser.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/chrome_safari_browser.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="960">
|
<state relative-caret-position="180">
|
||||||
<caret line="71" column="133" selection-start-line="71" selection-start-column="28" selection-end-line="71" selection-end-column="133" />
|
<caret line="24" column="32" lean-forward="true" selection-start-line="24" selection-start-column="32" selection-end-line="24" selection-end-column="32" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/example/lib/webview_example.screen.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="528">
|
||||||
|
<caret line="118" column="43" lean-forward="true" selection-start-line="118" selection-start-column="43" selection-end-line="118" selection-end-column="43" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/in_app_browser.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="240">
|
||||||
|
<caret line="501" column="27" selection-start-line="501" selection-start-column="27" selection-end-line="501" selection-end-column="27" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/http_auth_credentials_database.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="1136">
|
||||||
|
<caret line="87" column="84" selection-start-line="87" selection-start-column="84" selection-end-line="87" selection-end-column="84" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/content_blocker.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="225">
|
||||||
|
<caret line="15" column="28" selection-start-line="15" selection-start-column="17" selection-end-line="15" selection-end-column="28" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/webview_options.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/webview_options.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="205">
|
<state relative-caret-position="5379">
|
||||||
<caret line="41" column="34" selection-start-line="41" selection-start-column="7" selection-end-line="41" selection-end-column="34" />
|
<caret line="363" column="36" selection-start-line="363" selection-start-column="36" selection-end-line="363" selection-end-column="36" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#17#0" expanded="true" />
|
<element signature="e#0#17#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
<entry file="file://$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state>
|
<state relative-caret-position="570">
|
||||||
<caret line="88" column="53" lean-forward="true" selection-start-line="88" selection-start-column="53" selection-end-line="88" selection-end-column="53" />
|
<caret line="38" column="43" selection-start-line="38" selection-start-column="43" selection-end-line="38" selection-end-column="43" />
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="24">
|
|
||||||
<caret line="289" column="28" selection-start-line="289" selection-start-column="28" selection-end-line="289" selection-end-column="28" />
|
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#20#0" expanded="true" />
|
<element signature="e#0#39#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="65">
|
<state relative-caret-position="194">
|
||||||
<caret line="590" column="27" selection-start-line="590" selection-start-column="27" selection-end-line="590" selection-end-column="27" />
|
<caret line="563" column="118" selection-start-line="563" selection-start-column="118" selection-end-line="563" selection-end-column="118" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#0#17#0" expanded="true" />
|
<element signature="e#0#17#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="204">
|
||||||
|
<caret line="188" column="66" selection-start-line="188" selection-start-column="61" selection-end-line="188" selection-end-column="66" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="323">
|
||||||
|
<caret line="244" column="116" selection-start-line="244" selection-start-column="116" selection-end-line="244" selection-end-column="116" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#0#20#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
</component>
|
</component>
|
||||||
<component name="masterDetails">
|
<component name="masterDetails">
|
||||||
<states>
|
<states>
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class ContentBlockerHandler {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAKE_HTTPS:
|
case MAKE_HTTPS:
|
||||||
if (url.startsWith("http://")) {
|
if (scheme.equals("http") && (port == -1 || port == 80)) {
|
||||||
String urlHttps = url.replace("http://", "https://");
|
String urlHttps = url.replace("http://", "https://");
|
||||||
|
|
||||||
Request mRequest = new Request.Builder().url(urlHttps).build();
|
Request mRequest = new Request.Builder().url(urlHttps).build();
|
||||||
|
|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||||
|
|
||||||
class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
||||||
MyChromeSafariBrowser(browserFallback) : super(browserFallback);
|
MyChromeSafariBrowser(browserFallback) : super(bFallback: browserFallback);
|
||||||
@override
|
@override
|
||||||
void onOpened() {
|
void onOpened() {
|
||||||
print("ChromeSafari browser opened");
|
print("ChromeSafari browser opened");
|
||||||
|
@ -36,7 +36,7 @@ class _ChromeSafariExampleScreenState extends State<ChromeSafariExampleScreen> {
|
||||||
return new Center(
|
return new Center(
|
||||||
child: new RaisedButton(
|
child: new RaisedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await widget.browser.open("https://flutter.dev/",
|
await widget.browser.open(url: "https://flutter.dev/",
|
||||||
options: ChromeSafariBrowserClassOptions(
|
options: ChromeSafariBrowserClassOptions(
|
||||||
androidChromeCustomTabsOptions: AndroidChromeCustomTabsOptions(addShareButton: false),
|
androidChromeCustomTabsOptions: AndroidChromeCustomTabsOptions(addShareButton: false),
|
||||||
iosSafariOptions: IosSafariOptions(barCollapsingEnabled: true)
|
iosSafariOptions: IosSafariOptions(barCollapsingEnabled: true)
|
||||||
|
|
|
@ -104,10 +104,11 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
|
||||||
resourceCustomSchemes: ["my-special-custom-scheme"],
|
resourceCustomSchemes: ["my-special-custom-scheme"],
|
||||||
contentBlockers: [
|
contentBlockers: [
|
||||||
ContentBlocker(
|
ContentBlocker(
|
||||||
ContentBlockerTrigger(".*",
|
trigger: ContentBlockerTrigger(
|
||||||
|
urlFilter: ".*",
|
||||||
resourceType: [ContentBlockerTriggerResourceType.IMAGE, ContentBlockerTriggerResourceType.STYLE_SHEET],
|
resourceType: [ContentBlockerTriggerResourceType.IMAGE, ContentBlockerTriggerResourceType.STYLE_SHEET],
|
||||||
ifTopUrl: ["https://getbootstrap.com/"]),
|
ifTopUrl: ["https://getbootstrap.com/"]),
|
||||||
ContentBlockerAction(ContentBlockerActionType.BLOCK)
|
action: ContentBlockerAction(type: ContentBlockerActionType.BLOCK)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
@ -125,11 +126,11 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
|
||||||
if (Platform.isAndroid)
|
if (Platform.isAndroid)
|
||||||
webView.startSafeBrowsing();
|
webView.startSafeBrowsing();
|
||||||
|
|
||||||
webView.addJavaScriptHandler('handlerFoo', (args) {
|
webView.addJavaScriptHandler(handlerName:'handlerFoo', callback: (args) {
|
||||||
return new Foo(bar: 'bar_value', baz: 'baz_value');
|
return new Foo(bar: 'bar_value', baz: 'baz_value');
|
||||||
});
|
});
|
||||||
|
|
||||||
webView.addJavaScriptHandler('handlerFooWithArgs', (args) {
|
webView.addJavaScriptHandler(handlerName: 'handlerFooWithArgs', callback: (args) {
|
||||||
print(args);
|
print(args);
|
||||||
return [args[0] + 5, !args[1], args[2][0], args[3]['foo']];
|
return [args[0] + 5, !args[1], args[2][0], args[3]['foo']];
|
||||||
});
|
});
|
||||||
|
@ -155,20 +156,20 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
|
||||||
var tRexHtml = await controller.getTRexRunnerHtml();
|
var tRexHtml = await controller.getTRexRunnerHtml();
|
||||||
var tRexCss = await controller.getTRexRunnerCss();
|
var tRexCss = await controller.getTRexRunnerCss();
|
||||||
|
|
||||||
controller.loadData("""
|
controller.loadData(data: """
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
|
||||||
<style>${tRexCss}</style>
|
<style>$tRexCss</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
${tRexHtml}
|
$tRexHtml
|
||||||
<p>
|
<p>
|
||||||
URL ${url} failed to load.
|
URL $url failed to load.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Error: ${code}, ${message}
|
Error: $code, $message
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -182,7 +183,7 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
|
||||||
},
|
},
|
||||||
shouldOverrideUrlLoading: (InAppWebViewController controller, String url) {
|
shouldOverrideUrlLoading: (InAppWebViewController controller, String url) {
|
||||||
print("override $url");
|
print("override $url");
|
||||||
controller.loadUrl(url);
|
controller.loadUrl(url: url);
|
||||||
},
|
},
|
||||||
onLoadResource: (InAppWebViewController controller, LoadedResource response) {
|
onLoadResource: (InAppWebViewController controller, LoadedResource response) {
|
||||||
print("Resource type: '"+response.initiatorType + "' started at: " +
|
print("Resource type: '"+response.initiatorType + "' started at: " +
|
||||||
|
@ -212,14 +213,14 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
|
||||||
onLoadResourceCustomScheme: (InAppWebViewController controller, String scheme, String url) async {
|
onLoadResourceCustomScheme: (InAppWebViewController controller, String scheme, String url) async {
|
||||||
if (scheme == "my-special-custom-scheme") {
|
if (scheme == "my-special-custom-scheme") {
|
||||||
var bytes = await rootBundle.load("assets/" + url.replaceFirst("my-special-custom-scheme://", "", 0));
|
var bytes = await rootBundle.load("assets/" + url.replaceFirst("my-special-custom-scheme://", "", 0));
|
||||||
var response = new CustomSchemeResponse(bytes.buffer.asUint8List(), "image/svg+xml", contentEnconding: "utf-8");
|
var response = new CustomSchemeResponse(data: bytes.buffer.asUint8List(), contentType: "image/svg+xml", contentEnconding: "utf-8");
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
onTargetBlank: (InAppWebViewController controller, String url) {
|
onTargetBlank: (InAppWebViewController controller, String url) {
|
||||||
print("target _blank: " + url);
|
print("target _blank: " + url);
|
||||||
controller.loadUrl(url);
|
controller.loadUrl(url: url);
|
||||||
},
|
},
|
||||||
onGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async {
|
onGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async {
|
||||||
GeolocationPermissionShowPromptResponse response;
|
GeolocationPermissionShowPromptResponse response;
|
||||||
|
@ -234,14 +235,14 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Close"),
|
child: Text("Close"),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
response = new GeolocationPermissionShowPromptResponse(origin, false, false);
|
response = new GeolocationPermissionShowPromptResponse(origin: origin, allow: false, retain: false);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Accept"),
|
child: Text("Accept"),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
response = new GeolocationPermissionShowPromptResponse(origin, true, true);
|
response = new GeolocationPermissionShowPromptResponse(origin: origin, allow: true, retain: true);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -312,7 +313,7 @@ class _InlineExampleScreenState extends State<InlineExampleScreen> {
|
||||||
return fetchRequest;
|
return fetchRequest;
|
||||||
},
|
},
|
||||||
onNavigationStateChange: (InAppWebViewController controller, String url) async {
|
onNavigationStateChange: (InAppWebViewController controller, String url) async {
|
||||||
print("NAVIGATION STATE CHANGE: ${url}");
|
print("NAVIGATION STATE CHANGE: $url");
|
||||||
setState(() {
|
setState(() {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,7 @@ import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||||
|
|
||||||
class MyInappBrowser extends InAppBrowser {
|
class MyInAppBrowser extends InAppBrowser {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future onBrowserCreated() async {
|
Future onBrowserCreated() async {
|
||||||
|
@ -43,7 +43,7 @@ class MyInappBrowser extends InAppBrowser {
|
||||||
@override
|
@override
|
||||||
void shouldOverrideUrlLoading(String url) {
|
void shouldOverrideUrlLoading(String url) {
|
||||||
print("\n\n override $url\n\n");
|
print("\n\n override $url\n\n");
|
||||||
this.webViewController.loadUrl(url);
|
this.webViewController.loadUrl(url: url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -75,11 +75,13 @@ class MyInappBrowser extends InAppBrowser {
|
||||||
@override
|
@override
|
||||||
Future<CustomSchemeResponse> onLoadResourceCustomScheme(String scheme, String url) async {
|
Future<CustomSchemeResponse> onLoadResourceCustomScheme(String scheme, String url) async {
|
||||||
print("custom scheme: " + scheme);
|
print("custom scheme: " + scheme);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<GeolocationPermissionShowPromptResponse> onGeolocationPermissionsShowPrompt(String origin) async {
|
Future<GeolocationPermissionShowPromptResponse> onGeolocationPermissionsShowPrompt(String origin) async {
|
||||||
print("request Geolocation permission API");
|
print("request Geolocation permission API");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -89,18 +91,18 @@ class MyInappBrowser extends InAppBrowser {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<JsConfirmResponse> onJsConfirm(String message) {
|
Future<JsConfirmResponse> onJsConfirm(String message) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<JsPromptResponse> onJsPrompt(String message, String defaultValue) {
|
Future<JsPromptResponse> onJsPrompt(String message, String defaultValue) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WebviewExampleScreen extends StatefulWidget {
|
class WebviewExampleScreen extends StatefulWidget {
|
||||||
final MyInappBrowser browser = new MyInappBrowser();
|
final MyInAppBrowser browser = new MyInAppBrowser();
|
||||||
static BuildContext context = null;
|
static BuildContext context;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_WebviewExampleScreenState createState() => new _WebviewExampleScreenState();
|
_WebviewExampleScreenState createState() => new _WebviewExampleScreenState();
|
||||||
|
@ -119,7 +121,7 @@ class _WebviewExampleScreenState extends State<WebviewExampleScreen> {
|
||||||
child: new RaisedButton(
|
child: new RaisedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
widget.browser.openFile(
|
widget.browser.openFile(
|
||||||
"assets/index.html",
|
assetFilePath: "assets/index.html",
|
||||||
//url: "https://www.google.com/",
|
//url: "https://www.google.com/",
|
||||||
options: InAppBrowserClassOptions(
|
options: InAppBrowserClassOptions(
|
||||||
inAppWebViewWidgetOptions: InAppWebViewWidgetOptions(
|
inAppWebViewWidgetOptions: InAppWebViewWidgetOptions(
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'types.dart';
|
import 'types.dart';
|
||||||
|
@ -12,16 +13,16 @@ import 'in_app_browser.dart';
|
||||||
///This class uses native [Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android
|
///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.
|
///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.
|
||||||
class ChromeSafariBrowser {
|
class ChromeSafariBrowser {
|
||||||
String uuid;
|
String uuid;
|
||||||
InAppBrowser browserFallback;
|
InAppBrowser browserFallback;
|
||||||
bool _isOpened = false;
|
bool _isOpened = false;
|
||||||
|
|
||||||
///Initialize the [ChromeSafariBrowser] instance with an [InAppBrowser] fallback instance or `null`.
|
///Initialize the [ChromeSafariBrowser] instance with an [InAppBrowser] fallback instance or `null`.
|
||||||
ChromeSafariBrowser (bf) {
|
ChromeSafariBrowser ({bFallback}) {
|
||||||
uuid = uuidGenerator.v4();
|
uuid = uuidGenerator.v4();
|
||||||
browserFallback = bf;
|
browserFallback = bFallback;
|
||||||
ChannelManager.addListener(uuid, handleMethod);
|
ChannelManager.addListener(uuid, handleMethod);
|
||||||
_isOpened = false;
|
_isOpened = false;
|
||||||
}
|
}
|
||||||
|
@ -45,32 +46,14 @@ class ChromeSafariBrowser {
|
||||||
|
|
||||||
///Opens an [url] in a new [ChromeSafariBrowser] instance.
|
///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.
|
///[optionsFallback]: Options used by the [InAppBrowser] instance fallback.
|
||||||
///
|
Future<void> open({@required String url, ChromeSafariBrowserClassOptions options, Map<String, String> headersFallback = const {}, InAppBrowserClassOptions optionsFallback}) async {
|
||||||
///**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.
|
|
||||||
Future<void> open(String url, {ChromeSafariBrowserClassOptions options, Map<String, String> headersFallback = const {}, InAppBrowserClassOptions optionsFallback}) async {
|
|
||||||
assert(url != null && url.isNotEmpty);
|
assert(url != null && url.isNotEmpty);
|
||||||
this.throwIsAlreadyOpened(message: 'Cannot open $url!');
|
this.throwIsAlreadyOpened(message: 'Cannot open $url!');
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
///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`.
|
||||||
class ContentBlocker {
|
class ContentBlocker {
|
||||||
|
///Trigger of the content blocker. The trigger tells to the WebView when to perform the corresponding action.
|
||||||
ContentBlockerTrigger trigger;
|
ContentBlockerTrigger trigger;
|
||||||
|
///Action associated to the trigger. The action tells to the WebView what to do when the trigger is matched.
|
||||||
ContentBlockerAction action;
|
ContentBlockerAction action;
|
||||||
|
|
||||||
ContentBlocker(this.trigger, this.action);
|
ContentBlocker({@required this.trigger,@required this.action});
|
||||||
|
|
||||||
Map<String, Map<String, dynamic>> toMap() {
|
Map<String, Map<String, dynamic>> toMap() {
|
||||||
return {
|
return {
|
||||||
|
@ -14,22 +24,22 @@ class ContentBlocker {
|
||||||
|
|
||||||
static ContentBlocker fromMap(Map<dynamic, Map<dynamic, dynamic>> map) {
|
static ContentBlocker fromMap(Map<dynamic, Map<dynamic, dynamic>> map) {
|
||||||
return ContentBlocker(
|
return ContentBlocker(
|
||||||
ContentBlockerTrigger.fromMap(
|
trigger: ContentBlockerTrigger.fromMap(
|
||||||
Map<String, dynamic>.from(map["trigger"])
|
Map<String, dynamic>.from(map["trigger"])
|
||||||
),
|
),
|
||||||
ContentBlockerAction.fromMap(
|
action: ContentBlockerAction.fromMap(
|
||||||
Map<String, dynamic>.from(map["action"])
|
Map<String, dynamic>.from(map["action"])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///ContentBlockerTriggerResourceType class represents the possible resource type defined for a [ContentBlockerTrigger].
|
||||||
class ContentBlockerTriggerResourceType {
|
class ContentBlockerTriggerResourceType {
|
||||||
final String _value;
|
final String _value;
|
||||||
const ContentBlockerTriggerResourceType._internal(this._value);
|
const ContentBlockerTriggerResourceType._internal(this._value);
|
||||||
static ContentBlockerTriggerResourceType fromValue(String value) {
|
static ContentBlockerTriggerResourceType fromValue(String value) {
|
||||||
return (["document", "image", "LINK", "style-sheet", "script", "font",
|
return (["document", "image", "style-sheet", "script", "font",
|
||||||
"media", "svg-document", "raw"].contains(value)) ? ContentBlockerTriggerResourceType._internal(value) : null;
|
"media", "svg-document", "raw"].contains(value)) ? ContentBlockerTriggerResourceType._internal(value) : null;
|
||||||
}
|
}
|
||||||
toValue() => _value;
|
toValue() => _value;
|
||||||
|
@ -41,10 +51,11 @@ class ContentBlockerTriggerResourceType {
|
||||||
static const FONT = const ContentBlockerTriggerResourceType._internal('font');
|
static const FONT = const ContentBlockerTriggerResourceType._internal('font');
|
||||||
static const MEDIA = const ContentBlockerTriggerResourceType._internal('media');
|
static const MEDIA = const ContentBlockerTriggerResourceType._internal('media');
|
||||||
static const SVG_DOCUMENT = const ContentBlockerTriggerResourceType._internal('svg-document');
|
static const SVG_DOCUMENT = const ContentBlockerTriggerResourceType._internal('svg-document');
|
||||||
|
///Any untyped load
|
||||||
static const RAW = const ContentBlockerTriggerResourceType._internal('raw');
|
static const RAW = const ContentBlockerTriggerResourceType._internal('raw');
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///ContentBlockerTriggerLoadType class represents the possible load type for a [ContentBlockerTrigger].
|
||||||
class ContentBlockerTriggerLoadType {
|
class ContentBlockerTriggerLoadType {
|
||||||
final String _value;
|
final String _value;
|
||||||
const ContentBlockerTriggerLoadType._internal(this._value);
|
const ContentBlockerTriggerLoadType._internal(this._value);
|
||||||
|
@ -53,25 +64,44 @@ class ContentBlockerTriggerLoadType {
|
||||||
}
|
}
|
||||||
toValue() => _value;
|
toValue() => _value;
|
||||||
|
|
||||||
|
///FIRST_PARTY is triggered only if the resource has the same scheme, domain, and port as the main page resource.
|
||||||
static const FIRST_PARTY = const ContentBlockerTriggerLoadType._internal('first-party');
|
static const FIRST_PARTY = const ContentBlockerTriggerLoadType._internal('first-party');
|
||||||
|
///THIRD_PARTY is triggered if the resource is not from the same domain as the main page resource.
|
||||||
static const THIRD_PARTY = const ContentBlockerTriggerLoadType._internal('third-party');
|
static const THIRD_PARTY = const ContentBlockerTriggerLoadType._internal('third-party');
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///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.
|
||||||
class ContentBlockerTrigger {
|
class ContentBlockerTrigger {
|
||||||
|
///A regular expression pattern to match the URL against.
|
||||||
String urlFilter;
|
String urlFilter;
|
||||||
|
///Used only by iOS. A Boolean value. The default value is false.
|
||||||
bool urlFilterIsCaseSensitive;
|
bool urlFilterIsCaseSensitive;
|
||||||
|
///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.
|
||||||
List<ContentBlockerTriggerResourceType> resourceType;
|
List<ContentBlockerTriggerResourceType> resourceType;
|
||||||
|
///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;
|
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;
|
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;
|
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;
|
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].
|
||||||
List<String> unlessTopUrl;
|
List<String> unlessTopUrl;
|
||||||
|
|
||||||
ContentBlockerTrigger(String urlFilter, {bool urlFilterIsCaseSensitive = false, List<ContentBlockerTriggerResourceType> resourceType = const [],
|
ContentBlockerTrigger({@required String urlFilter, bool urlFilterIsCaseSensitive = false, List<ContentBlockerTriggerResourceType> resourceType = const [],
|
||||||
List<String> ifDomain = const [], List<String> unlessDomain = const [], List<ContentBlockerTriggerLoadType> loadType = const [],
|
List<String> ifDomain = const [], List<String> unlessDomain = const [], List<ContentBlockerTriggerLoadType> loadType = const [],
|
||||||
List<String> ifTopUrl = const [], List<String> unlessTopUrl = const []}) {
|
List<String> ifTopUrl = const [], List<String> unlessTopUrl = const []}) {
|
||||||
this.urlFilter = urlFilter;
|
this.urlFilter = urlFilter;
|
||||||
|
assert(this.urlFilter != null);
|
||||||
this.resourceType = resourceType;
|
this.resourceType = resourceType;
|
||||||
this.urlFilterIsCaseSensitive = urlFilterIsCaseSensitive;
|
this.urlFilterIsCaseSensitive = urlFilterIsCaseSensitive;
|
||||||
this.ifDomain = ifDomain;
|
this.ifDomain = ifDomain;
|
||||||
|
@ -128,7 +158,7 @@ class ContentBlockerTrigger {
|
||||||
});
|
});
|
||||||
|
|
||||||
return ContentBlockerTrigger(
|
return ContentBlockerTrigger(
|
||||||
map["url-filter"],
|
urlFilter: map["url-filter"],
|
||||||
urlFilterIsCaseSensitive: map["url-filter-is-case-sensitive"],
|
urlFilterIsCaseSensitive: map["url-filter-is-case-sensitive"],
|
||||||
ifDomain: List<String>.from(map["if-domain"] ?? []),
|
ifDomain: List<String>.from(map["if-domain"] ?? []),
|
||||||
unlessDomain: List<String>.from(map["unless-domain"] ?? []),
|
unlessDomain: List<String>.from(map["unless-domain"] ?? []),
|
||||||
|
@ -140,7 +170,7 @@ class ContentBlockerTrigger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///ContentBlockerActionType class represents the kind of action that can be used with a [ContentBlockerTrigger].
|
||||||
class ContentBlockerActionType {
|
class ContentBlockerActionType {
|
||||||
final String _value;
|
final String _value;
|
||||||
const ContentBlockerActionType._internal(this._value);
|
const ContentBlockerActionType._internal(this._value);
|
||||||
|
@ -149,18 +179,31 @@ class ContentBlockerActionType {
|
||||||
}
|
}
|
||||||
toValue() => _value;
|
toValue() => _value;
|
||||||
|
|
||||||
|
///Stops loading of the resource. If the resource was cached, the cache is ignored.
|
||||||
static const BLOCK = const ContentBlockerActionType._internal('block');
|
static const BLOCK = const ContentBlockerActionType._internal('block');
|
||||||
|
///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.
|
||||||
static const CSS_DISPLAY_NONE = const ContentBlockerActionType._internal('css-display-none');
|
static const CSS_DISPLAY_NONE = const ContentBlockerActionType._internal('css-display-none');
|
||||||
|
///Changes a URL from http to https. URLs with a specified (nondefault) port and links using other protocols are unaffected.
|
||||||
static const MAKE_HTTPS = const ContentBlockerActionType._internal('make-https');
|
static const MAKE_HTTPS = const ContentBlockerActionType._internal('make-https');
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///Action associated to the trigger. The action tells to the WebView what to do when the trigger is matched.
|
||||||
|
///When a trigger matches a resource, the browser queues the associated action for execution.
|
||||||
|
///The WebView evaluates all the triggers, it executes the actions in order.
|
||||||
|
///When a domain matches a trigger, all rules after the triggered rule that specify the same action are skipped.
|
||||||
|
///Group the rules with similar actions together to improve performance.
|
||||||
class ContentBlockerAction {
|
class ContentBlockerAction {
|
||||||
|
///Type of the action.
|
||||||
ContentBlockerActionType type;
|
ContentBlockerActionType type;
|
||||||
|
///If the action type is [ContentBlockerActionType.CSS_DISPLAY_NONE], then also the [selector] property is required, otherwise it is ignored.
|
||||||
|
///It specify a string that defines a selector list. Use CSS identifiers as the individual selector values, separated by commas.
|
||||||
String selector;
|
String selector;
|
||||||
|
|
||||||
ContentBlockerAction(ContentBlockerActionType type, {String selector}) {
|
ContentBlockerAction({@required ContentBlockerActionType type, String selector}) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
assert(this.type != null);
|
||||||
if (this.type == ContentBlockerActionType.CSS_DISPLAY_NONE) {
|
if (this.type == ContentBlockerActionType.CSS_DISPLAY_NONE) {
|
||||||
assert(selector != null);
|
assert(selector != null);
|
||||||
}
|
}
|
||||||
|
@ -183,7 +226,7 @@ class ContentBlockerAction {
|
||||||
|
|
||||||
static ContentBlockerAction fromMap(Map<String, dynamic> map) {
|
static ContentBlockerAction fromMap(Map<String, dynamic> map) {
|
||||||
return ContentBlockerAction(
|
return ContentBlockerAction(
|
||||||
ContentBlockerActionType.fromValue(map["type"]),
|
type: ContentBlockerActionType.fromValue(map["type"]),
|
||||||
selector: map["selector"]
|
selector: map["selector"]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
///Manages the cookies used by WebView instances.
|
///Manages the cookies used by WebView instances.
|
||||||
|
@ -26,8 +27,8 @@ class CookieManager {
|
||||||
///
|
///
|
||||||
///The default value of [path] is `"/"`.
|
///The default value of [path] is `"/"`.
|
||||||
///If [domain] is `null`, its default value will be the domain name of [url].
|
///If [domain] is `null`, its default value will be the domain name of [url].
|
||||||
Future<void> setCookie(String url, String name, String value,
|
Future<void> setCookie({@required String url, @required String name, @required String value,
|
||||||
{ String domain,
|
String domain,
|
||||||
String path = "/",
|
String path = "/",
|
||||||
int expiresDate,
|
int expiresDate,
|
||||||
int maxAge,
|
int maxAge,
|
||||||
|
@ -55,7 +56,7 @@ class CookieManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
///Gets all the cookies for the given [url].
|
///Gets all the cookies for the given [url].
|
||||||
Future<List<Map<String, dynamic>>> getCookies(String url) async {
|
Future<List<Map<String, dynamic>>> getCookies({@required String url}) async {
|
||||||
assert(url != null && url.isNotEmpty);
|
assert(url != null && url.isNotEmpty);
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -70,7 +71,7 @@ class CookieManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
///Gets a cookie by its [name] for the given [url].
|
///Gets a cookie by its [name] for the given [url].
|
||||||
Future<Map<String, dynamic>> getCookie(String url, String name) async {
|
Future<Map<String, dynamic>> getCookie({@required String url, @required String name}) async {
|
||||||
assert(url != null && url.isNotEmpty);
|
assert(url != null && url.isNotEmpty);
|
||||||
assert(name != null && name.isNotEmpty);
|
assert(name != null && name.isNotEmpty);
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ class CookieManager {
|
||||||
///
|
///
|
||||||
///The default value of [path] is `"/"`.
|
///The default value of [path] is `"/"`.
|
||||||
///If [domain] is `null` or empty, its default value will be the domain name of [url].
|
///If [domain] is `null` or empty, its default value will be the domain name of [url].
|
||||||
Future<void> deleteCookie(String url, String name, {String domain = "", String path = "/"}) async {
|
Future<void> deleteCookie({@required String url, @required String name, String domain = "", String path = "/"}) async {
|
||||||
if (domain == null || domain.isEmpty)
|
if (domain == null || domain.isEmpty)
|
||||||
domain = _getDomainName(url);
|
domain = _getDomainName(url);
|
||||||
|
|
||||||
|
@ -111,7 +112,7 @@ class CookieManager {
|
||||||
///
|
///
|
||||||
///The default value of [path] is `"/"`.
|
///The default value of [path] is `"/"`.
|
||||||
///If [domain] is `null` or empty, its default value will be the domain name of [url].
|
///If [domain] is `null` or empty, its default value will be the domain name of [url].
|
||||||
Future<void> deleteCookies(String url, {String domain = "", String path = "/"}) async {
|
Future<void> deleteCookies({@required String url, String domain = "", String path = "/"}) async {
|
||||||
if (domain == null || domain.isEmpty)
|
if (domain == null || domain.isEmpty)
|
||||||
domain = _getDomainName(url);
|
domain = _getDomainName(url);
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import 'types.dart';
|
import 'types.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
///
|
///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`.
|
||||||
class HttpAuthCredentialDatabase {
|
class HttpAuthCredentialDatabase {
|
||||||
static HttpAuthCredentialDatabase _instance;
|
static HttpAuthCredentialDatabase _instance;
|
||||||
static const MethodChannel _channel = const MethodChannel('com.pichillilorenzo/flutter_inappbrowser_credential_database');
|
static const MethodChannel _channel = const MethodChannel('com.pichillilorenzo/flutter_inappbrowser_credential_database');
|
||||||
|
|
||||||
///
|
///Gets the database shared instance.
|
||||||
static HttpAuthCredentialDatabase instance() {
|
static HttpAuthCredentialDatabase instance() {
|
||||||
return (_instance != null) ? _instance : _init();
|
return (_instance != null) ? _instance : _init();
|
||||||
}
|
}
|
||||||
|
@ -22,7 +27,9 @@ class HttpAuthCredentialDatabase {
|
||||||
static Future<dynamic> _handleMethod(MethodCall call) async {
|
static Future<dynamic> _handleMethod(MethodCall call) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///Gets a map list of all HTTP auth credentials saved.
|
||||||
|
///Each map contains the key `protectionSpace` of type [ProtectionSpace]
|
||||||
|
///and the key `credentials` of type `List<HttpAuthCredential>` that contains all the HTTP auth credentials saved for that `protectionSpace`.
|
||||||
Future<List<Map<String, dynamic>>> getAllAuthCredentials() async {
|
Future<List<Map<String, dynamic>>> getAllAuthCredentials() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
List<dynamic> allCredentials = await _channel.invokeMethod('getAllAuthCredentials', args);
|
List<dynamic> allCredentials = await _channel.invokeMethod('getAllAuthCredentials', args);
|
||||||
|
@ -38,8 +45,8 @@ class HttpAuthCredentialDatabase {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///Gets all the HTTP auth credentials saved for that [protectionSpace].
|
||||||
Future<List<HttpAuthCredential>> getHttpAuthCredentials(ProtectionSpace protectionSpace) async {
|
Future<List<HttpAuthCredential>> getHttpAuthCredentials({@required ProtectionSpace protectionSpace}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent("host", () => protectionSpace.host);
|
args.putIfAbsent("host", () => protectionSpace.host);
|
||||||
args.putIfAbsent("protocol", () => protectionSpace.protocol);
|
args.putIfAbsent("protocol", () => protectionSpace.protocol);
|
||||||
|
@ -53,8 +60,8 @@ class HttpAuthCredentialDatabase {
|
||||||
return credentials;
|
return credentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///Saves an HTTP auth [credential] for that [protectionSpace].
|
||||||
Future<void> setHttpAuthCredential(ProtectionSpace protectionSpace, HttpAuthCredential credential) async {
|
Future<void> setHttpAuthCredential({@required ProtectionSpace protectionSpace, @required HttpAuthCredential credential}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent("host", () => protectionSpace.host);
|
args.putIfAbsent("host", () => protectionSpace.host);
|
||||||
args.putIfAbsent("protocol", () => protectionSpace.protocol);
|
args.putIfAbsent("protocol", () => protectionSpace.protocol);
|
||||||
|
@ -65,8 +72,8 @@ class HttpAuthCredentialDatabase {
|
||||||
await _channel.invokeMethod('setHttpAuthCredential', args);
|
await _channel.invokeMethod('setHttpAuthCredential', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///Removes an HTTP auth [credential] for that [protectionSpace].
|
||||||
Future<void> removeHttpAuthCredential(ProtectionSpace protectionSpace, HttpAuthCredential credential) async {
|
Future<void> removeHttpAuthCredential({@required ProtectionSpace protectionSpace, @required HttpAuthCredential credential}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent("host", () => protectionSpace.host);
|
args.putIfAbsent("host", () => protectionSpace.host);
|
||||||
args.putIfAbsent("protocol", () => protectionSpace.protocol);
|
args.putIfAbsent("protocol", () => protectionSpace.protocol);
|
||||||
|
@ -77,8 +84,8 @@ class HttpAuthCredentialDatabase {
|
||||||
await _channel.invokeMethod('removeHttpAuthCredential', args);
|
await _channel.invokeMethod('removeHttpAuthCredential', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///Removes all the HTTP auth credentials saved for that [protectionSpace].
|
||||||
Future<void> removeHttpAuthCredentials(ProtectionSpace protectionSpace) async {
|
Future<void> removeHttpAuthCredentials({@required ProtectionSpace protectionSpace}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent("host", () => protectionSpace.host);
|
args.putIfAbsent("host", () => protectionSpace.host);
|
||||||
args.putIfAbsent("protocol", () => protectionSpace.protocol);
|
args.putIfAbsent("protocol", () => protectionSpace.protocol);
|
||||||
|
@ -87,7 +94,7 @@ class HttpAuthCredentialDatabase {
|
||||||
await _channel.invokeMethod('removeHttpAuthCredentials', args);
|
await _channel.invokeMethod('removeHttpAuthCredentials', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///Removes all the HTTP auth credentials saved in the database.
|
||||||
Future<void> clearAllAuthCredentials() async {
|
Future<void> clearAllAuthCredentials() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
await _channel.invokeMethod('clearAllAuthCredentials', args);
|
await _channel.invokeMethod('clearAllAuthCredentials', args);
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||||
import 'dart:collection';
|
import 'dart:collection';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_inappbrowser/src/webview_options.dart';
|
import 'package:flutter_inappbrowser/src/webview_options.dart';
|
||||||
|
|
||||||
|
@ -45,64 +46,11 @@ class InAppBrowser {
|
||||||
|
|
||||||
///Opens an [url] in a new [InAppBrowser] instance.
|
///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`.
|
///[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.
|
///[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].
|
///[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`.
|
|
||||||
Future<void> open({String url = "about:blank", Map<String, String> headers = const {}, InAppBrowserClassOptions options}) async {
|
Future<void> open({String url = "about:blank", Map<String, String> headers = const {}, InAppBrowserClassOptions options}) async {
|
||||||
assert(url != null && url.isNotEmpty);
|
assert(url != null && url.isNotEmpty);
|
||||||
this.throwIsAlreadyOpened(message: 'Cannot open $url!');
|
this.throwIsAlreadyOpened(message: 'Cannot open $url!');
|
||||||
|
@ -132,7 +80,7 @@ class InAppBrowser {
|
||||||
await ChannelManager.channel.invokeMethod('open', args);
|
await ChannelManager.channel.invokeMethod('open', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///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!
|
///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!
|
||||||
///
|
///
|
||||||
|
@ -161,7 +109,11 @@ class InAppBrowser {
|
||||||
///inAppBrowser.openFile("assets/t-rex.html");
|
///inAppBrowser.openFile("assets/t-rex.html");
|
||||||
///...
|
///...
|
||||||
///```
|
///```
|
||||||
Future<void> openFile(String assetFilePath, {Map<String, String> headers = const {}, InAppBrowserClassOptions options}) async {
|
///
|
||||||
|
///[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].
|
||||||
|
Future<void> openFile({@required String assetFilePath, Map<String, String> headers = const {}, InAppBrowserClassOptions options}) async {
|
||||||
assert(assetFilePath != null && assetFilePath.isNotEmpty);
|
assert(assetFilePath != null && assetFilePath.isNotEmpty);
|
||||||
this.throwIsAlreadyOpened(message: 'Cannot open $assetFilePath!');
|
this.throwIsAlreadyOpened(message: 'Cannot open $assetFilePath!');
|
||||||
|
|
||||||
|
@ -191,9 +143,13 @@ class InAppBrowser {
|
||||||
}
|
}
|
||||||
|
|
||||||
///Opens a new [InAppBrowser] instance with [data] as a content, using [baseUrl] as the base URL for it.
|
///Opens a new [InAppBrowser] instance with [data] as a content, using [baseUrl] as the base URL for it.
|
||||||
|
///
|
||||||
///The [mimeType] parameter specifies the format of the data.
|
///The [mimeType] parameter specifies the format of the data.
|
||||||
|
///
|
||||||
///The [encoding] parameter specifies the encoding of the data.
|
///The [encoding] parameter specifies the encoding of the data.
|
||||||
Future<void> openData(String data, {String mimeType = "text/html", String encoding = "utf8", String baseUrl = "about:blank", InAppBrowserClassOptions options}) async {
|
///
|
||||||
|
///The [options] parameter specifies the options for the [InAppBrowser].
|
||||||
|
Future<void> openData({@required String data, String mimeType = "text/html", String encoding = "utf8", String baseUrl = "about:blank", InAppBrowserClassOptions options}) async {
|
||||||
assert(data != null);
|
assert(data != null);
|
||||||
|
|
||||||
Map<String, dynamic> optionsMap = {};
|
Map<String, dynamic> optionsMap = {};
|
||||||
|
@ -224,7 +180,7 @@ class InAppBrowser {
|
||||||
}
|
}
|
||||||
|
|
||||||
///This is a static method that opens an [url] in the system browser. You wont be able to use the [InAppBrowser] methods here!
|
///This is a static method that opens an [url] in the system browser. You wont be able to use the [InAppBrowser] methods here!
|
||||||
static Future<void> openWithSystemBrowser(String url) async {
|
static Future<void> openWithSystemBrowser({@required String url}) async {
|
||||||
assert(url != null && url.isNotEmpty);
|
assert(url != null && url.isNotEmpty);
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent('uuid', () => "");
|
args.putIfAbsent('uuid', () => "");
|
||||||
|
@ -271,7 +227,7 @@ class InAppBrowser {
|
||||||
}
|
}
|
||||||
|
|
||||||
///Sets the [InAppBrowser] options with the new [options] and evaluates them.
|
///Sets the [InAppBrowser] options with the new [options] and evaluates them.
|
||||||
Future<void> setOptions(InAppBrowserClassOptions options) async {
|
Future<void> setOptions({@required InAppBrowserClassOptions options}) async {
|
||||||
this.throwIsNotOpened();
|
this.throwIsNotOpened();
|
||||||
|
|
||||||
Map<String, dynamic> optionsMap = {};
|
Map<String, dynamic> optionsMap = {};
|
||||||
|
@ -397,6 +353,7 @@ class InAppBrowser {
|
||||||
///[scheme] represents the scheme of the url.
|
///[scheme] represents the scheme of the url.
|
||||||
///
|
///
|
||||||
///[url] represents the url of the request.
|
///[url] represents the url of the request.
|
||||||
|
// ignore: missing_return
|
||||||
Future<CustomSchemeResponse> onLoadResourceCustomScheme(String scheme, String url) {
|
Future<CustomSchemeResponse> onLoadResourceCustomScheme(String scheme, String url) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -417,6 +374,7 @@ 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 for Android.
|
||||||
|
// ignore: missing_return
|
||||||
Future<GeolocationPermissionShowPromptResponse> onGeolocationPermissionsShowPrompt (String origin) {
|
Future<GeolocationPermissionShowPromptResponse> onGeolocationPermissionsShowPrompt (String origin) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -425,6 +383,7 @@ class InAppBrowser {
|
||||||
///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.
|
||||||
|
// ignore: missing_return
|
||||||
Future<JsAlertResponse> onJsAlert(String message) {
|
Future<JsAlertResponse> onJsAlert(String message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -433,6 +392,7 @@ class InAppBrowser {
|
||||||
///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.
|
||||||
|
// ignore: missing_return
|
||||||
Future<JsConfirmResponse> onJsConfirm(String message) {
|
Future<JsConfirmResponse> onJsConfirm(String message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -442,6 +402,7 @@ class InAppBrowser {
|
||||||
///
|
///
|
||||||
///[message] represents the message to be displayed in the alert dialog.
|
///[message] represents the message to be displayed in the alert dialog.
|
||||||
///[defaultValue] represents the default value displayed in the prompt dialog.
|
///[defaultValue] represents the default value displayed in the prompt dialog.
|
||||||
|
// ignore: missing_return
|
||||||
Future<JsPromptResponse> onJsPrompt(String message, String defaultValue) {
|
Future<JsPromptResponse> onJsPrompt(String message, String defaultValue) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -454,6 +415,7 @@ class InAppBrowser {
|
||||||
///[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 for Android.
|
||||||
|
// ignore: missing_return
|
||||||
Future<SafeBrowsingResponse> onSafeBrowsingHit(String url, SafeBrowsingThreat threatType) {
|
Future<SafeBrowsingResponse> onSafeBrowsingHit(String url, SafeBrowsingThreat threatType) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -461,6 +423,7 @@ class InAppBrowser {
|
||||||
///Event fires when the WebView received an HTTP authentication request. The default behavior is to cancel the request.
|
///Event fires 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
|
||||||
Future<HttpAuthResponse> onReceivedHttpAuthRequest(HttpAuthChallenge challenge) {
|
Future<HttpAuthResponse> onReceivedHttpAuthRequest(HttpAuthChallenge challenge) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -469,6 +432,7 @@ class InAppBrowser {
|
||||||
///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].
|
||||||
|
// ignore: missing_return
|
||||||
Future<ServerTrustAuthResponse> onReceivedServerTrustAuthRequest(ServerTrustChallenge challenge) {
|
Future<ServerTrustAuthResponse> onReceivedServerTrustAuthRequest(ServerTrustChallenge challenge) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -479,6 +443,7 @@ class InAppBrowser {
|
||||||
///Note that, multiple layers in chromium network stack might be caching the responses.
|
///Note that, multiple layers in chromium network stack might be caching the responses.
|
||||||
///
|
///
|
||||||
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ClientCertChallenge].
|
///[challenge] contains data about host, port, protocol, realm, etc. as specified in the [ClientCertChallenge].
|
||||||
|
// ignore: missing_return
|
||||||
Future<ClientCertResponse> onReceivedClientCertRequest(ClientCertChallenge challenge) {
|
Future<ClientCertResponse> onReceivedClientCertRequest(ClientCertChallenge challenge) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -501,6 +466,7 @@ class InAppBrowser {
|
||||||
///[ajaxRequest] represents the `XMLHttpRequest`.
|
///[ajaxRequest] represents the `XMLHttpRequest`.
|
||||||
///
|
///
|
||||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
||||||
|
// ignore: missing_return
|
||||||
Future<AjaxRequest> shouldInterceptAjaxRequest(AjaxRequest ajaxRequest) {
|
Future<AjaxRequest> shouldInterceptAjaxRequest(AjaxRequest ajaxRequest) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -511,6 +477,7 @@ class InAppBrowser {
|
||||||
///[ajaxRequest] represents the [XMLHttpRequest].
|
///[ajaxRequest] represents the [XMLHttpRequest].
|
||||||
///
|
///
|
||||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
||||||
|
// ignore: missing_return
|
||||||
Future<AjaxRequestAction> onAjaxReadyStateChange(AjaxRequest ajaxRequest) {
|
Future<AjaxRequestAction> onAjaxReadyStateChange(AjaxRequest ajaxRequest) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -521,6 +488,7 @@ class InAppBrowser {
|
||||||
///[ajaxRequest] represents the [XMLHttpRequest].
|
///[ajaxRequest] represents the [XMLHttpRequest].
|
||||||
///
|
///
|
||||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptAjaxRequest] option to `true`.
|
||||||
|
// ignore: missing_return
|
||||||
Future<AjaxRequestAction> onAjaxProgress(AjaxRequest ajaxRequest) {
|
Future<AjaxRequestAction> onAjaxProgress(AjaxRequest ajaxRequest) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -531,6 +499,7 @@ class InAppBrowser {
|
||||||
///[fetchRequest] represents a resource request.
|
///[fetchRequest] represents a resource request.
|
||||||
///
|
///
|
||||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptFetchRequest] option to `true`.
|
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptFetchRequest] option to `true`.
|
||||||
|
// ignore: missing_return
|
||||||
Future<FetchRequest> shouldInterceptFetchRequest(FetchRequest fetchRequest) {
|
Future<FetchRequest> shouldInterceptFetchRequest(FetchRequest fetchRequest) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,44 +21,6 @@ const javaScriptHandlerForbiddenNames = ["onLoadResource", "shouldInterceptAjaxR
|
||||||
///InAppWebView Widget class.
|
///InAppWebView Widget class.
|
||||||
///
|
///
|
||||||
///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.
|
||||||
///
|
|
||||||
///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 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`.
|
|
||||||
/// - __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`.
|
|
||||||
class InAppWebView extends StatefulWidget {
|
class InAppWebView extends StatefulWidget {
|
||||||
|
|
||||||
///Event fires when the [InAppWebView] is created.
|
///Event fires when the [InAppWebView] is created.
|
||||||
|
@ -379,6 +341,7 @@ class InAppWebViewController {
|
||||||
InAppWebView _widget;
|
InAppWebView _widget;
|
||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
Map<String, JavaScriptHandlerCallback> javaScriptHandlersMap = HashMap<String, JavaScriptHandlerCallback>();
|
Map<String, JavaScriptHandlerCallback> javaScriptHandlersMap = HashMap<String, JavaScriptHandlerCallback>();
|
||||||
|
// ignore: unused_field
|
||||||
bool _isOpened = false;
|
bool _isOpened = false;
|
||||||
// ignore: unused_field
|
// ignore: unused_field
|
||||||
int _id;
|
int _id;
|
||||||
|
@ -443,10 +406,11 @@ class InAppWebViewController {
|
||||||
int lineNumber = call.arguments["lineNumber"];
|
int lineNumber = call.arguments["lineNumber"];
|
||||||
String message = call.arguments["message"];
|
String message = call.arguments["message"];
|
||||||
ConsoleMessageLevel messageLevel = ConsoleMessageLevel.fromValue(call.arguments["messageLevel"]);
|
ConsoleMessageLevel messageLevel = ConsoleMessageLevel.fromValue(call.arguments["messageLevel"]);
|
||||||
|
ConsoleMessage consoleMessage = ConsoleMessage(sourceURL: sourceURL, lineNumber: lineNumber, message: message, messageLevel: messageLevel);
|
||||||
if (_widget != null && _widget.onConsoleMessage != null)
|
if (_widget != null && _widget.onConsoleMessage != null)
|
||||||
_widget.onConsoleMessage(this, ConsoleMessage(sourceURL, lineNumber, message, messageLevel));
|
_widget.onConsoleMessage(this, consoleMessage);
|
||||||
else if (_inAppBrowser != null)
|
else if (_inAppBrowser != null)
|
||||||
_inAppBrowser.onConsoleMessage(ConsoleMessage(sourceURL, lineNumber, message, messageLevel));
|
_inAppBrowser.onConsoleMessage(consoleMessage);
|
||||||
break;
|
break;
|
||||||
case "onScrollChanged":
|
case "onScrollChanged":
|
||||||
int x = call.arguments["x"];
|
int x = call.arguments["x"];
|
||||||
|
@ -597,7 +561,7 @@ class InAppWebViewController {
|
||||||
double startTime = argMap["startTime"] is int ? argMap["startTime"].toDouble() : argMap["startTime"];
|
double startTime = argMap["startTime"] is int ? argMap["startTime"].toDouble() : argMap["startTime"];
|
||||||
double duration = argMap["duration"] is int ? argMap["duration"].toDouble() : argMap["duration"];
|
double duration = argMap["duration"] is int ? argMap["duration"].toDouble() : argMap["duration"];
|
||||||
|
|
||||||
var response = new LoadedResource(initiatorType, url, startTime, duration);
|
var response = new LoadedResource(initiatorType: initiatorType, url: url, startTime: startTime, duration: duration);
|
||||||
|
|
||||||
if (_widget != null && _widget.onLoadResource != null)
|
if (_widget != null && _widget.onLoadResource != null)
|
||||||
_widget.onLoadResource(this, response);
|
_widget.onLoadResource(this, response);
|
||||||
|
@ -758,7 +722,7 @@ class InAppWebViewController {
|
||||||
var html = "";
|
var html = "";
|
||||||
InAppWebViewWidgetOptions options = await getOptions();
|
InAppWebViewWidgetOptions options = await getOptions();
|
||||||
if (options != null && options.inAppWebViewOptions.javaScriptEnabled == true) {
|
if (options != null && options.inAppWebViewOptions.javaScriptEnabled == true) {
|
||||||
html = await evaluateJavascript("window.document.getElementsByTagName('html')[0].outerHTML;");
|
html = await evaluateJavascript(source: "window.document.getElementsByTagName('html')[0].outerHTML;");
|
||||||
if (html.isNotEmpty)
|
if (html.isNotEmpty)
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
@ -893,7 +857,7 @@ 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.
|
||||||
Future<void> loadUrl(String url, {Map<String, String> headers = const {}}) async {
|
Future<void> loadUrl({@required String url, Map<String, String> headers = const {}}) async {
|
||||||
assert(url != null && url.isNotEmpty);
|
assert(url != null && url.isNotEmpty);
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
|
@ -906,7 +870,7 @@ 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.
|
||||||
Future<void> postUrl(String url, Uint8List postData) async {
|
Future<void> postUrl({@required String url, @required Uint8List postData}) async {
|
||||||
assert(url != null && url.isNotEmpty);
|
assert(url != null && url.isNotEmpty);
|
||||||
assert(postData != null);
|
assert(postData != null);
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -922,7 +886,7 @@ class InAppWebViewController {
|
||||||
///Loads the given [data] into this WebView, using [baseUrl] as the base URL for the content.
|
///Loads the given [data] into this WebView, using [baseUrl] as the base URL for the content.
|
||||||
///The [mimeType] parameter specifies the format of the data.
|
///The [mimeType] parameter specifies the format of the data.
|
||||||
///The [encoding] parameter specifies the encoding of the data.
|
///The [encoding] parameter specifies the encoding of the data.
|
||||||
Future<void> loadData(String data, {String mimeType = "text/html", String encoding = "utf8", String baseUrl = "about:blank"}) async {
|
Future<void> loadData({@required String data, String mimeType = "text/html", String encoding = "utf8", String baseUrl = "about:blank"}) async {
|
||||||
assert(data != null);
|
assert(data != null);
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
|
@ -965,7 +929,7 @@ class InAppWebViewController {
|
||||||
///inAppBrowser.loadFile("assets/t-rex.html");
|
///inAppBrowser.loadFile("assets/t-rex.html");
|
||||||
///...
|
///...
|
||||||
///```
|
///```
|
||||||
Future<void> loadFile(String assetFilePath, {Map<String, String> headers = const {}}) async {
|
Future<void> loadFile({@required String assetFilePath, Map<String, String> headers = const {}}) async {
|
||||||
assert(assetFilePath != null && assetFilePath.isNotEmpty);
|
assert(assetFilePath != null && assetFilePath.isNotEmpty);
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
|
@ -1028,7 +992,7 @@ class InAppWebViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
///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.
|
||||||
Future<void> goBackOrForward(int steps) async {
|
Future<void> goBackOrForward({@required int steps}) async {
|
||||||
assert(steps != null);
|
assert(steps != null);
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -1040,8 +1004,8 @@ class InAppWebViewController {
|
||||||
await _channel.invokeMethod('goBackOrForward', args);
|
await _channel.invokeMethod('goBackOrForward', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///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.
|
///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.
|
||||||
Future<bool> canGoBackOrForward(int steps) async {
|
Future<bool> canGoBackOrForward({@required int steps}) async {
|
||||||
assert(steps != null);
|
assert(steps != null);
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -1054,11 +1018,11 @@ class InAppWebViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
///Navigates to a [WebHistoryItem] from the back-forward [WebHistory.list] and sets it as the current item.
|
///Navigates to a [WebHistoryItem] from the back-forward [WebHistory.list] and sets it as the current item.
|
||||||
Future<void> goTo(WebHistoryItem historyItem) async {
|
Future<void> goTo({@required WebHistoryItem historyItem}) async {
|
||||||
await goBackOrForward(historyItem.offset);
|
await goBackOrForward(steps: historyItem.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Check if the Web View of the [InAppWebView] instance is in a loading state.
|
///Check if the WebView instance is in a loading state.
|
||||||
Future<bool> isLoading() async {
|
Future<bool> isLoading() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
|
@ -1068,7 +1032,7 @@ class InAppWebViewController {
|
||||||
return await _channel.invokeMethod('isLoading', args);
|
return await _channel.invokeMethod('isLoading', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Stops the Web View of the [InAppWebView] instance from loading.
|
///Stops the WebView from loading.
|
||||||
Future<void> stopLoading() async {
|
Future<void> stopLoading() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
|
@ -1078,8 +1042,8 @@ class InAppWebViewController {
|
||||||
await _channel.invokeMethod('stopLoading', args);
|
await _channel.invokeMethod('stopLoading', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Evaluates JavaScript code into the [InAppWebView] and returns the result of the evaluation.
|
///Evaluates JavaScript code into the WebView and returns the result of the evaluation.
|
||||||
Future<String> evaluateJavascript(String source) async {
|
Future<String> evaluateJavascript({@required String source}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
_inAppBrowser.throwIsNotOpened();
|
_inAppBrowser.throwIsNotOpened();
|
||||||
|
@ -1089,8 +1053,8 @@ class InAppWebViewController {
|
||||||
return await _channel.invokeMethod('evaluateJavascript', args);
|
return await _channel.invokeMethod('evaluateJavascript', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Injects an external JavaScript file into the [InAppWebView] from a defined url.
|
///Injects an external JavaScript file into the WebView from a defined url.
|
||||||
Future<void> injectJavascriptFileFromUrl(String urlFile) async {
|
Future<void> injectJavascriptFileFromUrl({@required String urlFile}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
_inAppBrowser.throwIsNotOpened();
|
_inAppBrowser.throwIsNotOpened();
|
||||||
|
@ -1100,14 +1064,14 @@ class InAppWebViewController {
|
||||||
await _channel.invokeMethod('injectJavascriptFileFromUrl', args);
|
await _channel.invokeMethod('injectJavascriptFileFromUrl', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Injects a JavaScript file into the [InAppWebView] from the flutter assets directory.
|
///Injects a JavaScript file into the WebView from the flutter assets directory.
|
||||||
Future<void> injectJavascriptFileFromAsset(String assetFilePath) async {
|
Future<void> injectJavascriptFileFromAsset({@required String assetFilePath}) async {
|
||||||
String source = await rootBundle.loadString(assetFilePath);
|
String source = await rootBundle.loadString(assetFilePath);
|
||||||
await evaluateJavascript(source);
|
await evaluateJavascript(source: source);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Injects CSS into the [InAppWebView].
|
///Injects CSS into the WebView.
|
||||||
Future<void> injectCSSCode(String source) async {
|
Future<void> injectCSSCode({@required String source}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
_inAppBrowser.throwIsNotOpened();
|
_inAppBrowser.throwIsNotOpened();
|
||||||
|
@ -1117,8 +1081,8 @@ class InAppWebViewController {
|
||||||
await _channel.invokeMethod('injectCSSCode', args);
|
await _channel.invokeMethod('injectCSSCode', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Injects an external CSS file into the [InAppWebView] from a defined url.
|
///Injects an external CSS file into the WebView from a defined url.
|
||||||
Future<void> injectCSSFileFromUrl(String urlFile) async {
|
Future<void> injectCSSFileFromUrl({@required String urlFile}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
_inAppBrowser.throwIsNotOpened();
|
_inAppBrowser.throwIsNotOpened();
|
||||||
|
@ -1128,10 +1092,10 @@ class InAppWebViewController {
|
||||||
await _channel.invokeMethod('injectStyleFile', args);
|
await _channel.invokeMethod('injectStyleFile', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Injects a CSS file into the [InAppWebView] from the flutter assets directory.
|
///Injects a CSS file into the WebView from the flutter assets directory.
|
||||||
Future<void> injectCSSFileFromAsset(String assetFilePath) async {
|
Future<void> injectCSSFileFromAsset({@required String assetFilePath}) async {
|
||||||
String source = await rootBundle.loadString(assetFilePath);
|
String source = await rootBundle.loadString(assetFilePath);
|
||||||
await injectCSSCode(source);
|
await injectCSSCode(source: source);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Adds a JavaScript message handler [callback] ([JavaScriptHandlerCallback]) that listen to post messages sent from JavaScript by the handler with name [handlerName].
|
///Adds a JavaScript message handler [callback] ([JavaScriptHandlerCallback]) that listen to post messages sent from JavaScript by the handler with name [handlerName].
|
||||||
|
@ -1180,7 +1144,7 @@ class InAppWebViewController {
|
||||||
/// });
|
/// });
|
||||||
/// """);
|
/// """);
|
||||||
///```
|
///```
|
||||||
void addJavaScriptHandler(String handlerName, JavaScriptHandlerCallback callback) {
|
void addJavaScriptHandler({@required String handlerName, @required JavaScriptHandlerCallback callback}) {
|
||||||
assert(!javaScriptHandlerForbiddenNames.contains(handlerName));
|
assert(!javaScriptHandlerForbiddenNames.contains(handlerName));
|
||||||
this.javaScriptHandlersMap[handlerName] = (callback);
|
this.javaScriptHandlersMap[handlerName] = (callback);
|
||||||
}
|
}
|
||||||
|
@ -1188,7 +1152,7 @@ class InAppWebViewController {
|
||||||
///Removes a JavaScript message handler previously added with the [addJavaScriptHandler()] associated to [handlerName] key.
|
///Removes a JavaScript message handler previously added with the [addJavaScriptHandler()] associated to [handlerName] key.
|
||||||
///Returns the value associated with [handlerName] before it was removed.
|
///Returns the value associated with [handlerName] before it was removed.
|
||||||
///Returns `null` if [handlerName] was not found.
|
///Returns `null` if [handlerName] was not found.
|
||||||
JavaScriptHandlerCallback removeJavaScriptHandler(String handlerName) {
|
JavaScriptHandlerCallback removeJavaScriptHandler({@required String handlerName}) {
|
||||||
return this.javaScriptHandlersMap.remove(handlerName);
|
return this.javaScriptHandlersMap.remove(handlerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1204,8 +1168,8 @@ class InAppWebViewController {
|
||||||
return await _channel.invokeMethod('takeScreenshot', args);
|
return await _channel.invokeMethod('takeScreenshot', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Sets the [InAppWebView] options with the new [options] and evaluates them.
|
///Sets the WebView options with the new [options] and evaluates them.
|
||||||
Future<void> setOptions(InAppWebViewWidgetOptions options) async {
|
Future<void> setOptions({@required InAppWebViewWidgetOptions options}) async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
_inAppBrowser.throwIsNotOpened();
|
_inAppBrowser.throwIsNotOpened();
|
||||||
|
@ -1223,7 +1187,7 @@ class InAppWebViewController {
|
||||||
await _channel.invokeMethod('setOptions', args);
|
await _channel.invokeMethod('setOptions', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Gets the current [InAppWebView] options. Returns the options with `null` value if they are not set yet.
|
///Gets the current WebView options. Returns the options with `null` value if they are not set yet.
|
||||||
Future<InAppWebViewWidgetOptions> getOptions() async {
|
Future<InAppWebViewWidgetOptions> getOptions() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
|
@ -1266,9 +1230,9 @@ class InAppWebViewController {
|
||||||
List<WebHistoryItem> historyList = List();
|
List<WebHistoryItem> historyList = List();
|
||||||
for(var i = 0; i < historyListMap.length; i++) {
|
for(var i = 0; i < historyListMap.length; i++) {
|
||||||
LinkedHashMap<dynamic, dynamic> historyItem = historyListMap[i];
|
LinkedHashMap<dynamic, dynamic> historyItem = historyListMap[i];
|
||||||
historyList.add(WebHistoryItem(historyItem["originalUrl"], historyItem["title"], historyItem["url"], i, i - currentIndex));
|
historyList.add(WebHistoryItem(originalUrl: historyItem["originalUrl"], title: historyItem["title"], url: historyItem["url"], index: i, offset: i - currentIndex));
|
||||||
}
|
}
|
||||||
return WebHistory(historyList, currentIndex);
|
return WebHistory(list: historyList, currentIndex: currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Starts Safe Browsing initialization.
|
///Starts Safe Browsing initialization.
|
||||||
|
@ -1304,7 +1268,7 @@ class InAppWebViewController {
|
||||||
///[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 for Android.
|
///**NOTE**: available only for Android.
|
||||||
Future<bool> setSafeBrowsingWhitelist(List<String> hosts) async {
|
Future<bool> setSafeBrowsingWhitelist({@required List<String> hosts}) async {
|
||||||
assert(hosts != null);
|
assert(hosts != null);
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
|
@ -1372,7 +1336,7 @@ 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.
|
||||||
Future<void> findAllAsync(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>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
|
@ -1388,7 +1352,7 @@ 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.
|
||||||
Future<void> findNext(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>{};
|
||||||
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
if (_inAppBrowserUuid != null && _inAppBrowser != null) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
import 'webview_options.dart';
|
import 'webview_options.dart';
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class LoadedResource {
|
||||||
///Returns the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) duration to fetch a resource.
|
///Returns the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) duration to fetch a resource.
|
||||||
double duration;
|
double duration;
|
||||||
|
|
||||||
LoadedResource(this.initiatorType, this.url, this.startTime, this.duration);
|
LoadedResource({this.initiatorType, this.url, this.startTime, this.duration});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class InAppWebViewInitialData {
|
||||||
String encoding;
|
String encoding;
|
||||||
String baseUrl;
|
String baseUrl;
|
||||||
|
|
||||||
InAppWebViewInitialData(this.data, {this.mimeType = "text/html", this.encoding = "utf8", this.baseUrl = "about:blank"});
|
InAppWebViewInitialData({@required this.data, this.mimeType = "text/html", this.encoding = "utf8", this.baseUrl = "about:blank"});
|
||||||
|
|
||||||
Map<String, String> toMap() {
|
Map<String, String> toMap() {
|
||||||
return {
|
return {
|
||||||
|
@ -120,7 +120,7 @@ class CustomSchemeResponse {
|
||||||
///Content-Enconding of the data, such as `utf-8`.
|
///Content-Enconding of the data, such as `utf-8`.
|
||||||
String contentEnconding;
|
String contentEnconding;
|
||||||
|
|
||||||
CustomSchemeResponse(this.data, this.contentType, {this.contentEnconding = 'utf-8'});
|
CustomSchemeResponse({@required this.data, @required this.contentType, this.contentEnconding = 'utf-8'});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
|
@ -137,25 +137,24 @@ class CustomSchemeResponse {
|
||||||
///To receive notifications of these messages, use the [onConsoleMessage] event.
|
///To receive notifications of these messages, use the [onConsoleMessage] event.
|
||||||
class ConsoleMessage {
|
class ConsoleMessage {
|
||||||
|
|
||||||
String sourceURL = "";
|
String sourceURL;
|
||||||
int lineNumber = 1;
|
int lineNumber;
|
||||||
String message = "";
|
String message;
|
||||||
ConsoleMessageLevel messageLevel = ConsoleMessageLevel.LOG;
|
ConsoleMessageLevel messageLevel;
|
||||||
|
|
||||||
ConsoleMessage(this.sourceURL, this.lineNumber, this.message, this.messageLevel);
|
ConsoleMessage({this.sourceURL = "", this.lineNumber = 1, this.message = "", this.messageLevel = ConsoleMessageLevel.LOG});
|
||||||
}
|
}
|
||||||
|
|
||||||
///WebHistory class.
|
///WebHistory class.
|
||||||
///
|
///
|
||||||
///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<WebHistoryItem> _list;
|
|
||||||
///List of all [WebHistoryItem]s.
|
///List of all [WebHistoryItem]s.
|
||||||
List<WebHistoryItem> get list => _list;
|
List<WebHistoryItem> list;
|
||||||
///Index of the current [WebHistoryItem].
|
///Index of the current [WebHistoryItem].
|
||||||
int currentIndex;
|
int currentIndex;
|
||||||
|
|
||||||
WebHistory(this._list, this.currentIndex);
|
WebHistory({this.list, this.currentIndex});
|
||||||
}
|
}
|
||||||
|
|
||||||
///WebHistoryItem class.
|
///WebHistoryItem class.
|
||||||
|
@ -173,7 +172,7 @@ class WebHistoryItem {
|
||||||
///Position offset respect to the currentIndex of the back-forward [WebHistory.list].
|
///Position offset respect to the currentIndex of the back-forward [WebHistory.list].
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
WebHistoryItem(this.originalUrl, this.title, this.url, this.index, this.offset);
|
WebHistoryItem({this.originalUrl, this.title, this.url, this.index, this.offset});
|
||||||
}
|
}
|
||||||
|
|
||||||
///GeolocationPermissionPromptResponse class.
|
///GeolocationPermissionPromptResponse class.
|
||||||
|
@ -187,7 +186,7 @@ class GeolocationPermissionShowPromptResponse {
|
||||||
///Whether the permission should be retained beyond the lifetime of a page currently being displayed by a WebView
|
///Whether the permission should be retained beyond the lifetime of a page currently being displayed by a WebView
|
||||||
bool retain;
|
bool retain;
|
||||||
|
|
||||||
GeolocationPermissionShowPromptResponse(this.origin, this.allow, this.retain);
|
GeolocationPermissionShowPromptResponse({this.origin, this.allow, this.retain});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue