import 'package:go_router/go_router.dart'; import '../pages/auth/login_page.dart'; import '../pages/home/home_page.dart'; import '../pages/chart/trend_page.dart'; import '../pages/medication/medication_list_page.dart'; import '../pages/report/report_pages.dart'; import '../pages/consultation/consultation_pages.dart'; import '../pages/settings/settings_pages.dart'; import '../pages/profile/profile_page.dart'; import '../pages/remaining_pages.dart'; /// 应用路由配置 class AppRouter { AppRouter._(); static final GoRouter router = GoRouter( initialLocation: '/login', routes: [ GoRoute(path: '/login', builder: (_, _) => const LoginPage()), GoRoute(path: '/home', builder: (_, _) => const HomePage()), GoRoute(path: '/trend/:type', builder: (_, state) => TrendPage(metricType: state.pathParameters['type']!)), GoRoute(path: '/calendar', builder: (_, _) => const HealthCalendarPage()), // 用药 GoRoute(path: '/medications', builder: (_, _) => const MedicationListPage()), GoRoute(path: '/medications/add', builder: (_, _) => const MedicationEditPage()), GoRoute(path: '/medications/:id/edit', builder: (_, state) => MedicationEditPage(id: state.pathParameters['id'])), // 报告 GoRoute(path: '/reports', builder: (_, _) => const ReportListPage()), GoRoute(path: '/reports/:id', builder: (_, state) => ReportDetailPage(id: state.pathParameters['id']!)), // 问诊 GoRoute(path: '/doctors', builder: (_, _) => const DoctorListPage()), GoRoute(path: '/consultation/:id', builder: (_, state) => DoctorChatPage(id: state.pathParameters['id']!)), // 运动 GoRoute(path: '/exercise-plan', builder: (_, _) => const ExercisePlanPage()), // 饮食 GoRoute(path: '/diet-records', builder: (_, _) => const DietRecordListPage()), // 个人中心 GoRoute(path: '/profile', builder: (_, _) => const ProfilePage()), GoRoute(path: '/profile/edit', builder: (_, _) => const EditProfilePage()), GoRoute(path: '/health-archive', builder: (_, _) => const HealthArchivePage()), // 复查 GoRoute(path: '/followups', builder: (_, _) => const FollowUpListPage()), // 设置 GoRoute(path: '/settings', builder: (_, _) => const SettingsPage()), GoRoute(path: '/settings/notifications', builder: (_, _) => const NotificationPrefsPage()), GoRoute(path: '/page/:type', builder: (_, state) => StaticTextPage(type: state.pathParameters['type']!)), ], ); }