-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathandroid_ios.dart
49 lines (45 loc) · 1.39 KB
/
android_ios.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
part of openidconnect;
class OpenIdConnectAndroidiOS {
static Future<String> authorizeInteractive({
required BuildContext context,
required String title,
required String authorizationUrl,
required String redirectUrl,
required int popupWidth,
required int popupHeight,
}) async {
//Create the url
final result = await showDialog<String?>(
context: context,
barrierDismissible: false,
builder: (dialogContext) {
return AlertDialog(
actions: [
IconButton(
onPressed: () => Navigator.pop(dialogContext, null),
icon: Icon(Icons.close),
),
],
content: Container(
width:
min(popupWidth.toDouble(), MediaQuery.of(context).size.width),
height:
min(popupHeight.toDouble(), MediaQuery.of(context).size.height),
child: flutterWebView.WebView(
javascriptMode: flutterWebView.JavascriptMode.unrestricted,
initialUrl: authorizationUrl,
onPageFinished: (url) {
if (url.startsWith(redirectUrl)) {
Navigator.pop(dialogContext, url);
}
},
),
),
title: Text(title),
);
},
);
if (result == null) throw AuthenticationException(ERROR_USER_CLOSED);
return result;
}
}