mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-15 12:53:41 +00:00
TEMP
This commit is contained in:
1 parent
bfad91dcab
commit
2ab5a4bb53
143 files changed
+5722
-45
No files matched your search
@@ -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._();
|
||||
}
|
||||
Reference in new issue
Block a user