Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Flutter Inappwebview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
Flutter Inappwebview
Commits
ef8d0d1f
Commit
ef8d0d1f
authored
Nov 25, 2019
by
Lorenzo Pichilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #190 keyboard not showing on the second or more created webviews
parent
ec47b191
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
206 additions
and
1203 deletions
+206
-1203
.idea/workspace.xml
.idea/workspace.xml
+126
-211
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java
.../pichillilorenzo/flutter_inappbrowser/FlutterWebView.java
+3
-5
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebViewFactory.java
...lilorenzo/flutter_inappbrowser/FlutterWebViewFactory.java
+1
-1
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java
...renzo/flutter_inappbrowser/InAppWebView/InAppWebView.java
+2
-2
example/lib/in_app_webiew_example.screen.dart
example/lib/in_app_webiew_example.screen.dart
+69
-506
example/lib/test.dart
example/lib/test.dart
+0
-473
lib/src/in_app_webview.dart
lib/src/in_app_webview.dart
+5
-5
No files found.
.idea/workspace.xml
View file @
ef8d0d1f
...
...
@@ -15,52 +15,13 @@
</component>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"9b41f7a2-a71e-4923-91fb-249d7815b3e7"
name=
"Default"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/example/test_assets/in_app_webview_on_navigation_state_change_test.html"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_content_blocker_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_cookie_manager_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_http_auth_credential_database_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_initial_data_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_find_result_received_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_error_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_http_error_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_navigation_state_change_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_progress_changed_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_scroll_changed_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_ssl_request_test.dart"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/test.sh"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/tool/env.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.github/ISSUE_TEMPLATE/BUG_REPORT.md"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.github/ISSUE_TEMPLATE/BUG_REPORT.md"
afterDir=
"false"
/>
<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$/example/ios/Flutter/flutter_export_environment.sh"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/ios/Flutter/flutter_export_environment.sh"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebViewFactory.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebViewFactory.java"
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$/example/lib/in_app_webiew_example.screen.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/pubspec.yaml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/pubspec.yaml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_assets/in_app_webview_ajax_test.html"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_assets/in_app_webview_fetch_test.html"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_assets/in_app_webview_on_download_start_test.html"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/app.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/app.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/app_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/app_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/custom_widget_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/custom_widget_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_ajax_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_ajax_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_fetch_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_fetch_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_initial_file_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_initial_file_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_javascript_handler_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_javascript_handler_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_console_message_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_console_message_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_download_start_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_download_start_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_js_dialog_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_js_dialog_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_custom_scheme_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_custom_scheme_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_received_http_auth_request_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_received_http_auth_request_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_safe_browsing_hit_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_safe_browsing_hit_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_target_blank_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_target_blank_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_should_override_url_loading_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/in_app_webview_should_override_url_loading_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/main_test.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/example/test_driver/main_test.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/test_driver/util_test.dart"
beforeDir=
"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/types.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/lib/src/types.dart"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/example/lib/test.dart"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/lib/src/in_app_webview.dart"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/lib/src/in_app_webview.dart"
afterDir=
"false"
/>
</list>
<ignored
path=
"$PROJECT_DIR$/.dart_tool/"
/>
<ignored
path=
"$PROJECT_DIR$/.idea/"
/>
...
...
@@ -81,12 +42,12 @@
<component
name=
"FileEditorManager"
>
<leaf
SIDE_TABS_SIZE_LIMIT_KEY=
"300"
>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/lib/src/
types
.dart"
>
<entry
file=
"file://$PROJECT_DIR$/lib/src/
in_app_webview
.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
383
"
>
<caret
line=
"1
585"
column=
"9"
selection-start-line=
"1585"
selection-start-column=
"9"
selection-end-line=
"1585"
selection-end-column=
"9
"
/>
<state
relative-caret-position=
"
7854
"
>
<caret
line=
"1
362"
column=
"38"
selection-start-line=
"1362"
selection-start-column=
"38"
selection-end-line=
"1362"
selection-end-column=
"38
"
/>
<folding>
<element
signature=
"e#0#
20
#0"
expanded=
"true"
/>
<element
signature=
"e#0#
17
#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
...
...
@@ -95,8 +56,8 @@
<file
pinned=
"false"
current-in-tab=
"false"
>
<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=
"
420
"
>
<caret
line=
"
73"
column=
"23"
selection-start-line=
"73"
selection-start-column=
"23"
selection-end-line=
"73"
selection-end-column=
"23
"
/>
<state
relative-caret-position=
"
932
"
>
<caret
line=
"
111"
column=
"39"
lean-forward=
"true"
selection-start-line=
"111"
selection-start-column=
"39"
selection-end-line=
"111"
selection-end-column=
"39
"
/>
<folding>
<element
signature=
"e#0#20#0"
expanded=
"true"
/>
</folding>
...
...
@@ -105,46 +66,19 @@
</entry>
</file>
<file
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_http_error_test.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"94"
>
<caret
line=
"29"
column=
"38"
selection-start-line=
"29"
selection-start-column=
"38"
selection-end-line=
"29"
selection-end-column=
"38"
/>
<folding>
<element
signature=
"e#0#39#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
</file>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_console_message_test.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"492"
>
<caret
line=
"49"
column=
"22"
selection-start-line=
"45"
selection-start-column=
"20"
selection-end-line=
"49"
selection-end-column=
"22"
/>
<folding>
<element
signature=
"e#0#39#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
</file>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_error_test.dart"
>
<entry
file=
"file://$PROJECT_DIR$/example/pubspec.yaml"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"362"
>
<caret
line=
"50"
column=
"21"
selection-start-line=
"46"
selection-start-column=
"20"
selection-end-line=
"50"
selection-end-column=
"21"
/>
<folding>
<element
signature=
"e#0#39#0"
expanded=
"true"
/>
</folding>
<state
relative-caret-position=
"330"
>
<caret
line=
"22"
column=
"23"
lean-forward=
"true"
selection-start-line=
"22"
selection-start-column=
"23"
selection-end-line=
"22"
selection-end-column=
"23"
/>
</state>
</provider>
</entry>
</file>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/example/
test_driver/main_test
.dart"
>
<entry
file=
"file://$PROJECT_DIR$/example/
lib/main
.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
459
"
>
<caret
line=
"1
15"
column=
"25"
selection-start-line=
"115"
selection-start-column=
"16"
selection-end-line=
"115"
selection-end-column=
"25
"
/>
<state
relative-caret-position=
"
180
"
>
<caret
line=
"1
2"
column=
"3"
selection-start-line=
"12"
selection-start-column=
"3"
selection-end-line=
"12"
selection-end-column=
"3
"
/>
<folding>
<element
signature=
"e#0#20#0"
expanded=
"true"
/>
</folding>
...
...
@@ -152,29 +86,6 @@
</provider>
</entry>
</file>
<file
pinned=
"false"
current-in-tab=
"false"
>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/app.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state>
<folding>
<element
signature=
"e#0#54#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
</file>
<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=
"127"
>
<caret
line=
"503"
column=
"45"
selection-start-line=
"503"
selection-start-column=
"45"
selection-end-line=
"503"
selection-end-column=
"45"
/>
<folding>
<element
signature=
"e#35#55#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component
name=
"FileTemplateManagerImpl"
>
...
...
@@ -214,9 +125,9 @@
<find>
InAppWebViewOnProgressChangedTest
</find>
<find>
nextTest
</find>
<find>
clear
</find>
<find>
InAppWebViewOnScrollChangedTest
</find>
<find>
InAppWebViewOnConsoleMessageTest
</find>
<find>
Change:
</find>
<find>
InAppWebViewOnScrollChangedTest
</find>
</findStrings>
<replaceStrings>
<replace>
activity.getPreferences(0)
</replace>
...
...
@@ -234,12 +145,10 @@
<component
name=
"IdeDocumentHistory"
>
<option
name=
"CHANGED_PATHS"
>
<list>
<option
value=
"$PROJECT_DIR$/example/test_assets/in_app_webview_initial_file_test.html"
/>
<option
value=
"$PROJECT_DIR$/example/test_assets/in_app_webview_on_target_blank_test.html"
/>
<option
value=
"$PROJECT_DIR$/example/assets/index.html"
/>
<option
value=
"$PROJECT_DIR$/CHANGELOG.md"
/>
<option
value=
"$PROJECT_DIR$/lib/src/in_app_browser.dart"
/>
<option
value=
"$PROJECT_DIR$/lib/src/in_app_webview.dart"
/>
<option
value=
"$PROJECT_DIR$/example/lib/in_app_browser_example.screen.dart"
/>
<option
value=
"$PROJECT_DIR$/example/lib/chrome_safari_browser_example.screen.dart"
/>
<option
value=
"$PROJECT_DIR$/tool/env.dart"
/>
...
...
@@ -248,11 +157,9 @@
<option
value=
"$PROJECT_DIR$/test.sh"
/>
<option
value=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_navigation_change_test.dart"
/>
<option
value=
"$PROJECT_DIR$/example/test_assets/in_app_webview_on_navigation_state_change_test.html"
/>
<option
value=
"$PROJECT_DIR$/example/pubspec.yaml"
/>
<option
value=
"$PROJECT_DIR$/lib/src/content_blocker.dart"
/>
<option
value=
"$PROJECT_DIR$/lib/src/types.dart"
/>
<option
value=
"$PROJECT_DIR$/lib/src/cookie_manager.dart"
/>
<option
value=
"$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart"
/>
<option
value=
"$PROJECT_DIR$/example/test_driver/app.dart"
/>
<option
value=
"$PROJECT_DIR$/example/test_driver/util_test.dart"
/>
<option
value=
"$PROJECT_DIR$/lib/src/webview_options.dart"
/>
...
...
@@ -285,6 +192,10 @@
<option
value=
"$PROJECT_DIR$/example/test_driver/in_app_webview_ssl_request_test.dart"
/>
<option
value=
"$PROJECT_DIR$/example/test_driver/in_app_webview_http_auth_credential_database_test.dart"
/>
<option
value=
"$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_http_error_test.dart"
/>
<option
value=
"$PROJECT_DIR$/lib/src/in_app_webview.dart"
/>
<option
value=
"$PROJECT_DIR$/example/lib/main.dart"
/>
<option
value=
"$PROJECT_DIR$/example/lib/in_app_webiew_example.screen.dart"
/>
<option
value=
"$PROJECT_DIR$/example/pubspec.yaml"
/>
</list>
</option>
</component>
...
...
@@ -355,13 +266,7 @@
<item
name=
"flutter_inappbrowser"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"flutter_inappbrowser"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"example"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"test_assets"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"flutter_inappbrowser"
type=
"b2602c69:ProjectViewProjectNode"
/>
<item
name=
"flutter_inappbrowser"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"example"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"test_driver"
type=
"462c0819:PsiDirectoryNode"
/>
<item
name=
"lib"
type=
"462c0819:PsiDirectoryNode"
/>
</path>
<path>
<item
name=
"flutter_inappbrowser"
type=
"b2602c69:ProjectViewProjectNode"
/>
...
...
@@ -535,7 +440,7 @@
</todo-panel>
</component>
<component
name=
"ToolWindowManager"
>
<frame
x=
"0"
y=
"23"
width=
"1920"
height=
"1057"
extended-state=
"
6
"
/>
<frame
x=
"0"
y=
"23"
width=
"1920"
height=
"1057"
extended-state=
"
0
"
/>
<editor
active=
"true"
/>
<layout>
<window_info
content_ui=
"combo"
id=
"Project"
order=
"0"
sideWeight=
"0.6177474"
visible=
"true"
weight=
"0.20766774"
/>
...
...
@@ -557,7 +462,7 @@
<window_info
anchor=
"bottom"
id=
"Android Profiler"
order=
"7"
show_stripe_button=
"false"
/>
<window_info
anchor=
"bottom"
id=
"Event Log"
order=
"8"
sideWeight=
"0.50532484"
side_tool=
"true"
weight=
"0.35751295"
/>
<window_info
anchor=
"bottom"
id=
"Version Control"
order=
"9"
/>
<window_info
active=
"true"
anchor=
"bottom"
id=
"Terminal"
order=
"10"
sideWeight=
"0.4946752"
visible=
"true"
weight=
"0.
42279792
"
/>
<window_info
active=
"true"
anchor=
"bottom"
id=
"Terminal"
order=
"10"
sideWeight=
"0.4946752"
visible=
"true"
weight=
"0.
38860103
"
/>
<window_info
anchor=
"bottom"
id=
"Logcat"
order=
"11"
weight=
"0.32953367"
/>
<window_info
anchor=
"bottom"
id=
"Messages"
order=
"12"
sideWeight=
"0.4968051"
weight=
"0.33782384"
/>
<window_info
anchor=
"bottom"
id=
"Dependency Viewer"
order=
"13"
weight=
"0.32800853"
/>
...
...
@@ -587,37 +492,6 @@
</ignored-roots>
</component>
<component
name=
"editorHistoryManager"
>
<entry
file=
"file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_target_blank_test.html"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"180"
>
<caret
line=
"12"
column=
"60"
selection-end-line=
"15"
selection-end-column=
"7"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_load_resource_custom_scheme_test.html"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
/>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_js_dialog_test.html"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"270"
>
<caret
line=
"18"
column=
"7"
selection-start-line=
"18"
selection-start-column=
"7"
selection-end-line=
"18"
selection-end-column=
"7"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_download_start_test.html"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state>
<caret
selection-end-line=
"17"
selection-end-column=
"7"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/.env.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state>
<caret
column=
"54"
lean-forward=
"true"
selection-start-column=
"54"
selection-end-column=
"54"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_assets/in_app_webview_javascript_handler_test.html"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"90"
>
...
...
@@ -642,13 +516,6 @@
<entry
file=
"file://$PROJECT_DIR$/pubspec.yaml"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
/>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/pubspec.yaml"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"380"
>
<caret
line=
"58"
column=
"55"
selection-start-line=
"58"
selection-start-column=
"55"
selection-end-line=
"58"
selection-end-column=
"55"
/>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/test.sh"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"90"
>
...
...
@@ -680,19 +547,7 @@
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/util_test.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
/>
</entry>
<entry
file=
"file://$PROJECT_DIR$/lib/src/types.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"383"
>
<caret
line=
"1585"
column=
"9"
selection-start-line=
"1585"
selection-start-column=
"9"
selection-end-line=
"1585"
selection-end-column=
"9"
/>
<folding>
<element
signature=
"e#0#20#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/util_test.dart"
/>
<entry
file=
"file://$USER_HOME$/flutter/packages/flutter_driver/lib/src/driver/driver.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"177"
>
...
...
@@ -900,25 +755,6 @@
</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=
"459"
>
<caret
line=
"115"
column=
"25"
selection-start-line=
"115"
selection-start-column=
"16"
selection-end-line=
"115"
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/app.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state>
<folding>
<element
signature=
"e#0#54#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/.github/ISSUE_TEMPLATE/BUG_REPORT.md"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"180"
>
...
...
@@ -963,12 +799,86 @@
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/in_app_webview_http_auth_credential_database_test.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"455"
>
<caret
line=
"63"
column=
"84"
selection-start-line=
"63"
selection-start-column=
"84"
selection-end-line=
"63"
selection-end-column=
"84"
/>
<folding>
<element
signature=
"e#0#39#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_http_error_test.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"424"
>
<caret
line=
"51"
column=
"20"
lean-forward=
"true"
selection-start-line=
"51"
selection-start-column=
"20"
selection-end-line=
"51"
selection-end-column=
"20"
/>
<folding>
<element
signature=
"e#0#39#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_error_test.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"362"
>
<caret
line=
"50"
column=
"21"
selection-start-line=
"46"
selection-start-column=
"20"
selection-end-line=
"50"
selection-end-column=
"21"
/>
<folding>
<element
signature=
"e#0#39#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_console_message_test.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"492"
>
<caret
line=
"49"
column=
"22"
selection-start-line=
"45"
selection-start-column=
"20"
selection-end-line=
"49"
selection-end-column=
"22"
/>
<folding>
<element
signature=
"e#0#39#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/CHANGELOG.md"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"-164"
/>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/.packages"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
/>
</entry>
<entry
file=
"file://$PROJECT_DIR$/lib/src/types.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"416"
>
<caret
line=
"1585"
column=
"9"
selection-start-line=
"1585"
selection-start-column=
"9"
selection-end-line=
"1585"
selection-end-column=
"9"
/>
<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=
"535"
>
<caret
line=
"115"
column=
"25"
selection-start-line=
"115"
selection-start-column=
"16"
selection-end-line=
"115"
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/app.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state>
<folding>
<element
signature=
"e#0#54#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/test_driver/app_test.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
127
"
>
<state
relative-caret-position=
"
55
"
>
<caret
line=
"503"
column=
"45"
selection-start-line=
"503"
selection-start-column=
"45"
selection-end-line=
"503"
selection-end-column=
"45"
/>
<folding>
<element
signature=
"e#35#55#0"
expanded=
"true"
/>
...
...
@@ -976,56 +886,61 @@
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
example/lib/in_app_webiew_example.screen
.dart"
>
<entry
file=
"file://$PROJECT_DIR$/
lib/src/in_app_webview
.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
420
"
>
<caret
line=
"
73"
column=
"23"
selection-start-line=
"73"
selection-start-column=
"23"
selection-end-line=
"73"
selection-end-column=
"23
"
/>
<state
relative-caret-position=
"
7854
"
>
<caret
line=
"
1362"
column=
"38"
selection-start-line=
"1362"
selection-start-column=
"38"
selection-end-line=
"1362"
selection-end-column=
"38
"
/>
<folding>
<element
signature=
"e#0#
20
#0"
expanded=
"true"
/>
<element
signature=
"e#0#
17
#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/
test_driver/in_app_webview_http_auth_credential_database_
test.dart"
>
<entry
file=
"file://$PROJECT_DIR$/example/
lib/
test.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"455"
>
<caret
line=
"63"
column=
"84"
selection-start-line=
"63"
selection-start-column=
"84"
selection-end-line=
"63"
selection-end-column=
"84"
/>
<state
relative-caret-position=
"-5596"
>
<folding>
<element
signature=
"e#0#
39
#0"
expanded=
"true"
/>
<element
signature=
"e#0#
16431
#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/
example/test_driver/in_app_webview_on_load_error_test
.dart"
>
<entry
file=
"file://$PROJECT_DIR$/
lib/src/in_app_localhost_server
.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"362"
>
<caret
line=
"50"
column=
"21"
selection-start-line=
"46"
selection-start-column=
"20"
selection-end-line=
"50"
selection-end-column=
"21"
/>
<state
relative-caret-position=
"-845"
>
<folding>
<element
signature=
"e#0#
39
#0"
expanded=
"true"
/>
<element
signature=
"e#0#
17
#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/
test_driver/in_app_webview_on_console_message_test
.dart"
>
<entry
file=
"file://$PROJECT_DIR$/example/
lib/main
.dart"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
492
"
>
<caret
line=
"
49"
column=
"22"
selection-start-line=
"45"
selection-start-column=
"20"
selection-end-line=
"49"
selection-end-column=
"22
"
/>
<state
relative-caret-position=
"
180
"
>
<caret
line=
"
12"
column=
"3"
selection-start-line=
"12"
selection-start-column=
"3"
selection-end-line=
"12"
selection-end-column=
"3
"
/>
<folding>
<element
signature=
"e#0#
39
#0"
expanded=
"true"
/>
<element
signature=
"e#0#
20
#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/
test_driver/in_app_webview_on_load_http_error_test
.dart"
>
<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=
"9
4
"
>
<caret
line=
"
29"
column=
"38"
selection-start-line=
"29"
selection-start-column=
"38"
selection-end-line=
"29"
selection-end-column=
"38
"
/>
<state
relative-caret-position=
"9
32
"
>
<caret
line=
"
111"
column=
"39"
lean-forward=
"true"
selection-start-line=
"111"
selection-start-column=
"39"
selection-end-line=
"111"
selection-end-column=
"39
"
/>
<folding>
<element
signature=
"e#0#
39
#0"
expanded=
"true"
/>
<element
signature=
"e#0#
20
#0"
expanded=
"true"
/>
</folding>
</state>
</provider>
</entry>
<entry
file=
"file://$PROJECT_DIR$/example/pubspec.yaml"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"330"
>
<caret
line=
"22"
column=
"23"
lean-forward=
"true"
selection-start-line=
"22"
selection-start-column=
"23"
selection-end-line=
"22"
selection-end-column=
"23"
/>
</state>
</provider>
</entry>
</component>
<component
name=
"masterDetails"
>
<states>
...
...
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java
View file @
ef8d0d1f
...
...
@@ -36,14 +36,12 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
public
final
MethodChannel
channel
;
public
final
Registrar
registrar
;
public
FlutterWebView
(
Registrar
registrar
,
int
id
,
HashMap
<
String
,
Object
>
params
,
View
containerView
)
{
public
FlutterWebView
(
Registrar
registrar
,
final
Context
context
,
int
id
,
HashMap
<
String
,
Object
>
params
,
View
containerView
)
{
this
.
registrar
=
registrar
;
this
.
activity
=
registrar
.
activity
();
DisplayListenerProxy
displayListenerProxy
=
new
DisplayListenerProxy
();
DisplayManager
displayManager
=
(
DisplayManager
)
this
.
registrar
.
context
().
getSystemService
(
Context
.
DISPLAY_SERVICE
);
DisplayManager
displayManager
=
(
DisplayManager
)
context
.
getSystemService
(
Context
.
DISPLAY_SERVICE
);
displayListenerProxy
.
onPreWebViewInitialization
(
displayManager
);
String
initialUrl
=
(
String
)
params
.
get
(
"initialUrl"
);
...
...
@@ -55,7 +53,7 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
InAppWebViewOptions
options
=
new
InAppWebViewOptions
();
options
.
parse
(
initialOptions
);
webView
=
new
InAppWebView
(
registrar
,
this
,
id
,
options
,
containerView
);
webView
=
new
InAppWebView
(
registrar
,
context
,
this
,
id
,
options
,
containerView
);
displayListenerProxy
.
onPostWebViewInitialization
(
displayManager
);
webView
.
prepare
();
...
...
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebViewFactory.java
View file @
ef8d0d1f
...
...
@@ -23,7 +23,7 @@ public class FlutterWebViewFactory extends PlatformViewFactory {
@Override
public
PlatformView
create
(
Context
context
,
int
id
,
Object
args
)
{
HashMap
<
String
,
Object
>
params
=
(
HashMap
<
String
,
Object
>)
args
;
return
new
FlutterWebView
(
registrar
,
id
,
params
,
containerView
);
return
new
FlutterWebView
(
registrar
,
context
,
id
,
params
,
containerView
);
}
}
android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java
View file @
ef8d0d1f
...
...
@@ -508,8 +508,8 @@ final public class InAppWebView extends InputAwareWebView {
super
(
context
,
attrs
,
defaultStyle
);
}
public
InAppWebView
(
PluginRegistry
.
Registrar
registrar
,
Object
obj
,
int
id
,
InAppWebViewOptions
options
,
View
containerView
)
{
super
(
registrar
.
activeContext
()
,
containerView
);
public
InAppWebView
(
PluginRegistry
.
Registrar
registrar
,
Context
context
,
Object
obj
,
int
id
,
InAppWebViewOptions
options
,
View
containerView
)
{
super
(
context
,
containerView
);
this
.
registrar
=
registrar
;
if
(
obj
instanceof
InAppBrowserActivity
)
this
.
inAppBrowserActivity
=
(
InAppBrowserActivity
)
obj
;
...
...
example/lib/in_app_webiew_example.screen.dart
View file @
ef8d0d1f
...
...
@@ -16,17 +16,6 @@ class InAppWebViewExampleScreen extends StatefulWidget {
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
=
""
;
...
...
@@ -48,24 +37,6 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
@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
(
...
...
@@ -120,339 +91,30 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
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",
initialUrl:
"https://flutter.dev/"
,
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://flutter.dev/"
]),
action:
ContentBlockerAction
(
type:
ContentBlockerActionType
.
BLOCK
))
]),
androidInAppWebViewOptions:
AndroidInAppWebViewOptions
(
databaseEnabled:
true
,
domStorageEnabled:
true
,
geolocationEnabled:
true
,
safeBrowsingEnabled:
true
,
//blockNetworkImage: true,
),
clearCache:
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(find: "InAppWebView");
//controller.findAllAsync(find: "InAppWebViewInitialFileTest");
print
(
await
controller
.
getFavicons
());
print
(
await
CookieManager
.
instance
().
getCookies
(
url:
url
));
//await CookieManager.instance().setCookie(url: url, name: "myCookie", value: "myValue");
//print(await CookieManager.instance().getCookies(url: url));
//await Future.delayed(const Duration(milliseconds: 2000));
//controller.scrollTo(x: 0, y: 500);
//await Future.delayed(const Duration(milliseconds: 2000));
//controller.scrollBy(x: 0, y: 150);
},
onScrollChanged:
(
InAppWebViewController
controller
,
int
x
,
int
y
)
{
//print("\nSCROLLED\n");
},
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>
"""
);
},
onLoadHttpError:
(
InAppWebViewController
controller
,
String
url
,
int
statusCode
,
String
description
)
async
{
print
(
"HTTP error
$url
:
$statusCode
,
$description
"
);
},
onProgressChanged:
(
InAppWebViewController
controller
,
int
progress
)
{
setState
(()
{
this
.
progress
=
progress
/
100
;
this
.
url
=
url
;
});
},
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
.
SHOW_INTERSTITIAL
;
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
.
PROCEED
,
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
"
);
onProgressChanged:
(
InAppWebViewController
controller
,
int
progress
)
{
setState
(()
{
this
.
url
=
url
;
this
.
progress
=
progress
/
100
;
});
},
),
...
...
@@ -489,103 +151,4 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
),
])));
}
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
;
}
}
example/lib/test.dart
deleted
100644 → 0
View file @
ec47b191
//import 'dart:async';
//import 'dart:convert';
//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");
//// print("\n\n ${await this.isHidden()} \n\n");
//// print(await this.webViewController.canGoBack());
//// print(await this.webViewController.canGoForward());
// }
//
// @override
// Future onLoadStop(String url) async {
// print("\n\nStopped $url\n\n");
//
//// print(base64.encode(await this.webViewController.getFavicon()));
//// WebHistory history = await this.webViewController.getCopyBackForwardList();
//// print(history.list.length);
//// print(history.currentIndex);
//// print(history.list[history.currentIndex].url);
//// for(WebHistoryItem item in history.list) {
//// print(item.title);
//// }
//
////
//// print(await this.webViewController.canGoBackOrForward(1));
//// if (await this.webViewController.canGoBackOrForward(-2)) {
//// this.webViewController.goTo(history.list[0]);
//// }
//
//// await this.webViewController.goBackOrForward(-1);
//
//// print(await this.webViewController.canGoBack());
//// print(await this.webViewController.canGoForward());
//
//// var screenshot = await this.webViewController.takeScreenshot();
//// await this.webViewController.injectScriptCode("""
//// document.body.innerHTML = '<img style="max-width: 100%; width: 100%" src="data:image/png;base64,${base64.encode(screenshot)}" />';
//// """);
//
//// var options = await this.getOptions();
//// if (options["javaScriptEnabled"]) {
//// await this.setOptions({
//// //"progressBar": true,
//// //"useOnLoadResource": true,
//// //"hidden": true,
//// //"toolbarTopFixedTitle": "Fixed title A",
//// //"useShouldOverrideUrlLoading": true
//// //"hideUrlBar": true,
//// "javaScriptEnabled": false,
//// "toolbarTop": true,
//// "toolbarBottom": false
//// });
//// }
//// else {
//// await this.setOptions({
//// //"progressBar": false,
//// //"useOnLoadResource": false,
//// //"hidden": true,
//// //"toolbarTopFixedTitle": "Fixed title B",
//// //"useShouldOverrideUrlLoading": true
//// //"hideUrlBar": false,
//// "javaScriptEnabled": true,
//// "toolbarTop": false,
//// "toolbarBottom": true
//// });
//// }
//
//// print("\n\n ${await this.isHidden()} \n\n");
////
//// await this.webViewController.injectScriptCode("window.flutter_inappbrowser.callHandler('handlerTest', 1, 5,'string', {'key': 5}, [4,6,8]);");
//// await this.webViewController.injectScriptCode("window.flutter_inappbrowser.callHandler('handlerTest2', false, null, undefined);");
//// await this.webViewController.injectScriptCode("setTimeout(function(){window.flutter_inappbrowser.callHandler('handlerTest', 'anotherString');}, 1000);");
//
//// await this.webViewController.injectScriptCode("console.log({'testObject': 5});");
//// await this.webViewController.injectScriptCode("console.warn('testWarn',null);");
//// await this.webViewController.injectScriptCode("console.log('testObjectStringify', JSON.stringify({'asd': 5}));");
//// await this.webViewController.injectScriptCode("console.info('testInfo', 6);");
//// await this.webViewController.injectScriptCode("console.error('testError', false);");
//// await this.webViewController.injectScriptCode("console.debug('testDebug', true);");
////
//// print(await this.webViewController.injectScriptCode("document.cookie"));
////
//// print("");
//// print(await CookieManager.getCookies(url));
//// print("");
//// print(await CookieManager.getCookie(url, "my_cookie2"));
//// print("");
//// await CookieManager.deleteCookie(url, "my_cookie2");
//// await CookieManager.deleteCookie(url, "_gid", domain: ".googleblog.com");
//// print("");
//// print(await CookieManager.getCookies(url));
//// print("");
//// await CookieManager.deleteCookies(url);
//// print("");
//// print(await CookieManager.getCookies(url));
//// print("");
//// await CookieManager.deleteAllCookies();
//// print("");
//// print(await CookieManager.getCookies(url));
//// print("");
////
//// print(await this.webViewController.injectScriptCode("null"));
//// print(await this.webViewController.injectScriptCode("undefined"));
//// print(await this.webViewController.injectScriptCode("3"));
//// print(await this.webViewController.injectScriptCode("""
//// function asd (a,b) {
//// return a+b;
//// };
//// asd(3,5);
//// """));
//// print(await this.webViewController.injectScriptCode("""
//// ["3",56,"sdf"];
//// """));
//// print(await this.webViewController.injectScriptCode("""
//// var x = {"as":4, "dfdfg": 6};
//// x;
//// """));
////
//// await this.webViewController.injectScriptFile("https://code.jquery.com/jquery-3.3.1.min.js");
//// this.webViewController.injectScriptCode("""
//// \$( "body" ).html( "Next Step..." )
//// """);
////
//// // add custom css
//// this.webViewController.injectStyleCode("""
//// body {
//// background-color: #3c3c3c !important;
//// }
//// """);
//// this.webViewController.injectStyleFile("https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css");
// }
//
// @override
// Future onScrollChanged(int x, int y) async {
//// print(x.toString() + " " + y.toString());
// }
//
// @override
// void onLoadError(String url, int code, String message) {
// print("\n\nCan't load $url.. Error: $message\n\n");
// }
//
// @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);
//
//// var postData = "username=my_username&password=my_password";
//// inAppBrowserFallback.webViewController.postUrl("http://localhost:8080", utf8.encode(postData));
//
//// var htmlData = """
////<!doctype html>
////<html lang="en">
////<head>
//// <meta charset="UTF-8">
//// <meta name="viewport"
//// content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
//// <meta http-equiv="X-UA-Compatible" content="ie=edge">
//// <title>Document</title>
//// <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
//// <link rel="stylesheet" href="http://localhost:8080/assets/css/style.css">
//// <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
////</head>
////<body>
////<div class="container">
//// <div class="container">
//// <img src="http://localhost:8080/assets/images/dart.svg" alt="dart logo">
//// <div class="row">
//// <div class="col-sm">
//// One of three columns
//// </div>
//// <div class="col-sm">
//// One of three columns
//// </div>
//// <div class="col-sm">
//// One of three columns
//// </div>
//// </div>
//// </div>
//// <script>
//// console.log("hello");
//// </script>
////</div>
////</body>
////</html>
//// """;
//// inAppBrowserFallback.webViewController.loadData(htmlData);
// }
//
// @override
// void onLoadResource(
// WebResourceResponse response, WebResourceRequest request) {
// print("Started at: " +
// response.startTime.toString() +
// "ms ---> duration: " +
// response.duration.toString() +
// "ms " +
// response.url);
//// if (response.headers["content-length"] != null)
//// print(response.headers["content-length"] + " length");
// }
//
// @override
// void onConsoleMessage(ConsoleMessage consoleMessage) {
// print(consoleMessage.message);
//// print("""
//// console output:
//// sourceURL: ${consoleMessage.sourceURL}
//// lineNumber: ${consoleMessage.lineNumber}
//// message: ${consoleMessage.message}
//// messageLevel: ${consoleMessage.messageLevel}
//// """);
// }
//}
//
//MyInAppBrowser inAppBrowserFallback = new MyInAppBrowser();
//
//class MyChromeSafariBrowser extends ChromeSafariBrowser {
// MyChromeSafariBrowser(browserFallback) : super(browserFallback);
//
// @override
// void onOpened() {
// print("ChromeSafari browser opened");
// }
//
// @override
// void onLoaded() {
// print("ChromeSafari browser loaded");
// }
//
// @override
// void onClosed() {
// print("ChromeSafari browser closed");
// }
//}
//
//// adding a webview fallback
//MyChromeSafariBrowser chromeSafariBrowser =
// new MyChromeSafariBrowser(inAppBrowserFallback);
//InAppLocalhostServer localhostServer = new InAppLocalhostServer();
//
//Future main() async {
//// await localhostServer.start();
// runApp(new MyApp());
//}
//
//class MyApp extends StatefulWidget {
// @override
// _MyAppState createState() => new _MyAppState();
//}
//
//class _MyAppState extends State<MyApp> {
// @override
// void initState() {
// super.initState();
//// int indexTest = inAppBrowserFallback.webViewController.addJavaScriptHandler("handlerTest",
//// (arguments) async {
//// print("handlerTest arguments");
//// print(arguments);
//// });
//// int indexTest2 = inAppBrowserFallback.webViewController.addJavaScriptHandler("test2", (arguments) async {
//// print("handlerTest2 arguments");
//// print(arguments);
//// inAppBrowserFallback.webViewController.removeJavaScriptHandler("test", indexTest);
//// });
// }
//
// @override
// Widget build(BuildContext context) {
// return new MaterialApp(
// home: new Scaffold(
// appBar: new AppBar(
// title: const Text('Flutter InAppBrowser Plugin example app'),
// ),
// body: new Center(
// child: new RaisedButton(
// onPressed: () async {
//// await chromeSafariBrowser.open("https://flutter.io/");
////
//// await InAppBrowser.openWithSystemBrowser("https://flutter.io/");
////
//// await inAppBrowserFallback.open(url: "http://localhost:8080/assets/index.html", options: {
//// "useOnLoadResource": true,
//// //"hidden": true,
//// //"toolbarTopFixedTitle": "Fixed title",
//// //"useShouldOverrideUrlLoading": true
//// //"hideUrlBar": true,
//// //"toolbarTop": false,
//// "toolbarBottom": false
//// });
////
//// await inAppBrowserFallback.openFile("assets/index.html", options: {
//// "useOnLoadResource": true,
//// //"hidden": true,
//// //"useShouldOverrideUrlLoading": true
//// //"hideUrlBar": true,
//// //"toolbarTop": false,
//// //"toolbarBottom": false
//// });
////
//// await CookieManager.setCookie("https://flutter.io/", "my_cookie2", "cookieValue2", domain: "flutter.io", expiresDate: 1540838864611);
//// await CookieManager.setCookie("https://flutter.io/", "my_cookie", "cookieValue", domain: "flutter.io", expiresDate: 1540838864611);
//
//// await inAppBrowserFallback.openData("<html><head><title>Data example</title></head><body><p>This is a \"p\" tag</p></body></html>", options: {});
//
// await inAppBrowserFallback.open(url: "https://flutter.io/", options: {
// //"useOnLoadResource": true,
// //"hidden": true,
// //"toolbarTopFixedTitle": "Fixed title",
// "useShouldOverrideUrlLoading": true,
// //"hideUrlBar": true,
// //"toolbarTop": false,
// //"toolbarBottom": false
// });
//
// },
// child: Text("Open InAppBrowser")
// ),
// ),
// ),
// );
// }
//}
// Inline WebView Example
import
'dart:async'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_inappbrowser/flutter_inappbrowser.dart'
;
Future
main
(
)
async
{
runApp
(
new
MyApp
());
}
class
MyApp
extends
StatefulWidget
{
@override
_MyAppState
createState
()
=>
new
_MyAppState
();
}
class
_MyAppState
extends
State
<
MyApp
>
{
InAppWebViewController
webView
;
String
url
=
""
;
double
progress
=
0
;
@override
void
initState
()
{
super
.
initState
();
}
@override
void
dispose
()
{
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Inline WebView example app'
),
),
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 }
"
),
),
(
progress
!=
1.0
)
?
LinearProgressIndicator
(
value:
progress
)
:
null
,
Expanded
(
child:
Container
(
margin:
const
EdgeInsets
.
all
(
10.0
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
Colors
.
blueAccent
)
),
child:
InAppWebView
(
initialUrl:
"https://flutter.io/"
,
//initialData: InAppWebViewInitialData("<html><head><title>Data example</title></head><body><p>This is a \"p\" tag</p></body></html>"),
initialHeaders:
{
},
initialOptions:
InAppWebViewWidgetOptions
(),
onWebViewCreated:
(
InAppWebViewController
controller
)
{
webView
=
controller
;
},
onLoadStart:
(
InAppWebViewController
controller
,
String
url
)
{
print
(
"started
$url
"
);
setState
(()
{
this
.
url
=
url
;
});
},
onProgressChanged:
(
InAppWebViewController
controller
,
int
progress
)
{
setState
(()
{
this
.
progress
=
progress
/
100
;
});
},
),
),
),
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
();
}
},
),
],
),
].
where
((
Object
o
)
=>
o
!=
null
).
toList
(),
),
),
bottomNavigationBar:
BottomNavigationBar
(
currentIndex:
0
,
items:
[
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
home
),
title:
Text
(
'Home'
),
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
mail
),
title:
Text
(
'Item 2'
),
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
person
),
title:
Text
(
'Item 3'
)
)
],
),
),
);
}
}
lib/src/in_app_webview.dart
View file @
ef8d0d1f
...
...
@@ -1284,7 +1284,7 @@ class InAppWebViewController {
///This should not be called if Safe Browsing has been disabled by manifest tag
///or [AndroidInAppWebViewOptions.safeBrowsingEnabled]. This prepares resources used for Safe Browsing.
///
///**NOTE**: available on
ly for Android
.
///**NOTE**: available on
Android 27+
.
Future
<
bool
>
startSafeBrowsing
()
async
{
Map
<
String
,
dynamic
>
args
=
<
String
,
dynamic
>{};
if
(
_inAppBrowserUuid
!=
null
&&
_inAppBrowser
!=
null
)
{
...
...
@@ -1308,7 +1308,7 @@ class InAppWebViewController {
///
///[hosts] represents the list of hosts. This value must never be null.
///
///**NOTE**: available on
ly for Android
.
///**NOTE**: available on
Android 27+
.
Future
<
bool
>
setSafeBrowsingWhitelist
({
@required
List
<
String
>
hosts
})
async
{
assert
(
hosts
!=
null
);
Map
<
String
,
dynamic
>
args
=
<
String
,
dynamic
>{};
...
...
@@ -1322,7 +1322,7 @@ class InAppWebViewController {
///Returns a URL pointing to the privacy policy for Safe Browsing reporting. This value will never be `null`.
///
///**NOTE**: available on
ly for Android
.
///**NOTE**: available on
Android 27+
.
Future
<
String
>
getSafeBrowsingPrivacyPolicyUrl
()
async
{
Map
<
String
,
dynamic
>
args
=
<
String
,
dynamic
>{};
if
(
_inAppBrowserUuid
!=
null
&&
_inAppBrowser
!=
null
)
{
...
...
@@ -1344,7 +1344,7 @@ class InAppWebViewController {
///Clears the SSL preferences table stored in response to proceeding with SSL certificate errors.
///
///**NOTE**: available only
for
Android.
///**NOTE**: available only
on
Android.
Future
<
void
>
clearSslPreferences
()
async
{
Map
<
String
,
dynamic
>
args
=
<
String
,
dynamic
>{};
if
(
_inAppBrowserUuid
!=
null
&&
_inAppBrowser
!=
null
)
{
...
...
@@ -1360,7 +1360,7 @@ class InAppWebViewController {
///
///**NOTE**: On iOS certificate-based credentials are never stored permanently.
///
///**NOTE**: available on
ly for Android
.
///**NOTE**: available on
Android 21+
.
Future
<
void
>
clearClientCertPreferences
()
async
{
Map
<
String
,
dynamic
>
args
=
<
String
,
dynamic
>{};
if
(
_inAppBrowserUuid
!=
null
&&
_inAppBrowser
!=
null
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment