feat: webview registration

This commit is contained in:
BLoC
2025-02-17 12:32:09 +03:00
parent bd519da491
commit 66e2578619
19 changed files with 1429 additions and 158 deletions

View File

@@ -0,0 +1,45 @@
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),
),
);
}
}