This commit is contained in:
Levi committed 2025-04-10 22:28:41 +08:00
1 parent bfad91dcab
commit 2ab5a4bb53
143 files changed
+5722 -45

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import 'package:go_router/go_router.dart';
import '../modules/home/screens/home.dart';
import '../modules/task/screens/task.dart';
import '../modules/settings/screens/settings.dart';
import 'route_names.dart';
/// 应用路由配置
class AppRoutes {
/// 获取路由配置
static GoRouter getRouter() {
final GoRouter router = GoRouter(
initialLocation: RouteNames.task,
routes: [
ShellRoute(
builder: (context, state, child) => HomeScreen(child: child),
routes: [
GoRoute(
path: RouteNames.task,
builder: (context, state) => const TaskScreen(),
),
GoRoute(
path: RouteNames.settings,
builder: (context, state) => const SettingsScreen(),
),
],
),
],
);
return router;
}
// 防止实例化
AppRoutes._();
}
@@ -0,0 +1,8 @@
/// 定义应用中所有路由路径的常量
class RouteNames {
static const String task = '/task';
static const String settings = '/settings';
// 防止实例化
RouteNames._();
}