import 'package:go_router/go_router.dart'; import 'package:sunny_mochi/core/widgets/shell_scaffold.dart'; import 'package:flutter/material.dart'; import 'package:sunny_mochi/features/auth/presentation/pages/login_page.dart'; import 'package:sunny_mochi/features/dev_panel/presentation/pages/dev_panel_page.dart'; import 'package:sunny_mochi/features/error_report/presentation/error_report_page.dart'; part 'routes.g.dart'; // ── StatefulShellRoute(底部导航 2 Tab)───────────────────────────────────── @TypedStatefulShellRoute( branches: [ TypedStatefulShellBranch( routes: [TypedGoRoute(path: '/home')], ), TypedStatefulShellBranch( routes: [TypedGoRoute(path: '/mine')], ), ], ) class ShellRouteData extends StatefulShellRouteData { const ShellRouteData(); @override Widget builder( BuildContext context, GoRouterState state, StatefulNavigationShell shell, ) => ShellScaffold(shell: shell); } class HomeBranch extends StatefulShellBranchData { const HomeBranch(); } class MineBranch extends StatefulShellBranchData { const MineBranch(); } // ── Shell 叶子路由(TODO: 业务项目替换为真实页面)─────────────────────────── class HomeRoute extends GoRouteData with $HomeRoute { const HomeRoute(); @override Widget build(BuildContext context, GoRouterState state) => const Scaffold( body: Center(child: Text('Home — TODO: Replace with HomePage')), ); } class MineRoute extends GoRouteData with $MineRoute { const MineRoute(); @override Widget build(BuildContext context, GoRouterState state) => const Scaffold( body: Center(child: Text('Mine — TODO: Replace with MinePage')), ); } // ── 独立路由(Shell 之外)──────────────────────────────────────────────────── @TypedGoRoute(path: '/login') class LoginRoute extends GoRouteData with $LoginRoute { const LoginRoute(); @override Widget build(BuildContext context, GoRouterState state) => const LoginPage(); } @TypedGoRoute(path: '/dev') class DevPanelRoute extends GoRouteData with $DevPanelRoute { const DevPanelRoute(); @override Widget build(BuildContext context, GoRouterState state) => const DevPanelPage(); } @TypedGoRoute(path: '/error-report') class ErrorReportRoute extends GoRouteData with $ErrorReportRoute { const ErrorReportRoute(); @override Widget build(BuildContext context, GoRouterState state) => const ErrorReportPage(); }