import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:sino_med_cloud/features/main_tab_page.dart'; import '../features/auth/presentation/login_page.dart'; import '../features/MediaTestPage/presentation/media_test_page.dart'; class AppRouter { static final router = GoRouter( routes: [ GoRoute( path: '/', builder: (context, state) => const LoginPage(), ), GoRoute( path: '/mainTab', builder: (context, state) => const MainTabPage(), ), GoRoute( path: '/mediaTest', builder: (context, state) => const MediaTestPage(), ), ], errorBuilder: (context, state) => Scaffold( appBar: AppBar( title: const Text('页面未找到'), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon( Icons.error_outline, size: 64, color: Colors.grey, ), const SizedBox(height: 16), Text( '页面未找到: ${state.uri}', style: const TextStyle(fontSize: 16), ), const SizedBox(height: 16), ElevatedButton( onPressed: () => context.go('/'), child: const Text('返回首页'), ), ], ), ), ), ); }