Files
ttstd_family_care/lib/app/router/app_router.dart
TongTongStudio 8478a99eba feat(auth): 对接后端 open 模块认证接口并完善登录页
- 更新接口路径、字段和短信验证码场景,新增忘记密码/重置密码流程
- 增加 401 自动刷新 token 与统一错误处理
- 重构登录页 UI,支持退出确认、协议与法律文档入口
2026-08-17 09:30:25 +08:00

75 lines
2.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:go_router/go_router.dart';
import '../../features/auth/presentation/login_page.dart';
import '../../features/auth/presentation/register_page.dart';
import '../../features/auth/presentation/forgot_password_page.dart';
import '../../features/auth/presentation/legal_document_page.dart';
import '../../features/auth/presentation/splash_page.dart';
import '../../features/home/presentation/home_page.dart';
import '../../features/home/presentation/home_tab.dart';
import '../../features/messages/presentation/messages_tab.dart';
import '../../features/profile/presentation/profile_tab.dart';
/// 应用路由定义(GoRouter)。
///
/// - /splash 启动页,依据登录态决定首跳
/// - /login /register 认证流程
/// - /home Shell 路由,承载底部 Tab(首页 / 消息 / 我的)
GoRouter buildAppRouter() {
return GoRouter(
initialLocation: '/splash',
routes: [
GoRoute(
path: '/splash',
builder: (context, state) => const SplashPage(),
),
GoRoute(
path: '/login',
builder: (context, state) => const LoginPage(),
),
GoRoute(
path: '/register',
builder: (context, state) => const RegisterPage(),
),
GoRoute(
path: '/forgot-password',
builder: (context, state) => const ForgotPasswordPage(),
),
GoRoute(
path: '/legal',
builder: (context, state) =>
LegalDocumentPage.fromExtra(state.extra),
),
StatefulShellRoute.indexedStack(
builder: (context, state, shell) => HomePage(child: shell),
branches: [
StatefulShellBranch(
routes: [
GoRoute(
path: '/home',
builder: (context, state) => const HomeTab(),
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/messages',
builder: (context, state) => const MessagesTab(),
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/profile',
builder: (context, state) => const ProfileTab(),
),
],
),
],
),
],
);
}