第二次提交
This commit is contained in:
44
lib/features/home/presentation/routes/home_routes.dart
Normal file
44
lib/features/home/presentation/routes/home_routes.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:maibu_satabot_v2/features/home/presentation/pages/home_page.dart';
|
||||
|
||||
import '../../../../core/di/injection.dart';
|
||||
import '../../../../core/router/route_paths.dart';
|
||||
import '../../../remote_control/presentation/bloc/remote_control_cubit.dart';
|
||||
import '../../../remote_control/presentation/pages/remote_control_page.dart';
|
||||
import '../pages/route_plan_page.dart';
|
||||
import '../pages/running_status_page.dart';
|
||||
|
||||
class HomeRoutes {
|
||||
/// 1. 全屏功能页面(不带导航栏)
|
||||
/// 在 createRouter 的根 routes 中使用 ...HomeRoutes.routes 引入
|
||||
static List<RouteBase> get routes => [
|
||||
GoRoute(
|
||||
path: RoutePaths.remoteControl,
|
||||
builder: (context, state) => BlocProvider(
|
||||
// 每次进入该路由,都会创建一个全新的 Cubit 并开启循环
|
||||
create: (context) => sl<RemoteControlCubit>()..startControlLoop(),
|
||||
child: const RemoteControlPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: RoutePaths.routePlan,
|
||||
builder: (context, state) => const RoutePlanPage(),
|
||||
),
|
||||
GoRoute(
|
||||
path: RoutePaths.runningStatus,
|
||||
builder: (context, state) => const RunningStatusPage(),
|
||||
),
|
||||
];
|
||||
|
||||
/// 2. 首页 Tab 分支(带导航栏)
|
||||
/// 仅保留真正的首页入口
|
||||
static StatefulShellBranch get branch => StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: RoutePaths.home,
|
||||
builder: (context, state) => const HomePage(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user