forked from eatvio/eatvio_app
46 lines
1.2 KiB
Dart
46 lines
1.2 KiB
Dart
import 'package:eatvio_app/core/const.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:webview_flutter/webview_flutter.dart';
|
|
|
|
class WebViewRegistrationScreen extends StatefulWidget {
|
|
const WebViewRegistrationScreen();
|
|
|
|
@override
|
|
State<WebViewRegistrationScreen> createState() => _WebViewRegistrationScreenState();
|
|
}
|
|
|
|
class _WebViewRegistrationScreenState extends State<WebViewRegistrationScreen> {
|
|
late final WebViewController _controller;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_controller = WebViewController()
|
|
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
|
..setNavigationDelegate(
|
|
NavigationDelegate(
|
|
onNavigationRequest: (NavigationRequest request) {
|
|
if (request.url.contains('profile')) {
|
|
GoRouter.of(context).go('authScreen');
|
|
}
|
|
return NavigationDecision.navigate;
|
|
},
|
|
),
|
|
)
|
|
..loadRequest(Uri.parse(baseUrl + '/registration/step1'));
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
toolbarHeight: 0,
|
|
),
|
|
body: SafeArea(
|
|
child: WebViewWidget(controller: _controller),
|
|
),
|
|
);
|
|
}
|
|
}
|