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.
49 lines
1.4 KiB
Dart
49 lines
1.4 KiB
Dart
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;
|
|
}
|