added disableVerticalScroll and disableHorizontalScroll webview options, updated example
This commit is contained in:
parent
fed2da63ba
commit
651cb656bf
|
@ -15,15 +15,20 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/example/lib/chrome_safari_browser_example.screen.dart" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/example/lib/in_app_browser_example.screen.dart" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/example/ios/Runner/Info.plist" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/Runner/Info.plist" 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$/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" />
|
||||
<change beforePath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/example/lib/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/example/lib/webview_example.screen.dart" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" 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" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppWebViewOptions.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebViewOptions.swift" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lib/src/webview_options.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/webview_options.dart" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/.dart_tool/" />
|
||||
<ignored path="$PROJECT_DIR$/.idea/" />
|
||||
|
@ -46,7 +51,7 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/app_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="490">
|
||||
<state relative-caret-position="2445">
|
||||
<caret line="166" column="55" selection-start-line="166" selection-start-column="55" selection-end-line="166" selection-end-column="55" />
|
||||
<folding>
|
||||
<element signature="e#35#55#0" expanded="true" />
|
||||
|
@ -58,17 +63,17 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/main_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-62">
|
||||
<caret line="31" column="73" selection-start-line="31" selection-start-column="73" selection-end-line="31" selection-end-column="73" />
|
||||
<state relative-caret-position="405">
|
||||
<caret line="42" column="5" selection-start-line="38" selection-start-column="9" selection-end-line="42" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="180">
|
||||
<caret line="12" column="25" selection-start-line="12" selection-start-column="6" selection-end-line="12" selection-end-column="25" />
|
||||
<state relative-caret-position="253">
|
||||
<caret line="130" column="52" selection-start-line="130" selection-start-column="52" selection-end-line="130" selection-end-column="52" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -76,11 +81,23 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<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="290">
|
||||
<caret line="106" column="30" selection-start-line="106" selection-start-column="7" selection-end-line="106" selection-end-column="30" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="251">
|
||||
<caret line="51" column="33" selection-start-line="51" selection-start-column="33" selection-end-line="51" selection-end-column="33" />
|
||||
<state relative-caret-position="60">
|
||||
<caret line="4" column="64" selection-start-line="4" selection-start-column="64" selection-end-line="4" selection-end-column="64" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -88,8 +105,8 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-303">
|
||||
<caret line="278" column="24" selection-start-line="278" selection-start-column="13" selection-end-line="278" selection-end-column="24" />
|
||||
<state relative-caret-position="520">
|
||||
<caret line="75" column="5" selection-start-line="75" selection-start-column="5" selection-end-line="75" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -100,7 +117,7 @@
|
|||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1146">
|
||||
<state relative-caret-position="17220">
|
||||
<caret line="1155" column="24" selection-start-line="1155" selection-start-column="6" selection-end-line="1155" selection-end-column="24" />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -127,8 +144,6 @@
|
|||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>FetchRequest</find>
|
||||
<find>my-special-custom-scheme</find>
|
||||
<find>should</find>
|
||||
<find>resourceCustomSchemes</find>
|
||||
<find>WebHistory</find>
|
||||
|
@ -157,6 +172,8 @@
|
|||
<find>shouldIn</find>
|
||||
<find>onZaboHandlerCallback</find>
|
||||
<find>AndroidView</find>
|
||||
<find>scalesPageToFit</find>
|
||||
<find>scroll</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>activity.getPreferences(0)</replace>
|
||||
|
@ -182,9 +199,6 @@
|
|||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/flutter_inappbrowser_tests/android/app/src/main/AndroidManifest.xml" />
|
||||
<option value="$PROJECT_DIR$/flutter_inappbrowser_tests/assets/in_app_webview_initial_file_test.html" />
|
||||
<option value="$PROJECT_DIR$/flutter_inappbrowser_tests/assets/in_app_webview_on_load_resource_test.html" />
|
||||
<option value="$PROJECT_DIR$/flutter_inappbrowser_tests/assets/in_app_webview_javascript_handler_test.html" />
|
||||
<option value="$PROJECT_DIR$/flutter_inappbrowser_tests/assets/index.html" />
|
||||
<option value="$PROJECT_DIR$/lib/src/content_blocker.dart" />
|
||||
|
@ -218,8 +232,6 @@
|
|||
<option value="$PROJECT_DIR$/example/test_assets/in_app_webview_fetch_test.html" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_fetch_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_should_override_url_loading_test.dart" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/example/lib/webview_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_assets/in_app_webview_on_console_message_test.html" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_console_message_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_download_start_test.dart" />
|
||||
|
@ -231,12 +243,17 @@
|
|||
<option value="$PROJECT_DIR$/example/assets/index.html" />
|
||||
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/types.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/webview_options.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/webview_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/main.dart" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<component name="ProjectFrameBounds">
|
||||
<option name="y" value="23" />
|
||||
<option name="width" value="1920" />
|
||||
<option name="height" value="1057" />
|
||||
|
@ -248,6 +265,17 @@
|
|||
</navigator>
|
||||
<panes>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scope">
|
||||
<subPane subId="Project Files">
|
||||
<expand>
|
||||
<path>
|
||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||
<item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
|
@ -303,17 +331,6 @@
|
|||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope">
|
||||
<subPane subId="Project Files">
|
||||
<expand>
|
||||
<path>
|
||||
<item name="Root" type="cbb8eebc:String" user="Root" />
|
||||
<item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="AndroidView">
|
||||
<subPane>
|
||||
<expand>
|
||||
|
@ -501,7 +518,7 @@
|
|||
<window_info id="Resources Explorer" order="8" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32642487" />
|
||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49574015" weight="0.4746114" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49574015" visible="true" weight="0.4746114" />
|
||||
<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="Inspection" order="5" weight="0.4" />
|
||||
|
@ -513,7 +530,7 @@
|
|||
<window_info anchor="bottom" id="Messages" order="11" weight="0.3896373" />
|
||||
<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 active="true" anchor="bottom" id="Dart Analysis" order="14" sideWeight="0.4968051" visible="true" weight="0.3253886" />
|
||||
<window_info anchor="bottom" id="Dart Analysis" order="14" sideWeight="0.4968051" 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="Build" order="16" />
|
||||
<window_info anchor="bottom" id="Thumbnails" order="17" weight="0.32953367" />
|
||||
|
@ -540,8 +557,6 @@
|
|||
</ignored-roots>
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/test_driver/custom_widget_test.dart" />
|
||||
<entry file="file://$PROJECT_DIR$/test_driver/main_test.dart" />
|
||||
<entry file="file://$PROJECT_DIR$/test_driver/app.dart" />
|
||||
<entry file="file://$PROJECT_DIR$/test_driver/app_test.dart" />
|
||||
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
|
||||
|
@ -618,9 +633,7 @@
|
|||
<entry file="file://$PROJECT_DIR$/example/assets/page-1.html">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_aja_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_aja_test.dart" />
|
||||
<entry file="file://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib/convert/codec.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
|
@ -638,13 +651,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-109">
|
||||
<caret line="10" selection-start-line="10" selection-end-line="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_ajax_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="314">
|
||||
|
@ -703,23 +709,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="159">
|
||||
<caret line="38" column="25" selection-start-line="38" selection-start-column="25" selection-end-line="38" selection-end-column="25" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/webview_example.screen.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="259">
|
||||
<caret line="61" column="19" selection-start-line="61" selection-start-column="19" selection-end-line="61" selection-end-column="19" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_should_override_url_loading_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="52">
|
||||
|
@ -792,7 +781,7 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/app_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="490">
|
||||
<state relative-caret-position="2445">
|
||||
<caret line="166" column="55" selection-start-line="166" selection-start-column="55" selection-end-line="166" selection-end-column="55" />
|
||||
<folding>
|
||||
<element signature="e#35#55#0" expanded="true" />
|
||||
|
@ -800,6 +789,13 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="17220">
|
||||
<caret line="1155" column="24" selection-start-line="1155" selection-start-column="6" selection-end-line="1155" selection-end-column="24" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="150">
|
||||
|
@ -807,44 +803,81 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1146">
|
||||
<caret line="1155" column="24" selection-start-line="1155" selection-start-column="6" selection-end-line="1155" selection-end-column="24" />
|
||||
</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="180">
|
||||
<caret line="12" column="25" selection-start-line="12" selection-start-column="6" selection-end-line="12" selection-end-column="25" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/main_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-62">
|
||||
<caret line="31" column="73" selection-start-line="31" selection-start-column="73" selection-end-line="31" selection-end-column="73" />
|
||||
<state relative-caret-position="255">
|
||||
<caret line="23" column="14" lean-forward="true" selection-start-line="21" selection-start-column="4" selection-end-line="23" selection-end-column="14" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-303">
|
||||
<caret line="278" column="24" selection-start-line="278" selection-start-column="13" selection-end-line="278" selection-end-column="24" />
|
||||
<state relative-caret-position="520">
|
||||
<caret line="75" column="5" selection-start-line="75" selection-start-column="5" selection-end-line="75" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/main_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="405">
|
||||
<caret line="42" column="5" selection-start-line="38" selection-start-column="9" selection-end-line="42" selection-end-column="5" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/chrome_safari_browser_example.screen.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="359">
|
||||
<caret line="60" column="16" selection-start-line="60" selection-start-column="16" selection-end-line="60" selection-end-column="16" />
|
||||
<folding>
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/in_app_browser_example.screen.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="583">
|
||||
<caret line="152" column="10" selection-start-line="152" selection-start-column="10" selection-end-line="152" selection-end-column="10" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="251">
|
||||
<caret line="51" column="33" selection-start-line="51" selection-start-column="33" selection-end-line="51" selection-end-column="33" />
|
||||
<state relative-caret-position="60">
|
||||
<caret line="4" column="64" selection-start-line="4" selection-start-column="64" selection-end-line="4" selection-end-column="64" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="93">
|
||||
<caret line="17" column="202" selection-start-line="17" selection-start-column="202" selection-end-line="17" selection-end-column="202" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/webview_options.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="290">
|
||||
<caret line="106" column="30" selection-start-line="106" selection-start-column="7" selection-end-line="106" selection-end-column="30" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="253">
|
||||
<caret line="130" column="52" selection-start-line="130" selection-start-column="52" selection-end-line="130" selection-end-column="52" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
- Added `onLoadResourceCustomScheme` event and `resourceCustomSchemes` option to set custom schemes that WebView must handle to load resources
|
||||
- Added `onTargetBlank` event and `useOnTargetBlank` option to manage links with `target="_blank"`
|
||||
- Added `ContentBlocker`, `ContentBlockerTrigger` and `ContentBlockerAction` classes and the `contentBlockers` option that allows to define a set of rules to use to block content in the WebView
|
||||
- Added new WebView options: `minimumFontSize`, `debuggingEnabled`, `preferredContentMode`, `applicationNameForUserAgent`, `incognito`, `cacheEnabled`
|
||||
- Added new WebView options: `minimumFontSize`, `debuggingEnabled`, `preferredContentMode`, `applicationNameForUserAgent`, `incognito`, `cacheEnabled`, `disableVerticalScroll`, `disableHorizontalScroll`
|
||||
- Added new Android WebView options: `allowContentAccess`, `allowFileAccess`, `allowFileAccessFromFileURLs`, `allowUniversalAccessFromFileURLs`, `appCachePath`, `blockNetworkImage`, `blockNetworkLoads`, `cacheMode`, `cursiveFontFamily`, `defaultFixedFontSize`, `defaultFontSize`, `defaultTextEncodingName`, `disabledActionModeMenuItems`, `fantasyFontFamily`, `fixedFontFamily`, `forceDark`, `geolocationEnabled`, `layoutAlgorithm`, `loadWithOverviewMode`, `loadsImagesAutomatically`, `minimumLogicalFontSize`, `needInitialFocus`, `offscreenPreRaster`, `sansSerifFontFamily`, `serifFontFamily`, `standardFontFamily`, `saveFormData`, `thirdPartyCookiesEnabled`, `hardwareAcceleration`
|
||||
- Added new iOS WebView options: `isFraudulentWebsiteWarningEnabled`, `selectionGranularity`, `dataDetectorTypes`, `sharedCookiesEnabled`
|
||||
- Added `onGeolocationPermissionsShowPrompt` event and `GeolocationPermissionShowPromptResponse` class (available only for Android)
|
||||
|
|
|
@ -10,6 +10,7 @@ import android.util.AttributeSet;
|
|||
import android.util.JsonReader;
|
||||
import android.util.JsonToken;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.DownloadListener;
|
||||
|
@ -677,6 +678,50 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
getChannel().invokeMethod("onFindResultReceived", obj);
|
||||
}
|
||||
});
|
||||
|
||||
setVerticalScrollBarEnabled(!options.disableVerticalScroll);
|
||||
setHorizontalScrollBarEnabled(!options.disableHorizontalScroll);
|
||||
setOnTouchListener(new View.OnTouchListener() {
|
||||
float m_downX;
|
||||
float m_downY;
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
|
||||
if (event.getPointerCount() > 1) {
|
||||
//Multi touch detected
|
||||
return true;
|
||||
}
|
||||
|
||||
if (options.disableHorizontalScroll && options.disableVerticalScroll) {
|
||||
return (event.getAction() == MotionEvent.ACTION_MOVE);
|
||||
}
|
||||
else if (options.disableHorizontalScroll || options.disableVerticalScroll) {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
// save the x
|
||||
m_downX = event.getX();
|
||||
// save the y
|
||||
m_downY = event.getY();
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
case MotionEvent.ACTION_UP: {
|
||||
if (options.disableHorizontalScroll) {
|
||||
// set x so that it doesn't move
|
||||
event.setLocation(m_downX, event.getY());
|
||||
} else {
|
||||
// set y so that it doesn't move
|
||||
event.setLocation(event.getX(), m_downY);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setIncognito(boolean enabled) {
|
||||
|
@ -1093,6 +1138,12 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
}
|
||||
}
|
||||
|
||||
if (newOptionsMap.get("disableVerticalScroll") != null && options.disableVerticalScroll != newOptions.disableVerticalScroll)
|
||||
setVerticalScrollBarEnabled(!newOptions.disableVerticalScroll);
|
||||
|
||||
if (newOptionsMap.get("disableHorizontalScroll") != null && options.disableHorizontalScroll != newOptions.disableHorizontalScroll)
|
||||
setHorizontalScrollBarEnabled(!newOptions.disableHorizontalScroll);
|
||||
|
||||
options = newOptions;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ public class InAppWebViewOptions extends Options {
|
|||
public Boolean incognito = false;
|
||||
public Boolean cacheEnabled = true;
|
||||
public Boolean transparentBackground = false;
|
||||
public Boolean disableVerticalScroll = false;
|
||||
public Boolean disableHorizontalScroll = false;
|
||||
|
||||
public Integer textZoom = 100;
|
||||
public Boolean clearSessionCache = false;
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||
|
||||
class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
||||
MyChromeSafariBrowser(browserFallback) : super(bFallback: browserFallback);
|
||||
|
||||
@override
|
||||
void onOpened() {
|
||||
print("ChromeSafari browser opened");
|
||||
}
|
||||
|
||||
@override
|
||||
void onLoaded() {
|
||||
print("ChromeSafari browser loaded");
|
||||
}
|
||||
|
||||
@override
|
||||
void onClosed() {
|
||||
print("ChromeSafari browser closed");
|
||||
}
|
||||
}
|
||||
|
||||
class ChromeSafariBrowserExampleScreen extends StatefulWidget {
|
||||
final ChromeSafariBrowser browser =
|
||||
new MyChromeSafariBrowser(new InAppBrowser());
|
||||
|
||||
@override
|
||||
_ChromeSafariBrowserExampleScreenState createState() =>
|
||||
new _ChromeSafariBrowserExampleScreenState();
|
||||
}
|
||||
|
||||
class _ChromeSafariBrowserExampleScreenState
|
||||
extends State<ChromeSafariBrowserExampleScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
"ChromeSafariBrowser",
|
||||
)),
|
||||
drawer: Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
DrawerHeader(
|
||||
child: Text('flutter_inappbrowser example'),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('InAppBrowser'),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/InAppBrowser');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('ChromeSafariBrowser'),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/ChromeSafariBrowser');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('InAppWebView'),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Center(
|
||||
child: RaisedButton(
|
||||
onPressed: () async {
|
||||
await widget.browser.open(
|
||||
url: "https://flutter.dev/",
|
||||
options: ChromeSafariBrowserClassOptions(
|
||||
androidChromeCustomTabsOptions:
|
||||
AndroidChromeCustomTabsOptions(
|
||||
addShareButton: false),
|
||||
iosSafariOptions:
|
||||
IosSafariOptions(barCollapsingEnabled: true)));
|
||||
},
|
||||
child: Text("Open Chrome Safari Browser")),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||
|
||||
class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
||||
MyChromeSafariBrowser(browserFallback) : super(bFallback: browserFallback);
|
||||
@override
|
||||
void onOpened() {
|
||||
print("ChromeSafari browser opened");
|
||||
}
|
||||
|
||||
@override
|
||||
void onLoaded() {
|
||||
print("ChromeSafari browser loaded");
|
||||
}
|
||||
|
||||
@override
|
||||
void onClosed() {
|
||||
print("ChromeSafari browser closed");
|
||||
}
|
||||
}
|
||||
|
||||
class ChromeSafariExampleScreen extends StatefulWidget {
|
||||
final ChromeSafariBrowser browser = new MyChromeSafariBrowser(new InAppBrowser());
|
||||
@override
|
||||
_ChromeSafariExampleScreenState createState() => new _ChromeSafariExampleScreenState();
|
||||
}
|
||||
|
||||
class _ChromeSafariExampleScreenState extends State<ChromeSafariExampleScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Center(
|
||||
child: new RaisedButton(
|
||||
onPressed: () async {
|
||||
await widget.browser.open(url: "https://flutter.dev/",
|
||||
options: ChromeSafariBrowserClassOptions(
|
||||
androidChromeCustomTabsOptions: AndroidChromeCustomTabsOptions(addShareButton: false),
|
||||
iosSafariOptions: IosSafariOptions(barCollapsingEnabled: true)
|
||||
)
|
||||
);
|
||||
},
|
||||
child: Text("Open Chrome Safari Browser")),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||
|
||||
class MyInAppBrowser extends InAppBrowser {
|
||||
@override
|
||||
Future onBrowserCreated() async {
|
||||
print("\n\nBrowser Ready!\n\n");
|
||||
}
|
||||
|
||||
@override
|
||||
Future onLoadStart(String url) async {
|
||||
print("\n\nStarted $url\n\n");
|
||||
}
|
||||
|
||||
@override
|
||||
Future onLoadStop(String url) async {
|
||||
print("\n\nStopped $url\n\n");
|
||||
}
|
||||
|
||||
@override
|
||||
Future onScrollChanged(int x, int y) async {
|
||||
print("Scrolled: x:$x y:$y");
|
||||
}
|
||||
|
||||
@override
|
||||
void onLoadError(String url, int code, String message) {
|
||||
print("Can't load $url.. Error: $message");
|
||||
}
|
||||
|
||||
@override
|
||||
void onProgressChanged(int progress) {
|
||||
print("Progress: $progress");
|
||||
}
|
||||
|
||||
@override
|
||||
void onExit() {
|
||||
print("\n\nBrowser closed!\n\n");
|
||||
}
|
||||
|
||||
@override
|
||||
void shouldOverrideUrlLoading(String url) {
|
||||
print("\n\n override $url\n\n");
|
||||
this.webViewController.loadUrl(url: url);
|
||||
}
|
||||
|
||||
@override
|
||||
void onLoadResource(LoadedResource response) {
|
||||
print("Started at: " +
|
||||
response.startTime.toString() +
|
||||
"ms ---> duration: " +
|
||||
response.duration.toString() +
|
||||
"ms " +
|
||||
response.url);
|
||||
}
|
||||
|
||||
@override
|
||||
void onConsoleMessage(ConsoleMessage consoleMessage) {
|
||||
print("""
|
||||
console output:
|
||||
message: ${consoleMessage.message}
|
||||
messageLevel: ${consoleMessage.messageLevel.toValue()}
|
||||
""");
|
||||
}
|
||||
|
||||
@override
|
||||
void onDownloadStart(String url) {
|
||||
print("Download of " + url);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CustomSchemeResponse> onLoadResourceCustomScheme(
|
||||
String scheme, String url) async {
|
||||
print("custom scheme: " + scheme);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GeolocationPermissionShowPromptResponse>
|
||||
onGeolocationPermissionsShowPrompt(String origin) async {
|
||||
print("request Geolocation permission API");
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<JsAlertResponse> onJsAlert(String message) async {
|
||||
return new JsAlertResponse(handledByClient: false, message: "coma iam");
|
||||
}
|
||||
|
||||
@override
|
||||
Future<JsConfirmResponse> onJsConfirm(String message) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<JsPromptResponse> onJsPrompt(String message, String defaultValue) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class InAppBrowserExampleScreen extends StatefulWidget {
|
||||
final MyInAppBrowser browser = new MyInAppBrowser();
|
||||
|
||||
@override
|
||||
_InAppBrowserExampleScreenState createState() =>
|
||||
new _InAppBrowserExampleScreenState();
|
||||
}
|
||||
|
||||
class _InAppBrowserExampleScreenState extends State<InAppBrowserExampleScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
"InAppBrowser",
|
||||
)),
|
||||
drawer: Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
DrawerHeader(
|
||||
child: Text('flutter_inappbrowser example'),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('InAppBrowser'),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/InAppBrowser');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('ChromeSafariBrowser'),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/ChromeSafariBrowser');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('InAppWebView'),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Center(
|
||||
child: RaisedButton(
|
||||
onPressed: () {
|
||||
widget.browser.openFile(
|
||||
assetFilePath: "assets/index.html",
|
||||
//url: "https://www.google.com/",
|
||||
options: InAppBrowserClassOptions(
|
||||
inAppWebViewWidgetOptions: InAppWebViewWidgetOptions(
|
||||
inAppWebViewOptions: InAppWebViewOptions(
|
||||
useShouldOverrideUrlLoading: true,
|
||||
useOnLoadResource: true,
|
||||
))));
|
||||
},
|
||||
child: Text("Open Webview Browser")),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,573 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
|
||||
class InAppWebViewExampleScreen extends StatefulWidget {
|
||||
@override
|
||||
_InAppWebViewExampleScreenState createState() =>
|
||||
new _InAppWebViewExampleScreenState();
|
||||
}
|
||||
|
||||
class Foo {
|
||||
String bar;
|
||||
String baz;
|
||||
|
||||
Foo({this.bar, this.baz});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {'bar': this.bar, 'baz': this.baz};
|
||||
}
|
||||
}
|
||||
|
||||
class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
|
||||
InAppWebViewController webView;
|
||||
String url = "";
|
||||
double progress = 0;
|
||||
|
||||
TextEditingController _textFieldController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// HttpAuthCredentialDatabase.instance().clearAllAuthCredentials();
|
||||
//
|
||||
// HttpAuthCredentialDatabase.instance().getHttpAuthCredentials(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081)).then((credentials) {
|
||||
// for (var credential in credentials )
|
||||
// print("\n\nCREDENTIAL: ${credential.username} ${credential.password}\n\n");
|
||||
// });
|
||||
// HttpAuthCredentialDatabase.instance().getAllAuthCredentials().then((result) {
|
||||
// for (var r in result) {
|
||||
// ProtectionSpace protectionSpace = r["protectionSpace"];
|
||||
// print("\n\nProtectionSpace: ${protectionSpace.protocol} ${protectionSpace.host}:");
|
||||
// List<HttpAuthCredential> credentials = r["credentials"];
|
||||
// for (var credential in credentials)
|
||||
// print("\tCREDENTIAL: ${credential.username} ${credential.password}");
|
||||
// }
|
||||
// });
|
||||
// HttpAuthCredentialDatabase.instance().setHttpAuthCredential(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081), HttpAuthCredential(username: "user 1", password: "password 1"));
|
||||
// HttpAuthCredentialDatabase.instance().setHttpAuthCredential(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081), HttpAuthCredential(username: "user 2", password: "password 2"));
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
"InAppWebView",
|
||||
)),
|
||||
drawer: Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
DrawerHeader(
|
||||
child: Text('flutter_inappbrowser example'),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('InAppBrowser'),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/InAppBrowser');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('ChromeSafariBrowser'),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/ChromeSafariBrowser');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text('InAppWebView'),
|
||||
onTap: () {
|
||||
Navigator.popAndPushNamed(context, '/');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
child: Column(children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(20.0),
|
||||
child: Text(
|
||||
"CURRENT URL\n${(url.length > 50) ? url.substring(0, 50) + "..." : url}"),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: progress < 1.0
|
||||
? LinearProgressIndicator(value: progress)
|
||||
: Container()),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
decoration:
|
||||
BoxDecoration(border: Border.all(color: Colors.blueAccent)),
|
||||
child: InAppWebView(
|
||||
//initialUrl: "https://www.youtube.com/embed/M7lc1UVf-VE?playsinline=1",
|
||||
//initialUrl: "https://github.com",
|
||||
//initialUrl: "chrome://safe-browsing/match?type=malware",
|
||||
//initialUrl: "http://192.168.1.20:8081/",
|
||||
//initialUrl: "https://192.168.1.20:4433/",
|
||||
initialFile: "assets/index.html",
|
||||
initialHeaders: {},
|
||||
initialOptions: InAppWebViewWidgetOptions(
|
||||
inAppWebViewOptions: InAppWebViewOptions(
|
||||
//disableVerticalScroll: false,
|
||||
//disableHorizontalScroll: false,
|
||||
debuggingEnabled: true,
|
||||
clearCache: true,
|
||||
useShouldOverrideUrlLoading: true,
|
||||
useOnTargetBlank: true,
|
||||
useOnLoadResource: true,
|
||||
useOnDownloadStart: true,
|
||||
useShouldInterceptAjaxRequest: true,
|
||||
useShouldInterceptFetchRequest: true,
|
||||
//preferredContentMode: InAppWebViewUserPreferredContentMode.DESKTOP,
|
||||
resourceCustomSchemes: [
|
||||
"my-special-custom-scheme"
|
||||
],
|
||||
contentBlockers: [
|
||||
ContentBlocker(
|
||||
trigger: ContentBlockerTrigger(
|
||||
urlFilter: ".*",
|
||||
resourceType: [
|
||||
ContentBlockerTriggerResourceType.IMAGE,
|
||||
ContentBlockerTriggerResourceType.STYLE_SHEET
|
||||
],
|
||||
ifTopUrl: [
|
||||
"https://getbootstrap.com/"
|
||||
]),
|
||||
action: ContentBlockerAction(
|
||||
type: ContentBlockerActionType.BLOCK))
|
||||
]),
|
||||
androidInAppWebViewOptions: AndroidInAppWebViewOptions(
|
||||
databaseEnabled: true,
|
||||
domStorageEnabled: true,
|
||||
geolocationEnabled: true,
|
||||
//safeBrowsingEnabled: true,
|
||||
//blockNetworkImage: true,
|
||||
),
|
||||
),
|
||||
onWebViewCreated: (InAppWebViewController controller) {
|
||||
webView = controller;
|
||||
|
||||
if (Platform.isAndroid) webView.startSafeBrowsing();
|
||||
|
||||
webView.addJavaScriptHandler(
|
||||
handlerName: 'handlerFoo',
|
||||
callback: (args) {
|
||||
return new Foo(bar: 'bar_value', baz: 'baz_value');
|
||||
});
|
||||
|
||||
webView.addJavaScriptHandler(
|
||||
handlerName: 'handlerFooWithArgs',
|
||||
callback: (args) {
|
||||
print(args);
|
||||
return [
|
||||
args[0] + 5,
|
||||
!args[1],
|
||||
args[2][0],
|
||||
args[3]['foo']
|
||||
];
|
||||
});
|
||||
},
|
||||
onLoadStart: (InAppWebViewController controller, String url) {
|
||||
print("started $url");
|
||||
setState(() {
|
||||
this.url = url;
|
||||
});
|
||||
},
|
||||
onLoadStop:
|
||||
(InAppWebViewController controller, String url) async {
|
||||
print("stopped $url");
|
||||
if (Platform.isAndroid) {
|
||||
controller.clearSslPreferences();
|
||||
controller.clearClientCertPreferences();
|
||||
}
|
||||
//controller.findAllAsync("flutter");
|
||||
print(await controller.getFavicons());
|
||||
},
|
||||
onLoadError: (InAppWebViewController controller, String url,
|
||||
int code, String message) async {
|
||||
print("error $url: $code, $message");
|
||||
|
||||
var tRexHtml = await controller.getTRexRunnerHtml();
|
||||
var tRexCss = await controller.getTRexRunnerCss();
|
||||
|
||||
controller.loadData(data: """
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
|
||||
<style>$tRexCss</style>
|
||||
</head>
|
||||
<body>
|
||||
$tRexHtml
|
||||
<p>
|
||||
URL $url failed to load.
|
||||
</p>
|
||||
<p>
|
||||
Error: $code, $message
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
""");
|
||||
},
|
||||
onProgressChanged:
|
||||
(InAppWebViewController controller, int progress) {
|
||||
setState(() {
|
||||
this.progress = progress / 100;
|
||||
});
|
||||
},
|
||||
shouldOverrideUrlLoading:
|
||||
(InAppWebViewController controller, String url) {
|
||||
print("override $url");
|
||||
controller.loadUrl(url: url);
|
||||
},
|
||||
onLoadResource: (InAppWebViewController controller,
|
||||
LoadedResource response) {
|
||||
print("Resource type: '" +
|
||||
response.initiatorType +
|
||||
"' started at: " +
|
||||
response.startTime.toString() +
|
||||
"ms ---> duration: " +
|
||||
response.duration.toString() +
|
||||
"ms " +
|
||||
response.url);
|
||||
},
|
||||
onConsoleMessage: (InAppWebViewController controller,
|
||||
ConsoleMessage consoleMessage) {
|
||||
print("""
|
||||
console output:
|
||||
message: ${consoleMessage.message}
|
||||
messageLevel: ${consoleMessage.messageLevel.toString()}
|
||||
""");
|
||||
},
|
||||
onDownloadStart:
|
||||
(InAppWebViewController controller, String url) async {
|
||||
// final taskId = await FlutterDownloader.enqueue(
|
||||
// url: url,
|
||||
// savedDir: await _findLocalPath(),
|
||||
// showNotification: true, // show download progress in status bar (for Android)
|
||||
// openFileFromNotification: true, // click on notification to open downloaded file (for Android)
|
||||
// );
|
||||
},
|
||||
onLoadResourceCustomScheme: (InAppWebViewController controller,
|
||||
String scheme, String url) async {
|
||||
if (scheme == "my-special-custom-scheme") {
|
||||
var bytes = await rootBundle.load("assets/" +
|
||||
url.replaceFirst("my-special-custom-scheme://", "", 0));
|
||||
var response = new CustomSchemeResponse(
|
||||
data: bytes.buffer.asUint8List(),
|
||||
contentType: "image/svg+xml",
|
||||
contentEnconding: "utf-8");
|
||||
return response;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onTargetBlank: (InAppWebViewController controller, String url) {
|
||||
print("target _blank: " + url);
|
||||
controller.loadUrl(url: url);
|
||||
},
|
||||
onGeolocationPermissionsShowPrompt:
|
||||
(InAppWebViewController controller, String origin) async {
|
||||
GeolocationPermissionShowPromptResponse response;
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text("Permission Geolocation API"),
|
||||
content: Text("Can we use Geolocation API?"),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Close"),
|
||||
onPressed: () {
|
||||
response =
|
||||
new GeolocationPermissionShowPromptResponse(
|
||||
origin: origin,
|
||||
allow: false,
|
||||
retain: false);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("Accept"),
|
||||
onPressed: () {
|
||||
response =
|
||||
new GeolocationPermissionShowPromptResponse(
|
||||
origin: origin,
|
||||
allow: true,
|
||||
retain: true);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return response;
|
||||
},
|
||||
onJsAlert:
|
||||
(InAppWebViewController controller, String message) async {
|
||||
JsAlertResponseAction action =
|
||||
await createAlertDialog(context, message);
|
||||
return new JsAlertResponse(
|
||||
handledByClient: true, action: action);
|
||||
},
|
||||
onJsConfirm:
|
||||
(InAppWebViewController controller, String message) async {
|
||||
JsConfirmResponseAction action =
|
||||
await createConfirmDialog(context, message);
|
||||
return new JsConfirmResponse(
|
||||
handledByClient: true, action: action);
|
||||
},
|
||||
onJsPrompt: (InAppWebViewController controller, String message,
|
||||
String defaultValue) async {
|
||||
_textFieldController.text = defaultValue;
|
||||
JsPromptResponseAction action =
|
||||
await createPromptDialog(context, message);
|
||||
return new JsPromptResponse(
|
||||
handledByClient: true,
|
||||
action: action,
|
||||
value: _textFieldController.text);
|
||||
},
|
||||
onSafeBrowsingHit: (InAppWebViewController controller,
|
||||
String url, SafeBrowsingThreat threatType) async {
|
||||
SafeBrowsingResponseAction action =
|
||||
SafeBrowsingResponseAction.BACK_TO_SAFETY;
|
||||
return new SafeBrowsingResponse(report: true, action: action);
|
||||
},
|
||||
onReceivedHttpAuthRequest: (InAppWebViewController controller,
|
||||
HttpAuthChallenge challenge) async {
|
||||
print(
|
||||
"HTTP AUTH REQUEST: ${challenge.protectionSpace.host}, realm: ${challenge.protectionSpace.realm}, previous failure count: ${challenge.previousFailureCount.toString()}");
|
||||
|
||||
return new HttpAuthResponse(
|
||||
username: "USERNAME",
|
||||
password: "PASSWORD",
|
||||
action: HttpAuthResponseAction
|
||||
.USE_SAVED_HTTP_AUTH_CREDENTIALS,
|
||||
permanentPersistence: true);
|
||||
},
|
||||
onReceivedServerTrustAuthRequest:
|
||||
(InAppWebViewController controller,
|
||||
ServerTrustChallenge challenge) async {
|
||||
print(
|
||||
"SERVER TRUST AUTH REQUEST: ${challenge.protectionSpace.host}, SSL ERROR CODE: ${challenge.error.toString()}, MESSAGE: ${challenge.message}");
|
||||
|
||||
return new ServerTrustAuthResponse(
|
||||
action: ServerTrustAuthResponseAction.PROCEED);
|
||||
},
|
||||
onReceivedClientCertRequest: (InAppWebViewController controller,
|
||||
ClientCertChallenge challenge) async {
|
||||
print(
|
||||
"CLIENT CERT REQUEST: ${challenge.protectionSpace.host}");
|
||||
|
||||
return new ClientCertResponse(
|
||||
certificatePath: "assets/certificate.pfx",
|
||||
certificatePassword: "",
|
||||
androidKeyStoreType: "PKCS12",
|
||||
action: ClientCertResponseAction.PROCEED);
|
||||
},
|
||||
onFindResultReceived: (InAppWebViewController controller,
|
||||
int activeMatchOrdinal,
|
||||
int numberOfMatches,
|
||||
bool isDoneCounting) async {
|
||||
print(
|
||||
"Current highlighted: $activeMatchOrdinal, Number of matches found: $numberOfMatches, find operation completed: $isDoneCounting");
|
||||
},
|
||||
shouldInterceptAjaxRequest: (InAppWebViewController controller,
|
||||
AjaxRequest ajaxRequest) async {
|
||||
print(
|
||||
"AJAX REQUEST: ${ajaxRequest.method} - ${ajaxRequest.url}, DATA: ${ajaxRequest.data}, headers: ${ajaxRequest.headers}");
|
||||
if (ajaxRequest.url ==
|
||||
"http://192.168.1.20:8082/test-ajax-post") {
|
||||
ajaxRequest.responseType = 'json';
|
||||
ajaxRequest.data = "firstname=Lorenzo&lastname=Pichilli";
|
||||
}
|
||||
// ajaxRequest.method = "GET";
|
||||
// ajaxRequest.url = "http://192.168.1.20:8082/test-download-file";
|
||||
// ajaxRequest.headers = {
|
||||
// "Custom-Header": "Custom-Value"
|
||||
// };
|
||||
// return ajaxRequest;
|
||||
return ajaxRequest;
|
||||
},
|
||||
onAjaxReadyStateChange: (InAppWebViewController controller,
|
||||
AjaxRequest ajaxRequest) async {
|
||||
print(
|
||||
"AJAX READY STATE CHANGE: ${ajaxRequest.method} - ${ajaxRequest.url}, ${ajaxRequest.status}, ${ajaxRequest.readyState}, ${ajaxRequest.responseType}, ${ajaxRequest.responseText}, ${ajaxRequest.response}, ${ajaxRequest.responseHeaders}");
|
||||
return AjaxRequestAction.PROCEED;
|
||||
},
|
||||
onAjaxProgress: (InAppWebViewController controller,
|
||||
AjaxRequest ajaxRequest) async {
|
||||
print(
|
||||
"AJAX EVENT: ${ajaxRequest.method} - ${ajaxRequest.url}, ${ajaxRequest.event.type}, LOADED: ${ajaxRequest.event.loaded}, ${ajaxRequest.responseHeaders}");
|
||||
return AjaxRequestAction.PROCEED;
|
||||
},
|
||||
shouldInterceptFetchRequest: (InAppWebViewController controller,
|
||||
FetchRequest fetchRequest) async {
|
||||
print(
|
||||
"FETCH REQUEST: ${fetchRequest.method} - ${fetchRequest.url}, headers: ${fetchRequest.headers}");
|
||||
fetchRequest.action = FetchRequestAction.ABORT;
|
||||
print(fetchRequest.body);
|
||||
return fetchRequest;
|
||||
},
|
||||
onNavigationStateChange:
|
||||
(InAppWebViewController controller, String url) async {
|
||||
print("NAVIGATION STATE CHANGE: $url");
|
||||
setState(() {
|
||||
this.url = url;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
ButtonBar(
|
||||
alignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
RaisedButton(
|
||||
child: Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
if (webView != null) {
|
||||
webView.goBack();
|
||||
}
|
||||
},
|
||||
),
|
||||
RaisedButton(
|
||||
child: Icon(Icons.arrow_forward),
|
||||
onPressed: () {
|
||||
if (webView != null) {
|
||||
webView.goForward();
|
||||
}
|
||||
},
|
||||
),
|
||||
RaisedButton(
|
||||
child: Icon(Icons.refresh),
|
||||
onPressed: () {
|
||||
if (webView != null) {
|
||||
webView.reload();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
])));
|
||||
}
|
||||
|
||||
Future<JsAlertResponseAction> createAlertDialog(
|
||||
BuildContext context, String message) async {
|
||||
JsAlertResponseAction action;
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
content: Text(message),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Ok"),
|
||||
onPressed: () {
|
||||
action = JsAlertResponseAction.CONFIRM;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
Future<JsConfirmResponseAction> createConfirmDialog(
|
||||
BuildContext context, String message) async {
|
||||
JsConfirmResponseAction action;
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
content: Text(message),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Cancel"),
|
||||
onPressed: () {
|
||||
action = JsConfirmResponseAction.CANCEL;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("Ok"),
|
||||
onPressed: () {
|
||||
action = JsConfirmResponseAction.CONFIRM;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
Future<JsPromptResponseAction> createPromptDialog(
|
||||
BuildContext context, String message) async {
|
||||
JsPromptResponseAction action;
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(message),
|
||||
content: TextField(
|
||||
controller: _textFieldController,
|
||||
),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Cancel"),
|
||||
onPressed: () {
|
||||
action = JsPromptResponseAction.CANCEL;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("Ok"),
|
||||
onPressed: () {
|
||||
action = JsPromptResponseAction.CONFIRM;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
Future<String> _findLocalPath() async {
|
||||
final directory = Platform.isAndroid
|
||||
? await getExternalStorageDirectory()
|
||||
: await getApplicationDocumentsDirectory();
|
||||
return directory.path;
|
||||
}
|
||||
}
|
|
@ -1,453 +0,0 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
|
||||
class InlineExampleScreen extends StatefulWidget {
|
||||
@override
|
||||
_InlineExampleScreenState createState() => new _InlineExampleScreenState();
|
||||
}
|
||||
|
||||
class Foo {
|
||||
String bar;
|
||||
String baz;
|
||||
|
||||
Foo({this.bar, this.baz});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'bar': this.bar,
|
||||
'baz': this.baz
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class _InlineExampleScreenState extends State<InlineExampleScreen> {
|
||||
InAppWebViewController webView;
|
||||
String url = "";
|
||||
double progress = 0;
|
||||
|
||||
TextEditingController _textFieldController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// HttpAuthCredentialDatabase.instance().clearAllAuthCredentials();
|
||||
//
|
||||
// HttpAuthCredentialDatabase.instance().getHttpAuthCredentials(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081)).then((credentials) {
|
||||
// for (var credential in credentials )
|
||||
// print("\n\nCREDENTIAL: ${credential.username} ${credential.password}\n\n");
|
||||
// });
|
||||
// HttpAuthCredentialDatabase.instance().getAllAuthCredentials().then((result) {
|
||||
// for (var r in result) {
|
||||
// ProtectionSpace protectionSpace = r["protectionSpace"];
|
||||
// print("\n\nProtectionSpace: ${protectionSpace.protocol} ${protectionSpace.host}:");
|
||||
// List<HttpAuthCredential> credentials = r["credentials"];
|
||||
// for (var credential in credentials)
|
||||
// print("\tCREDENTIAL: ${credential.username} ${credential.password}");
|
||||
// }
|
||||
// });
|
||||
// HttpAuthCredentialDatabase.instance().setHttpAuthCredential(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081), HttpAuthCredential(username: "user 1", password: "password 1"));
|
||||
// HttpAuthCredentialDatabase.instance().setHttpAuthCredential(ProtectionSpace(host: "192.168.1.20", protocol: "http", realm: "Node", port: 8081), HttpAuthCredential(username: "user 2", password: "password 2"));
|
||||
|
||||
return Container(
|
||||
child: Column(children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(20.0),
|
||||
child: Text(
|
||||
"CURRENT URL\n${(url.length > 50) ? url.substring(0, 50) + "..." : url}"),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: progress < 1.0 ? LinearProgressIndicator(value: progress) : Container()
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
decoration:
|
||||
BoxDecoration(border: Border.all(color: Colors.blueAccent)),
|
||||
child: InAppWebView(
|
||||
//initialUrl: "https://www.youtube.com/embed/M7lc1UVf-VE?playsinline=1",
|
||||
//initialUrl: "https://github.com",
|
||||
//initialUrl: "chrome://safe-browsing/match?type=malware",
|
||||
//initialUrl: "http://192.168.1.20:8081/",
|
||||
//initialUrl: "https://192.168.1.20:4433/",
|
||||
initialFile: "assets/index.html",
|
||||
initialHeaders: {},
|
||||
initialOptions: InAppWebViewWidgetOptions(
|
||||
inAppWebViewOptions: InAppWebViewOptions(
|
||||
debuggingEnabled: true,
|
||||
clearCache: true,
|
||||
useShouldOverrideUrlLoading: true,
|
||||
useOnTargetBlank: true,
|
||||
useOnLoadResource: true,
|
||||
useOnDownloadStart: true,
|
||||
useShouldInterceptAjaxRequest: true,
|
||||
useShouldInterceptFetchRequest: true,
|
||||
//preferredContentMode: InAppWebViewUserPreferredContentMode.DESKTOP,
|
||||
resourceCustomSchemes: ["my-special-custom-scheme"],
|
||||
contentBlockers: [
|
||||
ContentBlocker(
|
||||
trigger: ContentBlockerTrigger(
|
||||
urlFilter: ".*",
|
||||
resourceType: [ContentBlockerTriggerResourceType.IMAGE, ContentBlockerTriggerResourceType.STYLE_SHEET],
|
||||
ifTopUrl: ["https://getbootstrap.com/"]),
|
||||
action: ContentBlockerAction(type: ContentBlockerActionType.BLOCK)
|
||||
)
|
||||
]
|
||||
),
|
||||
androidInAppWebViewOptions: AndroidInAppWebViewOptions(
|
||||
databaseEnabled: true,
|
||||
domStorageEnabled: true,
|
||||
geolocationEnabled: true,
|
||||
//safeBrowsingEnabled: true,
|
||||
//blockNetworkImage: true,
|
||||
),
|
||||
),
|
||||
onWebViewCreated: (InAppWebViewController controller) {
|
||||
webView = controller;
|
||||
|
||||
if (Platform.isAndroid)
|
||||
webView.startSafeBrowsing();
|
||||
|
||||
webView.addJavaScriptHandler(handlerName:'handlerFoo', callback: (args) {
|
||||
return new Foo(bar: 'bar_value', baz: 'baz_value');
|
||||
});
|
||||
|
||||
webView.addJavaScriptHandler(handlerName: 'handlerFooWithArgs', callback: (args) {
|
||||
print(args);
|
||||
return [args[0] + 5, !args[1], args[2][0], args[3]['foo']];
|
||||
});
|
||||
},
|
||||
onLoadStart: (InAppWebViewController controller, String url) {
|
||||
print("started $url");
|
||||
setState(() {
|
||||
this.url = url;
|
||||
});
|
||||
},
|
||||
onLoadStop: (InAppWebViewController controller, String url) async {
|
||||
print("stopped $url");
|
||||
if (Platform.isAndroid) {
|
||||
controller.clearSslPreferences();
|
||||
controller.clearClientCertPreferences();
|
||||
}
|
||||
//controller.findAllAsync("flutter");
|
||||
print(await controller.getFavicons());
|
||||
},
|
||||
onLoadError: (InAppWebViewController controller, String url, int code, String message) async {
|
||||
print("error $url: $code, $message");
|
||||
|
||||
var tRexHtml = await controller.getTRexRunnerHtml();
|
||||
var tRexCss = await controller.getTRexRunnerCss();
|
||||
|
||||
controller.loadData(data: """
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
|
||||
<style>$tRexCss</style>
|
||||
</head>
|
||||
<body>
|
||||
$tRexHtml
|
||||
<p>
|
||||
URL $url failed to load.
|
||||
</p>
|
||||
<p>
|
||||
Error: $code, $message
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
""");
|
||||
},
|
||||
onProgressChanged:
|
||||
(InAppWebViewController controller, int progress) {
|
||||
setState(() {
|
||||
this.progress = progress / 100;
|
||||
});
|
||||
},
|
||||
shouldOverrideUrlLoading: (InAppWebViewController controller, String url) {
|
||||
print("override $url");
|
||||
controller.loadUrl(url: url);
|
||||
},
|
||||
onLoadResource: (InAppWebViewController controller, LoadedResource response) {
|
||||
print("Resource type: '"+response.initiatorType + "' started at: " +
|
||||
response.startTime.toString() +
|
||||
"ms ---> duration: " +
|
||||
response.duration.toString() +
|
||||
"ms " +
|
||||
response.url);
|
||||
},
|
||||
onConsoleMessage: (InAppWebViewController controller, ConsoleMessage consoleMessage) {
|
||||
print("""
|
||||
console output:
|
||||
message: ${consoleMessage.message}
|
||||
messageLevel: ${consoleMessage.messageLevel.toString()}
|
||||
""");
|
||||
},
|
||||
onDownloadStart: (InAppWebViewController controller, String url) async {
|
||||
// final taskId = await FlutterDownloader.enqueue(
|
||||
// url: url,
|
||||
// savedDir: await _findLocalPath(),
|
||||
// showNotification: true, // show download progress in status bar (for Android)
|
||||
// openFileFromNotification: true, // click on notification to open downloaded file (for Android)
|
||||
// );
|
||||
},
|
||||
onLoadResourceCustomScheme: (InAppWebViewController controller, String scheme, String url) async {
|
||||
if (scheme == "my-special-custom-scheme") {
|
||||
var bytes = await rootBundle.load("assets/" + url.replaceFirst("my-special-custom-scheme://", "", 0));
|
||||
var response = new CustomSchemeResponse(data: bytes.buffer.asUint8List(), contentType: "image/svg+xml", contentEnconding: "utf-8");
|
||||
return response;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
onTargetBlank: (InAppWebViewController controller, String url) {
|
||||
print("target _blank: " + url);
|
||||
controller.loadUrl(url: url);
|
||||
},
|
||||
onGeolocationPermissionsShowPrompt: (InAppWebViewController controller, String origin) async {
|
||||
GeolocationPermissionShowPromptResponse response;
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text("Permission Geolocation API"),
|
||||
content: Text("Can we use Geolocation API?"),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Close"),
|
||||
onPressed: () {
|
||||
response = new GeolocationPermissionShowPromptResponse(origin: origin, allow: false, retain: false);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("Accept"),
|
||||
onPressed: () {
|
||||
response = new GeolocationPermissionShowPromptResponse(origin: origin, allow: true, retain: true);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return response;
|
||||
},
|
||||
onJsAlert: (InAppWebViewController controller, String message) async {
|
||||
JsAlertResponseAction action = await createAlertDialog(context, message);
|
||||
return new JsAlertResponse(handledByClient: true, action: action);
|
||||
},
|
||||
onJsConfirm: (InAppWebViewController controller, String message) async {
|
||||
JsConfirmResponseAction action = await createConfirmDialog(context, message);
|
||||
return new JsConfirmResponse(handledByClient: true, action: action);
|
||||
},
|
||||
onJsPrompt: (InAppWebViewController controller, String message, String defaultValue) async {
|
||||
_textFieldController.text = defaultValue;
|
||||
JsPromptResponseAction action = await createPromptDialog(context, message);
|
||||
return new JsPromptResponse(handledByClient: true, action: action, value: _textFieldController.text);
|
||||
},
|
||||
onSafeBrowsingHit: (InAppWebViewController controller, String url, SafeBrowsingThreat threatType) async {
|
||||
SafeBrowsingResponseAction action = SafeBrowsingResponseAction.BACK_TO_SAFETY;
|
||||
return new SafeBrowsingResponse(report: true, action: action);
|
||||
},
|
||||
onReceivedHttpAuthRequest: (InAppWebViewController controller, HttpAuthChallenge challenge) async {
|
||||
print("HTTP AUTH REQUEST: ${challenge.protectionSpace.host}, realm: ${challenge.protectionSpace.realm}, previous failure count: ${challenge.previousFailureCount.toString()}");
|
||||
|
||||
return new HttpAuthResponse(username: "USERNAME", password: "PASSWORD", action: HttpAuthResponseAction.USE_SAVED_HTTP_AUTH_CREDENTIALS, permanentPersistence: true);
|
||||
},
|
||||
onReceivedServerTrustAuthRequest: (InAppWebViewController controller, ServerTrustChallenge challenge) async {
|
||||
print("SERVER TRUST AUTH REQUEST: ${challenge.protectionSpace.host}, SSL ERROR CODE: ${challenge.error.toString()}, MESSAGE: ${challenge.message}");
|
||||
|
||||
return new ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED);
|
||||
},
|
||||
onReceivedClientCertRequest: (InAppWebViewController controller, ClientCertChallenge challenge) async {
|
||||
print("CLIENT CERT REQUEST: ${challenge.protectionSpace.host}");
|
||||
|
||||
return new ClientCertResponse(certificatePath: "assets/certificate.pfx", certificatePassword: "", androidKeyStoreType: "PKCS12", action: ClientCertResponseAction.PROCEED);
|
||||
},
|
||||
onFindResultReceived: (InAppWebViewController controller, int activeMatchOrdinal, int numberOfMatches, bool isDoneCounting) async {
|
||||
print("Current highlighted: $activeMatchOrdinal, Number of matches found: $numberOfMatches, find operation completed: $isDoneCounting");
|
||||
},
|
||||
shouldInterceptAjaxRequest: (InAppWebViewController controller, AjaxRequest ajaxRequest) async {
|
||||
print("AJAX REQUEST: ${ajaxRequest.method} - ${ajaxRequest.url}, DATA: ${ajaxRequest.data}, headers: ${ajaxRequest.headers}");
|
||||
if (ajaxRequest.url == "http://192.168.1.20:8082/test-ajax-post") {
|
||||
ajaxRequest.responseType = 'json';
|
||||
ajaxRequest.data = "firstname=Lorenzo&lastname=Pichilli";
|
||||
}
|
||||
// ajaxRequest.method = "GET";
|
||||
// ajaxRequest.url = "http://192.168.1.20:8082/test-download-file";
|
||||
// ajaxRequest.headers = {
|
||||
// "Custom-Header": "Custom-Value"
|
||||
// };
|
||||
// return ajaxRequest;
|
||||
return ajaxRequest;
|
||||
},
|
||||
onAjaxReadyStateChange: (InAppWebViewController controller, AjaxRequest ajaxRequest) async {
|
||||
print("AJAX READY STATE CHANGE: ${ajaxRequest.method} - ${ajaxRequest.url}, ${ajaxRequest.status}, ${ajaxRequest.readyState}, ${ajaxRequest.responseType}, ${ajaxRequest.responseText}, ${ajaxRequest.response}, ${ajaxRequest.responseHeaders}");
|
||||
return AjaxRequestAction.PROCEED;
|
||||
},
|
||||
onAjaxProgress: (InAppWebViewController controller, AjaxRequest ajaxRequest) async {
|
||||
print("AJAX EVENT: ${ajaxRequest.method} - ${ajaxRequest.url}, ${ajaxRequest.event.type}, LOADED: ${ajaxRequest.event.loaded}, ${ajaxRequest.responseHeaders}");
|
||||
return AjaxRequestAction.PROCEED;
|
||||
},
|
||||
shouldInterceptFetchRequest: (InAppWebViewController controller, FetchRequest fetchRequest) async {
|
||||
print("FETCH REQUEST: ${fetchRequest.method} - ${fetchRequest.url}, headers: ${fetchRequest.headers}");
|
||||
fetchRequest.action = FetchRequestAction.ABORT;
|
||||
print(fetchRequest.body);
|
||||
return fetchRequest;
|
||||
},
|
||||
onNavigationStateChange: (InAppWebViewController controller, String url) async {
|
||||
print("NAVIGATION STATE CHANGE: $url");
|
||||
setState(() {
|
||||
this.url = url;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
ButtonBar(
|
||||
alignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
RaisedButton(
|
||||
child: Icon(Icons.arrow_back),
|
||||
onPressed: () {
|
||||
if (webView != null) {
|
||||
webView.goBack();
|
||||
}
|
||||
},
|
||||
),
|
||||
RaisedButton(
|
||||
child: Icon(Icons.arrow_forward),
|
||||
onPressed: () {
|
||||
if (webView != null) {
|
||||
webView.goForward();
|
||||
}
|
||||
},
|
||||
),
|
||||
RaisedButton(
|
||||
child: Icon(Icons.refresh),
|
||||
onPressed: () {
|
||||
if (webView != null) {
|
||||
webView.reload();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
]));
|
||||
}
|
||||
|
||||
Future<JsAlertResponseAction> createAlertDialog(BuildContext context, String message) async {
|
||||
JsAlertResponseAction action;
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
content: Text(message),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Ok"),
|
||||
onPressed: () {
|
||||
action = JsAlertResponseAction.CONFIRM;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
Future<JsConfirmResponseAction> createConfirmDialog(BuildContext context, String message) async {
|
||||
JsConfirmResponseAction action;
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
content: Text(message),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Cancel"),
|
||||
onPressed: () {
|
||||
action = JsConfirmResponseAction.CANCEL;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("Ok"),
|
||||
onPressed: () {
|
||||
action = JsConfirmResponseAction.CONFIRM;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
Future<JsPromptResponseAction> createPromptDialog(BuildContext context, String message) async {
|
||||
JsPromptResponseAction action;
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(message),
|
||||
content: TextField(
|
||||
controller: _textFieldController,
|
||||
),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
child: Text("Cancel"),
|
||||
onPressed: () {
|
||||
action = JsPromptResponseAction.CANCEL;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("Ok"),
|
||||
onPressed: () {
|
||||
action = JsPromptResponseAction.CONFIRM;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
Future<String> _findLocalPath() async {
|
||||
final directory = Platform.isAndroid
|
||||
? await getExternalStorageDirectory()
|
||||
: await getApplicationDocumentsDirectory();
|
||||
return directory.path;
|
||||
}
|
||||
}
|
|
@ -3,9 +3,9 @@ import 'dart:async';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||
import 'package:flutter_inappbrowser_example/chrome_safari_example.screen.dart';
|
||||
import 'package:flutter_inappbrowser_example/inline_example.screen.dart';
|
||||
import 'package:flutter_inappbrowser_example/webview_example.screen.dart';
|
||||
import 'package:flutter_inappbrowser_example/chrome_safari_browser_example.screen.dart';
|
||||
import 'package:flutter_inappbrowser_example/in_app_webiew_example.screen.dart';
|
||||
import 'package:flutter_inappbrowser_example/in_app_browser_example.screen.dart';
|
||||
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
@ -39,32 +39,12 @@ class _MyAppState extends State<MyApp> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: DefaultTabController(
|
||||
length: 3,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Tabs Demo'),
|
||||
),
|
||||
body: TabBarView(
|
||||
children: [
|
||||
WebviewExampleScreen(),
|
||||
ChromeSafariExampleScreen(),
|
||||
InlineExampleScreen(),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
color: Theme.of(context).primaryColor,
|
||||
child: TabBar(
|
||||
indicatorColor: Colors.white,
|
||||
tabs: [
|
||||
Tab(text: "Webview"),
|
||||
Tab(text: "Chrome/Safari"),
|
||||
Tab(
|
||||
text: "Inline",
|
||||
),
|
||||
],
|
||||
),
|
||||
))),
|
||||
initialRoute: '/',
|
||||
routes: {
|
||||
'/': (context) => InAppWebViewExampleScreen(),
|
||||
'/InAppBrowser': (context) => InAppBrowserExampleScreen(),
|
||||
'/ChromeSafariBrowser': (context) => ChromeSafariBrowserExampleScreen(),
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||
|
||||
class MyInAppBrowser extends InAppBrowser {
|
||||
|
||||
@override
|
||||
Future onBrowserCreated() async {
|
||||
print("\n\nBrowser Ready!\n\n");
|
||||
}
|
||||
|
||||
@override
|
||||
Future onLoadStart(String url) async {
|
||||
print("\n\nStarted $url\n\n");
|
||||
}
|
||||
|
||||
@override
|
||||
Future onLoadStop(String url) async {
|
||||
print("\n\nStopped $url\n\n");
|
||||
}
|
||||
|
||||
@override
|
||||
Future onScrollChanged(int x, int y) async {
|
||||
print("Scrolled: x:$x y:$y");
|
||||
}
|
||||
|
||||
@override
|
||||
void onLoadError(String url, int code, String message) {
|
||||
print("Can't load $url.. Error: $message");
|
||||
}
|
||||
|
||||
@override
|
||||
void onProgressChanged(int progress) {
|
||||
print("Progress: $progress");
|
||||
}
|
||||
|
||||
@override
|
||||
void onExit() {
|
||||
print("\n\nBrowser closed!\n\n");
|
||||
}
|
||||
|
||||
@override
|
||||
void shouldOverrideUrlLoading(String url) {
|
||||
print("\n\n override $url\n\n");
|
||||
this.webViewController.loadUrl(url: url);
|
||||
}
|
||||
|
||||
@override
|
||||
void onLoadResource(LoadedResource response) {
|
||||
print("Started at: " +
|
||||
response.startTime.toString() +
|
||||
"ms ---> duration: " +
|
||||
response.duration.toString() +
|
||||
"ms " +
|
||||
response.url);
|
||||
}
|
||||
|
||||
@override
|
||||
void onConsoleMessage(ConsoleMessage consoleMessage) {
|
||||
print("""
|
||||
console output:
|
||||
message: ${consoleMessage.message}
|
||||
messageLevel: ${consoleMessage.messageLevel.toValue()}
|
||||
""");
|
||||
}
|
||||
|
||||
@override
|
||||
void onDownloadStart(String url) {
|
||||
print("Download of " + url);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CustomSchemeResponse> onLoadResourceCustomScheme(String scheme, String url) async {
|
||||
print("custom scheme: " + scheme);
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GeolocationPermissionShowPromptResponse> onGeolocationPermissionsShowPrompt(String origin) async {
|
||||
print("request Geolocation permission API");
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<JsAlertResponse> onJsAlert(String message) async {
|
||||
return new JsAlertResponse(handledByClient: false, message: "coma iam");
|
||||
}
|
||||
|
||||
@override
|
||||
Future<JsConfirmResponse> onJsConfirm(String message) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<JsPromptResponse> onJsPrompt(String message, String defaultValue) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class WebviewExampleScreen extends StatefulWidget {
|
||||
final MyInAppBrowser browser = new MyInAppBrowser();
|
||||
static BuildContext context;
|
||||
|
||||
@override
|
||||
_WebviewExampleScreenState createState() => new _WebviewExampleScreenState();
|
||||
}
|
||||
|
||||
class _WebviewExampleScreenState extends State<WebviewExampleScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
WebviewExampleScreen.context = context;
|
||||
return new Center(
|
||||
child: new RaisedButton(
|
||||
onPressed: () {
|
||||
widget.browser.openFile(
|
||||
assetFilePath: "assets/index.html",
|
||||
//url: "https://www.google.com/",
|
||||
options: InAppBrowserClassOptions(
|
||||
inAppWebViewWidgetOptions: InAppWebViewWidgetOptions(
|
||||
inAppWebViewOptions: InAppWebViewOptions(
|
||||
useShouldOverrideUrlLoading: true,
|
||||
useOnLoadResource: true,
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
},
|
||||
child: Text("Open Webview Browser")),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -687,6 +687,8 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
|||
var currentURL: URL?
|
||||
var startPageTime: Int64 = 0
|
||||
static var credentialsProposed: [URLCredential] = []
|
||||
var lastScrollX: CGFloat = 0
|
||||
var lastScrollY: CGFloat = 0
|
||||
|
||||
init(frame: CGRect, configuration: WKWebViewConfiguration, IABController: InAppBrowserWebViewController?, IAWController: FlutterWebViewController?) {
|
||||
|
||||
|
@ -843,6 +845,8 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
|||
|
||||
scrollView.showsVerticalScrollIndicator = (options?.verticalScrollBarEnabled)!
|
||||
scrollView.showsHorizontalScrollIndicator = (options?.horizontalScrollBarEnabled)!
|
||||
scrollView.showsVerticalScrollIndicator = !(options?.disableVerticalScroll)!
|
||||
scrollView.showsHorizontalScrollIndicator = !(options?.disableHorizontalScroll)!
|
||||
|
||||
// options.debuggingEnabled is always enabled for iOS.
|
||||
|
||||
|
@ -1137,6 +1141,13 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
|||
scrollView.showsHorizontalScrollIndicator = newOptions.horizontalScrollBarEnabled
|
||||
}
|
||||
|
||||
if newOptionsMap["disableVerticalScroll"] != nil && options?.disableVerticalScroll != newOptions.disableVerticalScroll {
|
||||
scrollView.showsVerticalScrollIndicator = !newOptions.disableVerticalScroll
|
||||
}
|
||||
if newOptionsMap["disableHorizontalScroll"] != nil && options?.disableHorizontalScroll != newOptions.disableHorizontalScroll {
|
||||
scrollView.showsHorizontalScrollIndicator = !newOptions.disableHorizontalScroll
|
||||
}
|
||||
|
||||
if #available(iOS 9.0, *) {
|
||||
if newOptionsMap["allowsLinkPreview"] != nil && options?.allowsLinkPreview != newOptions.allowsLinkPreview {
|
||||
allowsLinkPreview = newOptions.allowsLinkPreview
|
||||
|
@ -1785,12 +1796,29 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
|||
}
|
||||
|
||||
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
let disableVerticalScroll = options?.disableVerticalScroll ?? false
|
||||
let disableHorizontalScroll = options?.disableHorizontalScroll ?? false
|
||||
if disableVerticalScroll && disableHorizontalScroll {
|
||||
scrollView.contentOffset = CGPoint(x: lastScrollX, y: lastScrollY);
|
||||
}
|
||||
else if disableVerticalScroll {
|
||||
if (scrollView.contentOffset.y >= 0 || scrollView.contentOffset.y < 0) {
|
||||
scrollView.contentOffset = CGPoint(x: scrollView.contentOffset.x, y: lastScrollY);
|
||||
}
|
||||
}
|
||||
else if disableHorizontalScroll {
|
||||
if (scrollView.contentOffset.x >= 0 || scrollView.contentOffset.x < 0) {
|
||||
scrollView.contentOffset = CGPoint(x: lastScrollX, y: scrollView.contentOffset.y);
|
||||
}
|
||||
}
|
||||
if navigationDelegate != nil {
|
||||
let x = Int(scrollView.contentOffset.x / scrollView.contentScaleFactor)
|
||||
let y = Int(scrollView.contentOffset.y / scrollView.contentScaleFactor)
|
||||
onScrollChanged(x: x, y: y)
|
||||
}
|
||||
setNeedsLayout()
|
||||
lastScrollX = scrollView.contentOffset.x
|
||||
lastScrollY = scrollView.contentOffset.y
|
||||
}
|
||||
|
||||
public func onLoadStart(url: String) {
|
||||
|
|
|
@ -32,6 +32,8 @@ public class InAppWebViewOptions: Options {
|
|||
var incognito = false
|
||||
var cacheEnabled = true
|
||||
var transparentBackground = false
|
||||
var disableVerticalScroll = false
|
||||
var disableHorizontalScroll = false
|
||||
|
||||
var disallowOverScroll = false
|
||||
var enableViewportScale = false
|
||||
|
|
|
@ -101,12 +101,17 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti
|
|||
bool cacheEnabled;
|
||||
///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`.
|
||||
bool transparentBackground;
|
||||
///Set to `true` to disable vertical scroll. The default value is `false`.
|
||||
bool disableVerticalScroll;
|
||||
///Set to `true` to disable horizontal scroll. The default value is `false`.
|
||||
bool disableHorizontalScroll;
|
||||
|
||||
InAppWebViewOptions({this.useShouldOverrideUrlLoading = false, this.useOnLoadResource = false, this.useOnDownloadStart = false, this.useOnTargetBlank = false,
|
||||
this.clearCache = false, this.userAgent = "", this.applicationNameForUserAgent = "", this.javaScriptEnabled = true, this.debuggingEnabled = false, this.javaScriptCanOpenWindowsAutomatically = false,
|
||||
this.mediaPlaybackRequiresUserGesture = true, this.minimumFontSize, this.verticalScrollBarEnabled = true, this.horizontalScrollBarEnabled = true,
|
||||
this.resourceCustomSchemes = const [], this.contentBlockers = const [], this.preferredContentMode = InAppWebViewUserPreferredContentMode.RECOMMENDED,
|
||||
this.useShouldInterceptAjaxRequest = false, this.useShouldInterceptFetchRequest = false, this.incognito = false, this.cacheEnabled = true, this.transparentBackground = false}) {
|
||||
this.useShouldInterceptAjaxRequest = false, this.useShouldInterceptFetchRequest = false, this.incognito = false, this.cacheEnabled = true, this.transparentBackground = false,
|
||||
this.disableVerticalScroll = false, this.disableHorizontalScroll = false}) {
|
||||
if (this.minimumFontSize == null)
|
||||
this.minimumFontSize = Platform.isAndroid ? 8 : 0;
|
||||
assert(!this.resourceCustomSchemes.contains("http") && !this.resourceCustomSchemes.contains("https"));
|
||||
|
@ -140,7 +145,9 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti
|
|||
"useShouldInterceptFetchRequest": useShouldInterceptFetchRequest,
|
||||
"incognito": incognito,
|
||||
"cacheEnabled": cacheEnabled,
|
||||
"transparentBackground": transparentBackground
|
||||
"transparentBackground": transparentBackground,
|
||||
"disableVerticalScroll": disableVerticalScroll,
|
||||
"disableHorizontalScroll": disableHorizontalScroll
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -178,6 +185,8 @@ class InAppWebViewOptions implements WebViewOptions, BrowserOptions, AndroidOpti
|
|||
options.incognito = map["incognito"];
|
||||
options.cacheEnabled = map["cacheEnabled"];
|
||||
options.transparentBackground = map["transparentBackground"];
|
||||
options.disableVerticalScroll = map["disableVerticalScroll"];
|
||||
options.disableHorizontalScroll = map["disableHorizontalScroll"];
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue