Deliver localized auth app with verification and go_router
Integrate themed login/signup, EN/RU localization, shared dummy providers, verification recovery screens and named URL routes. Store frontend guidelines, workflow skills, validation and delivery documentation. Related to #2, #3, #5 and #6.
This commit is contained in:
1 parent
27424ed886
commit
10a278c65a
44 files changed
+4128
-28
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../auth/page.dart';
|
||||
import '../verification/page.dart';
|
||||
import 'routes.dart';
|
||||
|
||||
GoRouter createAppRouter() => GoRouter(
|
||||
// Signup email is an in-memory navigation extra, never browser-history data.
|
||||
extraCodec: const _TransientExtras(),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/',
|
||||
name: AppRoutes.login,
|
||||
builder: (context, state) => const AuthPage(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/verification-sent',
|
||||
name: AppRoutes.verificationSent,
|
||||
builder: (context, state) => VerificationPage(
|
||||
email: state.extra is String ? state.extra as String : null,
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/verify-email',
|
||||
name: AppRoutes.verifyEmail,
|
||||
builder: (context, state) =>
|
||||
VerificationPage(token: state.uri.queryParameters['token'] ?? ''),
|
||||
),
|
||||
],
|
||||
// Preserve the existing fallback, and keep the visible URL canonical.
|
||||
onException: (context, state, router) => router.goNamed(AppRoutes.login),
|
||||
);
|
||||
|
||||
class _TransientExtras extends Codec<Object?, Object?> {
|
||||
const _TransientExtras();
|
||||
@override
|
||||
Converter<Object?, Object?> get encoder => const _DiscardExtra();
|
||||
@override
|
||||
Converter<Object?, Object?> get decoder => const _DiscardExtra();
|
||||
}
|
||||
|
||||
class _DiscardExtra extends Converter<Object?, Object?> {
|
||||
const _DiscardExtra();
|
||||
@override
|
||||
Object? convert(Object? input) => null;
|
||||
}
|
||||
Reference in new issue
Block a user