2更新优化去除原有路径规划的初始化阶段的获取设备的接口请求,改为使用新的 targetDevice。 3修改无人机机场的在线状态简化为在线和离线。去掉机场二字。 4.更新同一账号同时段登录,被强制下线的友好提示!
98 lines
3.0 KiB
Dart
98 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import '../../../../core/app/app_user_cubit.dart';
|
|
import '../../../remote_control/presentation/bloc/remote_control_cubit.dart';
|
|
import '../widgets/map/test_amap_page.dart';
|
|
import '../widgets/map/testmap_pages.dart';
|
|
|
|
class RoutePlanPage extends StatelessWidget {
|
|
const RoutePlanPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
try {
|
|
// 🔥 修复:使用 RemoteControlCubit 的 targetDevice 作为唯一设备数据源
|
|
final userState = context.watch<AppUserCubit>().state;
|
|
final remoteControlState = context.watch<RemoteControlCubit>().state;
|
|
final targetDevice = remoteControlState.targetDevice;
|
|
|
|
debugPrint('🔍 [RoutePlanPage] targetDevice: ${targetDevice?.deviceName ?? "null"}');
|
|
|
|
// 检查是否有选中的设备
|
|
if (targetDevice == null) {
|
|
return Scaffold(
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Icon(
|
|
Icons.devices_other,
|
|
size: 64,
|
|
color: Color(0xFF86909C),
|
|
),
|
|
const SizedBox(height: 16),
|
|
const Text(
|
|
'请先选择设备',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w500,
|
|
color: Color(0xFF1D2129),
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'在设备列表或场站中选择要控制的设备',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Color(0xFF86909C),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFFF7F7F7),
|
|
body: MapPageEnterprise(),
|
|
);
|
|
} catch (e, stackTrace) {
|
|
debugPrint('❌ [RoutePlanPage] 构建错误: $e');
|
|
debugPrint('堆栈跟踪: $stackTrace');
|
|
return Scaffold(
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Icon(
|
|
Icons.error_outline,
|
|
size: 64,
|
|
color: Colors.red,
|
|
),
|
|
const SizedBox(height: 16),
|
|
const Text(
|
|
'页面加载失败',
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w500,
|
|
color: Color(0xFF1D2129),
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'错误: $e',
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
color: Colors.red,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
}
|