第二次提交
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:maibu_satabot_v2/core/router/route_paths.dart';
|
||||
import 'package:maibu_satabot_v2/features/ai/presentation/routes/ai_routes.dart';
|
||||
import 'package:maibu_satabot_v2/features/auth/presentation/routes/auth_routes.dart';
|
||||
import 'package:maibu_satabot_v2/features/home/presentation/routes/home_routes.dart';
|
||||
import 'package:maibu_satabot_v2/features/my/presentation/routes/my_routes.dart';
|
||||
|
||||
import '../../features/auth/presentation/bloc/auth_cubit.dart';
|
||||
import '../../features/auth/presentation/bloc/auth_state.dart';
|
||||
import '../../features/auth/presentation/pages/login_page.dart';
|
||||
import '../../features/home/presentation/pages/home_page.dart';
|
||||
import '../../features/register/presentation/pages/register_page.dart';
|
||||
import '../../features/main_container/presentation/main_wrapper.dart';
|
||||
import 'go_router_refresh_stream.dart';
|
||||
|
||||
GoRouter createRouter(AuthCubit authCubit) {
|
||||
@@ -25,9 +27,27 @@ GoRouter createRouter(AuthCubit authCubit) {
|
||||
return null;
|
||||
},
|
||||
routes: [
|
||||
GoRoute(path: RoutePaths.login, builder: (_, __) => LoginPage()),
|
||||
GoRoute(path: RoutePaths.register, builder: (_, __) => RegisterPage()),
|
||||
GoRoute(path: RoutePaths.home, builder: (context, state) => HomePage()),
|
||||
// 1. 外部路由(无底部导航栏)
|
||||
...AuthRoutes.routes,
|
||||
...HomeRoutes.routes,
|
||||
...AiRoutes.routes,
|
||||
...MyRoutes.routes,
|
||||
|
||||
// 2. 内部路由(带底部导航栏的容器)
|
||||
StatefulShellRoute.indexedStack(
|
||||
builder: (context, state, navigationShell) {
|
||||
// 返回我们定义的 MainWrapper
|
||||
return MainWrapper(navigationShell: navigationShell);
|
||||
},
|
||||
branches: [
|
||||
// 拿一级页面
|
||||
HomeRoutes.branch,
|
||||
|
||||
AiRoutes.branch,
|
||||
|
||||
MyRoutes.branch,
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
class RoutePaths {
|
||||
static const login = '/auth';
|
||||
static const register = '/register';
|
||||
/// 账号相关页面
|
||||
static const login = '/auth/login';
|
||||
static const register = '/auth/register';
|
||||
|
||||
/// 一级页面
|
||||
static const home = '/home';
|
||||
static const ai = '/ai';
|
||||
static const my = '/my';
|
||||
|
||||
/// 二级页面
|
||||
// Home下子页面
|
||||
static const remoteControl = '/home/remote_control';
|
||||
static const routePlan = '/home/route_plan';
|
||||
static const runningStatus = '/home/running_status';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user