showModelSheetGoogle static method
Implementation
static Future<String> showModelSheetGoogle(BuildContext context,
String url,) async {
String token = '';
WebViewController controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate(
NavigationDelegate(
onProgress: (int progress) {
// Update loading bar.
},
onPageStarted: (String url) {},
onPageFinished: (String url) {},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith('https://auth.iblai.dev/login')) {
Navigator.of(context).pop();
token = Uri
.parse(request.url)
.queryParameters['token'] ?? "";
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
),
)
..loadRequest(Uri.parse(url));
await showModalBottomSheet(
context: context,
useSafeArea: true,
elevation: 4,
enableDrag: false,
isScrollControlled: true,
builder: (builder) {
return new Container(
height: MediaQuery
.of(context)
.size
.height * 0.85,
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0))),
child: WebViewWidget(controller: controller),
);
},
);
return token;
}