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
0c71edf8
Commit
0c71edf8
authored
Jun 29, 2020
by
Lorenzo Pichilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flutter format
parent
eea69166
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
138 deletions
+116
-138
lib/src/headless_in_app_webview.dart
lib/src/headless_in_app_webview.dart
+21
-20
lib/src/in_app_browser.dart
lib/src/in_app_browser.dart
+0
-1
lib/src/in_app_webview.dart
lib/src/in_app_webview.dart
+21
-20
lib/src/in_app_webview_controller.dart
lib/src/in_app_webview_controller.dart
+37
-50
lib/src/types.dart
lib/src/types.dart
+19
-38
lib/src/webview.dart
lib/src/webview.dart
+18
-9
No files found.
lib/src/headless_in_app_webview.dart
View file @
0c71edf8
...
@@ -171,7 +171,7 @@ class HeadlessInAppWebView implements WebView {
...
@@ -171,7 +171,7 @@ class HeadlessInAppWebView implements WebView {
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
String
title
)
final
void
Function
(
InAppWebViewController
controller
,
String
title
)
onTitleChanged
;
onTitleChanged
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
...
@@ -201,20 +201,16 @@ class HeadlessInAppWebView implements WebView {
...
@@ -201,20 +201,16 @@ class HeadlessInAppWebView implements WebView {
CreateWindowRequest
onCreateWindowRequest
)
onCreateWindow
;
CreateWindowRequest
onCreateWindowRequest
)
onCreateWindow
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
onCloseWindow
;
onCloseWindow
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
onWindowFocus
;
onWindowFocus
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
onWindowBlur
;
onWindowBlur
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
androidOnRequestFocus
;
androidOnRequestFocus
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
String
url
)
final
void
Function
(
InAppWebViewController
controller
,
String
url
)
...
@@ -226,15 +222,18 @@ class HeadlessInAppWebView implements WebView {
...
@@ -226,15 +222,18 @@ class HeadlessInAppWebView implements WebView {
@override
@override
final
Future
<
JsAlertResponse
>
Function
(
final
Future
<
JsAlertResponse
>
Function
(
InAppWebViewController
controller
,
JsAlertRequest
jsAlertRequest
)
onJsAlert
;
InAppWebViewController
controller
,
JsAlertRequest
jsAlertRequest
)
onJsAlert
;
@override
@override
final
Future
<
JsConfirmResponse
>
Function
(
final
Future
<
JsConfirmResponse
>
Function
(
InAppWebViewController
controller
,
JsConfirmRequest
jsConfirmRequest
)
onJsConfirm
;
InAppWebViewController
controller
,
JsConfirmRequest
jsConfirmRequest
)
onJsConfirm
;
@override
@override
final
Future
<
JsPromptResponse
>
Function
(
InAppWebViewController
controller
,
final
Future
<
JsPromptResponse
>
Function
(
JsPromptRequest
jsPromptRequest
)
onJsPrompt
;
InAppWebViewController
controller
,
JsPromptRequest
jsPromptRequest
)
onJsPrompt
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
String
url
,
int
code
,
final
void
Function
(
InAppWebViewController
controller
,
String
url
,
int
code
,
...
@@ -352,18 +351,20 @@ class HeadlessInAppWebView implements WebView {
...
@@ -352,18 +351,20 @@ class HeadlessInAppWebView implements WebView {
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
Uint8List
icon
)
final
void
Function
(
InAppWebViewController
controller
,
Uint8List
icon
)
androidOnReceivedIcon
;
androidOnReceivedIcon
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
String
url
,
bool
precomposed
)
final
void
Function
(
androidOnReceivedTouchIconUrl
;
InAppWebViewController
controller
,
String
url
,
bool
precomposed
)
androidOnReceivedTouchIconUrl
;
@override
@override
final
Future
<
JsBeforeUnloadResponse
>
Function
(
final
Future
<
JsBeforeUnloadResponse
>
Function
(
InAppWebViewController
controller
,
JsBeforeUnloadRequest
jsBeforeUnloadRequest
)
InAppWebViewController
controller
,
androidOnJsBeforeUnload
;
JsBeforeUnloadRequest
jsBeforeUnloadRequest
)
androidOnJsBeforeUnload
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
LoginRequest
loginRequest
)
final
void
Function
(
androidOnReceivedLoginRequest
;
InAppWebViewController
controller
,
LoginRequest
loginRequest
)
androidOnReceivedLoginRequest
;
}
}
lib/src/in_app_browser.dart
View file @
0c71edf8
...
@@ -567,7 +567,6 @@ class InAppBrowser {
...
@@ -567,7 +567,6 @@ class InAppBrowser {
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String)
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String)
void
onTitleChanged
(
String
title
)
{}
void
onTitleChanged
(
String
title
)
{}
///Event fired when the WebView notifies that a loading URL has been flagged by Safe Browsing.
///Event fired when the WebView notifies that a loading URL has been flagged by Safe Browsing.
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
///
///
...
...
lib/src/in_app_webview.dart
View file @
0c71edf8
...
@@ -135,7 +135,7 @@ class InAppWebView extends StatefulWidget implements WebView {
...
@@ -135,7 +135,7 @@ class InAppWebView extends StatefulWidget implements WebView {
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
String
title
)
final
void
Function
(
InAppWebViewController
controller
,
String
title
)
onTitleChanged
;
onTitleChanged
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
...
@@ -165,28 +165,25 @@ class InAppWebView extends StatefulWidget implements WebView {
...
@@ -165,28 +165,25 @@ class InAppWebView extends StatefulWidget implements WebView {
CreateWindowRequest
onCreateWindowRequest
)
onCreateWindow
;
CreateWindowRequest
onCreateWindowRequest
)
onCreateWindow
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
onCloseWindow
;
onCloseWindow
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
onWindowFocus
;
onWindowFocus
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
onWindowBlur
;
onWindowBlur
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
)
final
void
Function
(
InAppWebViewController
controller
)
androidOnRequestFocus
;
androidOnRequestFocus
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
Uint8List
icon
)
final
void
Function
(
InAppWebViewController
controller
,
Uint8List
icon
)
androidOnReceivedIcon
;
androidOnReceivedIcon
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
String
url
,
bool
precomposed
)
final
void
Function
(
androidOnReceivedTouchIconUrl
;
InAppWebViewController
controller
,
String
url
,
bool
precomposed
)
androidOnReceivedTouchIconUrl
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
String
url
)
final
void
Function
(
InAppWebViewController
controller
,
String
url
)
...
@@ -198,15 +195,18 @@ class InAppWebView extends StatefulWidget implements WebView {
...
@@ -198,15 +195,18 @@ class InAppWebView extends StatefulWidget implements WebView {
@override
@override
final
Future
<
JsAlertResponse
>
Function
(
final
Future
<
JsAlertResponse
>
Function
(
InAppWebViewController
controller
,
JsAlertRequest
jsAlertRequest
)
onJsAlert
;
InAppWebViewController
controller
,
JsAlertRequest
jsAlertRequest
)
onJsAlert
;
@override
@override
final
Future
<
JsConfirmResponse
>
Function
(
final
Future
<
JsConfirmResponse
>
Function
(
InAppWebViewController
controller
,
JsConfirmRequest
jsConfirmRequest
)
onJsConfirm
;
InAppWebViewController
controller
,
JsConfirmRequest
jsConfirmRequest
)
onJsConfirm
;
@override
@override
final
Future
<
JsPromptResponse
>
Function
(
InAppWebViewController
controller
,
final
Future
<
JsPromptResponse
>
Function
(
JsPromptRequest
jsPromptRequest
)
onJsPrompt
;
InAppWebViewController
controller
,
JsPromptRequest
jsPromptRequest
)
onJsPrompt
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
String
url
,
int
code
,
final
void
Function
(
InAppWebViewController
controller
,
String
url
,
int
code
,
...
@@ -324,12 +324,13 @@ class InAppWebView extends StatefulWidget implements WebView {
...
@@ -324,12 +324,13 @@ class InAppWebView extends StatefulWidget implements WebView {
@override
@override
final
Future
<
JsBeforeUnloadResponse
>
Function
(
final
Future
<
JsBeforeUnloadResponse
>
Function
(
InAppWebViewController
controller
,
JsBeforeUnloadRequest
jsBeforeUnloadRequest
)
InAppWebViewController
controller
,
androidOnJsBeforeUnload
;
JsBeforeUnloadRequest
jsBeforeUnloadRequest
)
androidOnJsBeforeUnload
;
@override
@override
final
void
Function
(
InAppWebViewController
controller
,
LoginRequest
loginRequest
)
final
void
Function
(
androidOnReceivedLoginRequest
;
InAppWebViewController
controller
,
LoginRequest
loginRequest
)
androidOnReceivedLoginRequest
;
}
}
class
_InAppWebViewState
extends
State
<
InAppWebView
>
{
class
_InAppWebViewState
extends
State
<
InAppWebView
>
{
...
...
lib/src/in_app_webview_controller.dart
View file @
0c71edf8
...
@@ -228,36 +228,39 @@ class InAppWebViewController {
...
@@ -228,36 +228,39 @@ class InAppWebViewController {
if
(
_webview
!=
null
&&
_webview
.
onCreateWindow
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
onCreateWindow
!=
null
)
webView
=
await
_webview
.
onCreateWindow
(
this
,
createWindowRequest
);
webView
=
await
_webview
.
onCreateWindow
(
this
,
createWindowRequest
);
else
if
(
_inAppBrowser
!=
null
)
{
else
if
(
_inAppBrowser
!=
null
)
{
inAppBrowserWindow
=
await
_inAppBrowser
.
onCreateWindow
(
createWindowRequest
);
inAppBrowserWindow
=
await
_inAppBrowser
.
onCreateWindow
(
createWindowRequest
);
assert
(
assert
(
inAppBrowserWindow
is
InAppBrowser
||
inAppBrowserWindow
is
HeadlessInAppWebView
,
inAppBrowserWindow
is
InAppBrowser
||
"InAppBrowser.onCreateWindow should return an
\"
InAppBrowser
\"
instance or a
\"
HeadlessInAppWebView
\"
instance."
inAppBrowserWindow
is
HeadlessInAppWebView
,
);
"InAppBrowser.onCreateWindow should return an
\"
InAppBrowser
\"
instance or a
\"
HeadlessInAppWebView
\"
instance."
);
}
}
int
webViewWindowId
;
int
webViewWindowId
;
if
(
webView
!=
null
)
{
if
(
webView
!=
null
)
{
webViewWindowId
=
webView
.
windowId
;
webViewWindowId
=
webView
.
windowId
;
assert
(
webViewWindowId
!=
assert
(
null
,
"If you are returning a WebView, then WebView.windowId should be not null. To set the "
+
webViewWindowId
!=
null
,
"WebView.windowId property, you should use the CreateWindowRequest.windowId property."
);
"If you are returning a WebView, then WebView.windowId should be not null. To set the "
+
"WebView.windowId property, you should use the CreateWindowRequest.windowId property."
);
if
(
webView
is
HeadlessInAppWebView
)
{
if
(
webView
is
HeadlessInAppWebView
)
{
webView
.
run
();
webView
.
run
();
}
}
}
else
if
(
inAppBrowserWindow
!=
null
)
{
}
else
if
(
inAppBrowserWindow
!=
null
)
{
if
(
inAppBrowserWindow
is
InAppBrowser
)
{
if
(
inAppBrowserWindow
is
InAppBrowser
)
{
webViewWindowId
=
inAppBrowserWindow
.
windowId
;
webViewWindowId
=
inAppBrowserWindow
.
windowId
;
assert
(
webViewWindowId
!=
assert
(
null
,
"If you are returning an InAppBrowser, then InAppBrowser.windowId should be not null. To set the "
+
webViewWindowId
!=
null
,
"InAppBrowser.windowId property, you should use the CreateWindowRequest.windowId property."
);
"If you are returning an InAppBrowser, then InAppBrowser.windowId should be not null. To set the "
+
"InAppBrowser.windowId property, you should use the CreateWindowRequest.windowId property."
);
inAppBrowserWindow
.
openUrl
(
url:
"about:blank"
);
inAppBrowserWindow
.
openUrl
(
url:
"about:blank"
);
}
}
else
if
(
inAppBrowserWindow
is
HeadlessInAppWebView
)
{
else
if
(
inAppBrowserWindow
is
HeadlessInAppWebView
)
{
webViewWindowId
=
inAppBrowserWindow
.
windowId
;
webViewWindowId
=
inAppBrowserWindow
.
windowId
;
assert
(
webViewWindowId
!=
assert
(
null
,
"If you are returning a HeadlessInAppWebView, then HeadlessInAppWebView.windowId should be not null. To set the "
+
webViewWindowId
!=
null
,
"HeadlessInAppWebView.windowId property, you should use the CreateWindowRequest.windowId property."
);
"If you are returning a HeadlessInAppWebView, then HeadlessInAppWebView.windowId should be not null. To set the "
+
"HeadlessInAppWebView.windowId property, you should use the CreateWindowRequest.windowId property."
);
inAppBrowserWindow
.
run
();
inAppBrowserWindow
.
run
();
}
}
}
}
...
@@ -266,15 +269,13 @@ class InAppWebViewController {
...
@@ -266,15 +269,13 @@ class InAppWebViewController {
case
"onCloseWindow"
:
case
"onCloseWindow"
:
if
(
_webview
!=
null
&&
_webview
.
onCloseWindow
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
onCloseWindow
!=
null
)
_webview
.
onCloseWindow
(
this
);
_webview
.
onCloseWindow
(
this
);
else
if
(
_inAppBrowser
!=
null
)
else
if
(
_inAppBrowser
!=
null
)
_inAppBrowser
.
onCloseWindow
();
_inAppBrowser
.
onCloseWindow
();
break
;
break
;
case
"onTitleChanged"
:
case
"onTitleChanged"
:
String
title
=
call
.
arguments
[
"title"
];
String
title
=
call
.
arguments
[
"title"
];
if
(
_webview
!=
null
&&
_webview
.
onTitleChanged
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
onTitleChanged
!=
null
)
_webview
.
onTitleChanged
(
this
,
title
);
_webview
.
onTitleChanged
(
this
,
title
);
else
if
(
_inAppBrowser
!=
null
)
else
if
(
_inAppBrowser
!=
null
)
_inAppBrowser
.
onTitleChanged
(
title
);
_inAppBrowser
.
onTitleChanged
(
title
);
break
;
break
;
case
"onGeolocationPermissionsShowPrompt"
:
case
"onGeolocationPermissionsShowPrompt"
:
String
origin
=
call
.
arguments
[
"origin"
];
String
origin
=
call
.
arguments
[
"origin"
];
...
@@ -369,8 +370,7 @@ class InAppWebViewController {
...
@@ -369,8 +370,7 @@ class InAppWebViewController {
case
"onRequestFocus"
:
case
"onRequestFocus"
:
if
(
_webview
!=
null
&&
_webview
.
androidOnRequestFocus
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
androidOnRequestFocus
!=
null
)
_webview
.
androidOnRequestFocus
(
this
);
_webview
.
androidOnRequestFocus
(
this
);
else
if
(
_inAppBrowser
!=
null
)
else
if
(
_inAppBrowser
!=
null
)
_inAppBrowser
.
androidOnRequestFocus
();
_inAppBrowser
.
androidOnRequestFocus
();
break
;
break
;
case
"onReceivedIcon"
:
case
"onReceivedIcon"
:
Uint8List
icon
=
Uint8List
.
fromList
(
call
.
arguments
[
"icon"
].
cast
<
int
>());
Uint8List
icon
=
Uint8List
.
fromList
(
call
.
arguments
[
"icon"
].
cast
<
int
>());
...
@@ -394,10 +394,7 @@ class InAppWebViewController {
...
@@ -394,10 +394,7 @@ class InAppWebViewController {
bool
iosIsMainFrame
=
call
.
arguments
[
"iosIsMainFrame"
];
bool
iosIsMainFrame
=
call
.
arguments
[
"iosIsMainFrame"
];
JsAlertRequest
jsAlertRequest
=
JsAlertRequest
(
JsAlertRequest
jsAlertRequest
=
JsAlertRequest
(
url:
url
,
url:
url
,
message:
message
,
iosIsMainFrame:
iosIsMainFrame
);
message:
message
,
iosIsMainFrame:
iosIsMainFrame
);
if
(
_webview
!=
null
&&
_webview
.
onJsAlert
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
onJsAlert
!=
null
)
return
(
await
_webview
.
onJsAlert
(
this
,
jsAlertRequest
))?.
toMap
();
return
(
await
_webview
.
onJsAlert
(
this
,
jsAlertRequest
))?.
toMap
();
...
@@ -410,10 +407,7 @@ class InAppWebViewController {
...
@@ -410,10 +407,7 @@ class InAppWebViewController {
bool
iosIsMainFrame
=
call
.
arguments
[
"iosIsMainFrame"
];
bool
iosIsMainFrame
=
call
.
arguments
[
"iosIsMainFrame"
];
JsConfirmRequest
jsConfirmRequest
=
JsConfirmRequest
(
JsConfirmRequest
jsConfirmRequest
=
JsConfirmRequest
(
url:
url
,
url:
url
,
message:
message
,
iosIsMainFrame:
iosIsMainFrame
);
message:
message
,
iosIsMainFrame:
iosIsMainFrame
);
if
(
_webview
!=
null
&&
_webview
.
onJsConfirm
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
onJsConfirm
!=
null
)
return
(
await
_webview
.
onJsConfirm
(
this
,
jsConfirmRequest
))?.
toMap
();
return
(
await
_webview
.
onJsConfirm
(
this
,
jsConfirmRequest
))?.
toMap
();
...
@@ -430,15 +424,12 @@ class InAppWebViewController {
...
@@ -430,15 +424,12 @@ class InAppWebViewController {
url:
url
,
url:
url
,
message:
message
,
message:
message
,
defaultValue:
defaultValue
,
defaultValue:
defaultValue
,
iosIsMainFrame:
iosIsMainFrame
iosIsMainFrame:
iosIsMainFrame
);
);
if
(
_webview
!=
null
&&
_webview
.
onJsPrompt
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
onJsPrompt
!=
null
)
return
(
await
_webview
.
onJsPrompt
(
this
,
jsPromptRequest
))
return
(
await
_webview
.
onJsPrompt
(
this
,
jsPromptRequest
))?.
toMap
();
?.
toMap
();
else
if
(
_inAppBrowser
!=
null
)
else
if
(
_inAppBrowser
!=
null
)
return
(
await
_inAppBrowser
.
onJsPrompt
(
jsPromptRequest
))
return
(
await
_inAppBrowser
.
onJsPrompt
(
jsPromptRequest
))?.
toMap
();
?.
toMap
();
break
;
break
;
case
"onJsBeforeUnload"
:
case
"onJsBeforeUnload"
:
String
url
=
call
.
arguments
[
"url"
];
String
url
=
call
.
arguments
[
"url"
];
...
@@ -446,17 +437,18 @@ class InAppWebViewController {
...
@@ -446,17 +437,18 @@ class InAppWebViewController {
bool
iosIsMainFrame
=
call
.
arguments
[
"iosIsMainFrame"
];
bool
iosIsMainFrame
=
call
.
arguments
[
"iosIsMainFrame"
];
JsBeforeUnloadRequest
jsBeforeUnloadRequest
=
JsBeforeUnloadRequest
(
JsBeforeUnloadRequest
jsBeforeUnloadRequest
=
JsBeforeUnloadRequest
(
url:
url
,
url:
url
,
message:
message
,
iosIsMainFrame:
iosIsMainFrame
);
message:
message
,
iosIsMainFrame:
iosIsMainFrame
);
print
(
jsBeforeUnloadRequest
);
print
(
jsBeforeUnloadRequest
);
if
(
_webview
!=
null
&&
_webview
.
androidOnJsBeforeUnload
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
androidOnJsBeforeUnload
!=
null
)
return
(
await
_webview
.
androidOnJsBeforeUnload
(
this
,
jsBeforeUnloadRequest
))?.
toMap
();
return
(
await
_webview
.
androidOnJsBeforeUnload
(
this
,
jsBeforeUnloadRequest
))
?.
toMap
();
else
if
(
_inAppBrowser
!=
null
)
else
if
(
_inAppBrowser
!=
null
)
return
(
await
_inAppBrowser
.
androidOnJsBeforeUnload
(
jsBeforeUnloadRequest
))?.
toMap
();
return
(
await
_inAppBrowser
.
androidOnJsBeforeUnload
(
jsBeforeUnloadRequest
))
?.
toMap
();
break
;
break
;
case
"onSafeBrowsingHit"
:
case
"onSafeBrowsingHit"
:
String
url
=
call
.
arguments
[
"url"
];
String
url
=
call
.
arguments
[
"url"
];
...
@@ -475,11 +467,8 @@ class InAppWebViewController {
...
@@ -475,11 +467,8 @@ class InAppWebViewController {
String
account
=
call
.
arguments
[
"account"
];
String
account
=
call
.
arguments
[
"account"
];
String
args
=
call
.
arguments
[
"args"
];
String
args
=
call
.
arguments
[
"args"
];
LoginRequest
loginRequest
=
LoginRequest
(
LoginRequest
loginRequest
=
realm:
realm
,
LoginRequest
(
realm:
realm
,
account:
account
,
args:
args
);
account:
account
,
args:
args
);
if
(
_webview
!=
null
&&
_webview
.
androidOnReceivedLoginRequest
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
androidOnReceivedLoginRequest
!=
null
)
_webview
.
androidOnReceivedLoginRequest
(
this
,
loginRequest
);
_webview
.
androidOnReceivedLoginRequest
(
this
,
loginRequest
);
...
@@ -942,14 +931,12 @@ class InAppWebViewController {
...
@@ -942,14 +931,12 @@ class InAppWebViewController {
case
"onWindowFocus"
:
case
"onWindowFocus"
:
if
(
_webview
!=
null
&&
_webview
.
onWindowFocus
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
onWindowFocus
!=
null
)
_webview
.
onWindowFocus
(
this
);
_webview
.
onWindowFocus
(
this
);
else
if
(
_inAppBrowser
!=
null
)
else
if
(
_inAppBrowser
!=
null
)
_inAppBrowser
.
onWindowFocus
();
_inAppBrowser
.
onWindowFocus
();
return
null
;
return
null
;
case
"onWindowBlur"
:
case
"onWindowBlur"
:
if
(
_webview
!=
null
&&
_webview
.
onWindowBlur
!=
null
)
if
(
_webview
!=
null
&&
_webview
.
onWindowBlur
!=
null
)
_webview
.
onWindowBlur
(
this
);
_webview
.
onWindowBlur
(
this
);
else
if
(
_inAppBrowser
!=
null
)
else
if
(
_inAppBrowser
!=
null
)
_inAppBrowser
.
onWindowBlur
();
_inAppBrowser
.
onWindowBlur
();
return
null
;
return
null
;
}
}
...
...
lib/src/types.dart
View file @
0c71edf8
...
@@ -450,11 +450,7 @@ class JsAlertRequest {
...
@@ -450,11 +450,7 @@ class JsAlertRequest {
///Indicates whether the request was made for the main frame. Available only on iOS.
///Indicates whether the request was made for the main frame. Available only on iOS.
bool
iosIsMainFrame
;
bool
iosIsMainFrame
;
JsAlertRequest
({
JsAlertRequest
({
this
.
url
,
this
.
message
,
this
.
iosIsMainFrame
});
this
.
url
,
this
.
message
,
this
.
iosIsMainFrame
});
Map
<
String
,
dynamic
>
toMap
()
{
Map
<
String
,
dynamic
>
toMap
()
{
return
{
"url"
:
url
,
"message"
:
message
,
"iosIsMainFrame"
:
iosIsMainFrame
};
return
{
"url"
:
url
,
"message"
:
message
,
"iosIsMainFrame"
:
iosIsMainFrame
};
...
@@ -536,11 +532,7 @@ class JsConfirmRequest {
...
@@ -536,11 +532,7 @@ class JsConfirmRequest {
///Indicates whether the request was made for the main frame. Available only on iOS.
///Indicates whether the request was made for the main frame. Available only on iOS.
bool
iosIsMainFrame
;
bool
iosIsMainFrame
;
JsConfirmRequest
({
JsConfirmRequest
({
this
.
url
,
this
.
message
,
this
.
iosIsMainFrame
});
this
.
url
,
this
.
message
,
this
.
iosIsMainFrame
});
Map
<
String
,
dynamic
>
toMap
()
{
Map
<
String
,
dynamic
>
toMap
()
{
return
{
"url"
:
url
,
"message"
:
message
,
"iosIsMainFrame"
:
iosIsMainFrame
};
return
{
"url"
:
url
,
"message"
:
message
,
"iosIsMainFrame"
:
iosIsMainFrame
};
...
@@ -631,15 +623,16 @@ class JsPromptRequest {
...
@@ -631,15 +623,16 @@ class JsPromptRequest {
///Indicates whether the request was made for the main frame. Available only on iOS.
///Indicates whether the request was made for the main frame. Available only on iOS.
bool
iosIsMainFrame
;
bool
iosIsMainFrame
;
JsPromptRequest
({
JsPromptRequest
(
this
.
url
,
{
this
.
url
,
this
.
message
,
this
.
defaultValue
,
this
.
iosIsMainFrame
});
this
.
message
,
this
.
defaultValue
,
this
.
iosIsMainFrame
});
Map
<
String
,
dynamic
>
toMap
()
{
Map
<
String
,
dynamic
>
toMap
()
{
return
{
"url"
:
url
,
"message"
:
message
,
"defaultValue"
:
defaultValue
,
"iosIsMainFrame"
:
iosIsMainFrame
};
return
{
"url"
:
url
,
"message"
:
message
,
"defaultValue"
:
defaultValue
,
"iosIsMainFrame"
:
iosIsMainFrame
};
}
}
Map
<
String
,
dynamic
>
toJson
()
{
Map
<
String
,
dynamic
>
toJson
()
{
...
@@ -734,11 +727,7 @@ class JsBeforeUnloadRequest {
...
@@ -734,11 +727,7 @@ class JsBeforeUnloadRequest {
///Indicates whether the request was made for the main frame. Available only on iOS.
///Indicates whether the request was made for the main frame. Available only on iOS.
bool
iosIsMainFrame
;
bool
iosIsMainFrame
;
JsBeforeUnloadRequest
({
JsBeforeUnloadRequest
({
this
.
url
,
this
.
message
,
this
.
iosIsMainFrame
});
this
.
url
,
this
.
message
,
this
.
iosIsMainFrame
});
Map
<
String
,
dynamic
>
toMap
()
{
Map
<
String
,
dynamic
>
toMap
()
{
return
{
"url"
:
url
,
"message"
:
message
,
"iosIsMainFrame"
:
iosIsMainFrame
};
return
{
"url"
:
url
,
"message"
:
message
,
"iosIsMainFrame"
:
iosIsMainFrame
};
...
@@ -790,10 +779,10 @@ class JsBeforeUnloadResponse {
...
@@ -790,10 +779,10 @@ class JsBeforeUnloadResponse {
JsBeforeUnloadResponse
(
JsBeforeUnloadResponse
(
{
this
.
message
=
""
,
{
this
.
message
=
""
,
this
.
handledByClient
=
false
,
this
.
handledByClient
=
false
,
this
.
confirmButtonTitle
=
""
,
this
.
confirmButtonTitle
=
""
,
this
.
cancelButtonTitle
=
""
,
this
.
cancelButtonTitle
=
""
,
this
.
action
=
JsBeforeUnloadResponseAction
.
CONFIRM
});
this
.
action
=
JsBeforeUnloadResponseAction
.
CONFIRM
});
Map
<
String
,
dynamic
>
toMap
()
{
Map
<
String
,
dynamic
>
toMap
()
{
return
{
return
{
...
@@ -3151,7 +3140,7 @@ class CreateWindowRequest {
...
@@ -3151,7 +3140,7 @@ class CreateWindowRequest {
///The window id. Used by [WebView] to create a new WebView.
///The window id. Used by [WebView] to create a new WebView.
int
windowId
;
int
windowId
;
///Indicates if the new window should be a dialog, rather than a full-size window. Available only on Android.
///Indicates if the new window should be a dialog, rather than a full-size window. Available only on Android.
bool
androidIsDialog
;
bool
androidIsDialog
;
...
@@ -4376,18 +4365,10 @@ class LoginRequest {
...
@@ -4376,18 +4365,10 @@ class LoginRequest {
///Authenticator specific arguments used to log in the user.
///Authenticator specific arguments used to log in the user.
String
args
;
String
args
;
LoginRequest
({
LoginRequest
({
this
.
realm
,
this
.
account
,
this
.
args
});
this
.
realm
,
this
.
account
,
this
.
args
});
Map
<
String
,
dynamic
>
toMap
()
{
Map
<
String
,
dynamic
>
toMap
()
{
return
{
return
{
"realm"
:
realm
,
"account"
:
account
,
"args"
:
args
};
"realm"
:
realm
,
"account"
:
account
,
"args"
:
args
};
}
}
Map
<
String
,
dynamic
>
toJson
()
{
Map
<
String
,
dynamic
>
toJson
()
{
...
@@ -4398,4 +4379,4 @@ class LoginRequest {
...
@@ -4398,4 +4379,4 @@ class LoginRequest {
String
toString
()
{
String
toString
()
{
return
toMap
().
toString
();
return
toMap
().
toString
();
}
}
}
}
\ No newline at end of file
lib/src/webview.dart
View file @
0c71edf8
...
@@ -187,7 +187,8 @@ abstract class WebView {
...
@@ -187,7 +187,8 @@ abstract class WebView {
///
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview
final
Future
<
JsAlertResponse
>
Function
(
final
Future
<
JsAlertResponse
>
Function
(
InAppWebViewController
controller
,
JsAlertRequest
jsAlertRequest
)
onJsAlert
;
InAppWebViewController
controller
,
JsAlertRequest
jsAlertRequest
)
onJsAlert
;
///Event fired when javascript calls the `confirm()` method to display a confirm dialog.
///Event fired when javascript calls the `confirm()` method to display a confirm dialog.
///If [JsConfirmResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///If [JsConfirmResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
...
@@ -198,7 +199,8 @@ abstract class WebView {
...
@@ -198,7 +199,8 @@ abstract class WebView {
///
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview
final
Future
<
JsConfirmResponse
>
Function
(
final
Future
<
JsConfirmResponse
>
Function
(
InAppWebViewController
controller
,
JsConfirmRequest
jsConfirmRequest
)
onJsConfirm
;
InAppWebViewController
controller
,
JsConfirmRequest
jsConfirmRequest
)
onJsConfirm
;
///Event fired when javascript calls the `prompt()` method to display a prompt dialog.
///Event fired when javascript calls the `prompt()` method to display a prompt dialog.
///If [JsPromptResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
///If [JsPromptResponse.handledByClient] is `true`, the webview will assume that the client will handle the dialog.
...
@@ -208,8 +210,9 @@ abstract class WebView {
...
@@ -208,8 +210,9 @@ abstract class WebView {
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult)
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onJsPrompt(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20android.webkit.JsPromptResult)
///
///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview
final
Future
<
JsPromptResponse
>
Function
(
InAppWebViewController
controller
,
final
Future
<
JsPromptResponse
>
Function
(
JsPromptRequest
jsPromptRequest
)
onJsPrompt
;
InAppWebViewController
controller
,
JsPromptRequest
jsPromptRequest
)
onJsPrompt
;
///Event fired when the WebView received an HTTP authentication request. The default behavior is to cancel the request.
///Event fired when the WebView received an HTTP authentication request. The default behavior is to cancel the request.
///
///
...
@@ -381,7 +384,7 @@ abstract class WebView {
...
@@ -381,7 +384,7 @@ abstract class WebView {
///
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String)
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTitle(android.webkit.WebView,%20java.lang.String)
final
void
Function
(
InAppWebViewController
controller
,
String
title
)
final
void
Function
(
InAppWebViewController
controller
,
String
title
)
onTitleChanged
;
onTitleChanged
;
///Event fired when the webview notifies that a loading URL has been flagged by Safe Browsing.
///Event fired when the webview notifies that a loading URL has been flagged by Safe Browsing.
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
...
@@ -539,7 +542,8 @@ abstract class WebView {
...
@@ -539,7 +542,8 @@ abstract class WebView {
///**NOTE**: available only on Android.
///**NOTE**: available only on Android.
///
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap)
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap)
final
void
Function
(
InAppWebViewController
controller
,
Uint8List
icon
)
androidOnReceivedIcon
;
final
void
Function
(
InAppWebViewController
controller
,
Uint8List
icon
)
androidOnReceivedIcon
;
///Event fired when there is an url for an apple-touch-icon.
///Event fired when there is an url for an apple-touch-icon.
///
///
...
@@ -550,7 +554,9 @@ abstract class WebView {
...
@@ -550,7 +554,9 @@ abstract class WebView {
///**NOTE**: available only on Android.
///**NOTE**: available only on Android.
///
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean)
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean)
final
void
Function
(
InAppWebViewController
controller
,
String
url
,
bool
precomposed
)
androidOnReceivedTouchIconUrl
;
final
void
Function
(
InAppWebViewController
controller
,
String
url
,
bool
precomposed
)
androidOnReceivedTouchIconUrl
;
///Event fired when the client should display a dialog to confirm navigation away from the current page.
///Event fired when the client should display a dialog to confirm navigation away from the current page.
///This is the result of the `onbeforeunload` javascript event.
///This is the result of the `onbeforeunload` javascript event.
...
@@ -566,7 +572,8 @@ abstract class WebView {
...
@@ -566,7 +572,8 @@ abstract class WebView {
///
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onJsBeforeUnload(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onJsBeforeUnload(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)
final
Future
<
JsBeforeUnloadResponse
>
Function
(
final
Future
<
JsBeforeUnloadResponse
>
Function
(
InAppWebViewController
controller
,
JsBeforeUnloadRequest
jsBeforeUnloadRequest
)
androidOnJsBeforeUnload
;
InAppWebViewController
controller
,
JsBeforeUnloadRequest
jsBeforeUnloadRequest
)
androidOnJsBeforeUnload
;
///Event fired when a request to automatically log in the user has been processed.
///Event fired when a request to automatically log in the user has been processed.
///
///
...
@@ -575,7 +582,9 @@ abstract class WebView {
...
@@ -575,7 +582,9 @@ abstract class WebView {
///**NOTE**: available only on Android.
///**NOTE**: available only on Android.
///
///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedLoginRequest(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String)
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedLoginRequest(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String)
final
void
Function
(
InAppWebViewController
controller
,
LoginRequest
loginRequest
)
androidOnReceivedLoginRequest
;
final
void
Function
(
InAppWebViewController
controller
,
LoginRequest
loginRequest
)
androidOnReceivedLoginRequest
;
///Invoked when the web view's web content process is terminated.
///Invoked when the web view's web content process is terminated.
///
///
...
...
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