修复版本管理整包更新无法弹出的问题
完成集成新的登录接口的更换使用 完成集成用户的场站列表接口 完成开发设计选择场站项为全局属性 完成我的页面的个人信息的集成和详情页面的开发 完成设备页面的中无人机机场的列表接口对接入和个项页面的布局的优化 完成设备页面的中无人机机场的详情接口的对接和使用和页面的更新布局
This commit is contained in:
@@ -2,9 +2,14 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../../core/di/injection.dart';
|
||||
import '../../../../../core/app/app_user_cubit.dart';
|
||||
import '../../../../v2/site/presentation/cubit/site_cubit.dart';
|
||||
import '../bloc/device_status_bloc.dart';
|
||||
import '../bloc/device_status_event.dart';
|
||||
import '../bloc/device_status_state.dart';
|
||||
import '../bloc/drone_station_bloc.dart';
|
||||
import '../bloc/drone_station_event.dart';
|
||||
import '../bloc/drone_station_state.dart';
|
||||
import '../widgets/device_item_widget.dart';
|
||||
import '../widgets/drone_station_item_card.dart';
|
||||
import 'robot_list_page.dart';
|
||||
@@ -318,31 +323,122 @@ class DeviceStatusView extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildDroneStationList(BuildContext context) {
|
||||
// 模拟机场数据
|
||||
final stations = [
|
||||
{'name': '1号无人机机场', 'id': 'AIRPORT-01'},
|
||||
{'name': '2号无人机机场', 'id': 'AIRPORT-02'},
|
||||
{'name': '3号无人机机场', 'id': 'AIRPORT-03'},
|
||||
];
|
||||
// 从全局 SiteCubit 获取选中的场站 ID
|
||||
final selectedSite = sl<SiteCubit>().state.selectedSite;
|
||||
|
||||
if (selectedSite == null) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.location_off,
|
||||
size: 48,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'请先选择场站',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.only(top: 16, bottom: 16),
|
||||
itemCount: stations.length,
|
||||
itemBuilder: (context, index) {
|
||||
final station = stations[index];
|
||||
return DroneStationItemCard(
|
||||
name: station['name'] as String,
|
||||
id: station['id'] as String,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DroneStationDetailPage(),
|
||||
return BlocProvider(
|
||||
create: (_) => sl<DroneStationBloc>()..add(DroneStationLoadData(selectedSite.id)),
|
||||
child: BlocBuilder<DroneStationBloc, DroneStationState>(
|
||||
builder: (context, state) {
|
||||
if (state is DroneStationLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Color(0xFF165DFF),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
}
|
||||
|
||||
if (state is DroneStationError) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.error_outline,
|
||||
size: 48,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
state.message,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.read<DroneStationBloc>().add(DroneStationLoadData(selectedSite.id));
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF165DFF),
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
child: const Text('重试'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (state is DroneStationLoaded) {
|
||||
final stations = state.stations;
|
||||
|
||||
if (stations.isEmpty) {
|
||||
return const Center(
|
||||
child: Text(
|
||||
'该场站暂无无人机机场',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
context.read<DroneStationBloc>().add(DroneStationRefresh(selectedSite.id));
|
||||
},
|
||||
color: const Color(0xFF165DFF),
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.only(top: 16, bottom: 16),
|
||||
itemCount: stations.length,
|
||||
itemBuilder: (context, index) {
|
||||
final station = stations[index];
|
||||
return DroneStationItemCard(
|
||||
station: station,
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => DroneStationDetailPage(station: station),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return const Center(child: Text('暂无数据'));
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,111 +1,133 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'drone_mission_control_page.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../../core/di/injection.dart';
|
||||
import '../../domain/entities/drone_station_entity.dart';
|
||||
import '../bloc/drone_station_bloc.dart';
|
||||
import '../bloc/drone_station_event.dart';
|
||||
import '../bloc/drone_station_state.dart';
|
||||
import 'drone_video_control_page.dart';
|
||||
import 'drone_mission_control_page.dart';
|
||||
import 'drone_monitor_page.dart';
|
||||
|
||||
/// 无人机机场详情页面
|
||||
class DroneStationDetailPage extends StatelessWidget {
|
||||
const DroneStationDetailPage({super.key});
|
||||
class DroneStationDetailPage extends StatefulWidget {
|
||||
final DroneStationEntity station;
|
||||
|
||||
const DroneStationDetailPage({
|
||||
super.key,
|
||||
required this.station,
|
||||
});
|
||||
|
||||
@override
|
||||
State<DroneStationDetailPage> createState() => _DroneStationDetailPageState();
|
||||
}
|
||||
|
||||
class _DroneStationDetailPageState extends State<DroneStationDetailPage> {
|
||||
late DroneStationBloc _bloc;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_bloc = sl<DroneStationBloc>();
|
||||
_bloc.add(UAVDetailLoad(
|
||||
gatewaySn: widget.station.gatewaySn,
|
||||
deviceSn: widget.station.deviceSn,
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_bloc.close();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF5F6F8),
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Color(0xFF1D2129)),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
title: const Text(
|
||||
'无人机机场详情',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
return BlocProvider.value(
|
||||
value: _bloc,
|
||||
child: Scaffold(
|
||||
backgroundColor: const Color(0xFFF5F6F8),
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Color(0xFF1D2129)),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
title: const Text(
|
||||
'无人机机场详情',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: BlocBuilder<DroneStationBloc, DroneStationState>(
|
||||
builder: (context, state) {
|
||||
if (state is UAVDetailLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: Color(0xFF165DFF)),
|
||||
);
|
||||
}
|
||||
|
||||
if (state is UAVDetailError) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, size: 48, color: Color(0xFF86909C)),
|
||||
const SizedBox(height: 16),
|
||||
Text(state.message, style: const TextStyle(fontSize: 14, color: Color(0xFF4E5969))),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_bloc.add(UAVDetailLoad(
|
||||
gatewaySn: widget.station.gatewaySn,
|
||||
deviceSn: widget.station.deviceSn,
|
||||
));
|
||||
},
|
||||
style: ElevatedButton.styleFrom(backgroundColor: const Color(0xFF165DFF)),
|
||||
child: const Text('重试'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (state is UAVDetailLoaded) {
|
||||
return _buildContent(state.detail);
|
||||
}
|
||||
|
||||
return const Center(child: Text('正在加载...'));
|
||||
},
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_buildAirportStatusCard(),
|
||||
const SizedBox(height: 12),
|
||||
_buildDroneStatusCard(context),
|
||||
const SizedBox(height: 12),
|
||||
_buildQuickActions(context),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 机场状态卡片
|
||||
Widget _buildAirportStatusCard() {
|
||||
Widget _buildContent(UAVDetailEntity detail) {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_buildAirportStatusCard(detail),
|
||||
const SizedBox(height: 12),
|
||||
_buildDroneStatusCard(detail),
|
||||
const SizedBox(height: 12),
|
||||
_buildQuickActions(),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAirportStatusCard(UAVDetailEntity detail) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'机场状态',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildStatusRow('机场编号', 'AIRPORT-01', status: '正常'),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRow('位置', '升压站旁 - 无人机机场'),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRow('舱门状态', '关闭', status: '正常'),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRowWithProgress('充电状态', '充电中', '85%'),
|
||||
const SizedBox(height: 12),
|
||||
_buildWeatherRow(),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRow('网络状态', '4G/5G 强'),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 无人机状态卡片
|
||||
Widget _buildDroneStatusCard(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DroneVideoControlPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
BoxShadow(color: Color(0x0D000000), blurRadius: 8, offset: Offset(0, 2)),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
@@ -113,148 +135,109 @@ class DroneStationDetailPage extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'无人机状态',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
const Text('机场状态', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF1D2129))),
|
||||
const Spacer(),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF00B42A).withOpacity(0.1),
|
||||
color: detail.isOnline ? const Color(0xFF00B42A).withOpacity(0.1) : const Color(0xFFF53F3F).withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: const Text(
|
||||
'在线',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF00B42A),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
child: Text(detail.isOnline ? '在线' : '离线', style: TextStyle(fontSize: 12, color: detail.isOnline ? const Color(0xFF00B42A) : const Color(0xFFF53F3F), fontWeight: FontWeight.w500)),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/xunjian.png',
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'无人机 - 01',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
_buildDroneBatteryRow(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRow('飞行模式', '待命'),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRow('机身状态', '正常'),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRow('上次任务', '逆变器区巡检(05-20 10:30)'),
|
||||
const Divider(height: 1, color: Color(0xFFF2F3F5)),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoRow('机场名称', detail.callsign.isNotEmpty ? detail.callsign : '未知'),
|
||||
_buildInfoRow('设备序列号', detail.deviceSn),
|
||||
_buildInfoRow('网关序列号', detail.gatewaySn),
|
||||
_buildInfoRow('位置坐标', (detail.latitude != null && detail.longitude != null) ? '${detail.latitude}, ${detail.longitude}' : '未知'),
|
||||
_buildInfoRow('电量', detail.capacityPercent != null ? '${detail.capacityPercent}%' : '未知'),
|
||||
_buildInfoRow('环境温度', detail.environmentTemperature != null ? '${detail.environmentTemperature}°C' : '未知'),
|
||||
_buildInfoRow('风速', detail.windSpeed != null ? '${detail.windSpeed} m/s' : '未知'),
|
||||
_buildInfoRow('降雨量', detail.rainfall ?? '未知'),
|
||||
_buildInfoRow('网络状态', detail.networkState?.toString() ?? '未知'),
|
||||
_buildPositionStateRow('位置状态', detail.positionState),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 快捷操作按钮
|
||||
Widget _buildQuickActions(BuildContext context) {
|
||||
Widget _buildDroneStatusCard(UAVDetailEntity detail) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const DroneVideoControlPage()));
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [BoxShadow(color: Color(0x0D000000), blurRadius: 8, offset: Offset(0, 2))],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text('无人机状态', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF1D2129))),
|
||||
const Spacer(),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: detail.isDroneOnline ? const Color(0xFF00B42A).withOpacity(0.1) : const Color(0xFFF53F3F).withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(detail.isDroneOnline ? '在线' : '离线', style: TextStyle(fontSize: 12, color: detail.isDroneOnline ? const Color(0xFF00B42A) : const Color(0xFFF53F3F), fontWeight: FontWeight.w500)),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoRow('无人机呼号', detail.droneCallsign.isNotEmpty ? detail.droneCallsign : '未知'),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoRow('设备序列号', detail.deviceSn),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoRow('电量', detail.capacityPercent != null ? '${detail.capacityPercent}%' : '未知'),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoRow('高度', detail.height != null ? '${detail.height} m' : '未知'),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoRow('距离home点', detail.homeDistance != null ? '${detail.homeDistance} m' : '未知'),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoRow('实时电量', detail.liveCapacity != null ? '${detail.liveCapacity}%' : '未知'),
|
||||
if (detail.gatewayCameraList != null && detail.gatewayCameraList!.isNotEmpty) ...[
|
||||
const SizedBox(height: 12),
|
||||
_buildCameraListRow('网关摄像头', detail.gatewayCameraList!),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildQuickActions() {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
boxShadow: const [BoxShadow(color: Color(0x0D000000), blurRadius: 8, offset: Offset(0, 2))],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'快捷操作',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
const Text('快捷操作', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF1D2129))),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildQuickActionButton(
|
||||
context,
|
||||
icon: Icons.flight_takeoff,
|
||||
label: '开舱',
|
||||
color: const Color(0xFF165DFF),
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
Expanded(child: _buildQuickActionButton(icon: Icons.flight_takeoff, label: '开舱', color: const Color(0xFF165DFF), onTap: () {})),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: _buildQuickActionButton(
|
||||
context,
|
||||
icon: Icons.flight,
|
||||
label: '起飞准备',
|
||||
color: const Color(0xFF165DFF),
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
Expanded(child: _buildQuickActionButton(icon: Icons.flight, label: '起飞准备', color: const Color(0xFF165DFF), onTap: () {})),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: _buildQuickActionButton(
|
||||
context,
|
||||
icon: Icons.home,
|
||||
label: '返航',
|
||||
color: const Color(0xFFFF7D00),
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
Expanded(child: _buildQuickActionButton(icon: Icons.home, label: '返航', color: const Color(0xFFFF7D00), onTap: () {})),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: _buildQuickActionButton(
|
||||
context,
|
||||
icon: Icons.task,
|
||||
label: '任务下发',
|
||||
color: const Color(0xFF165DFF),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DroneMissionControlPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(child: _buildQuickActionButton(icon: Icons.monitor, label: '看监控', color: const Color(0xFF165DFF), onTap: _goToMonitor)),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -262,37 +245,45 @@ class DroneStationDetailPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// 快捷操作按钮
|
||||
Widget _buildQuickActionButton(
|
||||
BuildContext context, {
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required Color color,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
void _goToMonitor() {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => DroneMonitorPage()));
|
||||
}
|
||||
|
||||
Widget _buildQuickActionButton({required IconData icon, required String label, required Color color, required VoidCallback onTap}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: color,
|
||||
size: 24,
|
||||
),
|
||||
width: 48, height: 48,
|
||||
decoration: BoxDecoration(color: color.withOpacity(0.1), borderRadius: BorderRadius.circular(12)),
|
||||
child: Icon(icon, color: color, size: 24),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF4E5969),
|
||||
Text(label, style: const TextStyle(fontSize: 12, color: Color(0xFF4E5969))),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoRow(String label, String value) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 80,
|
||||
child: Text(label, style: const TextStyle(fontSize: 12, color: Color(0xFF86909C))),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Text(':', style: TextStyle(fontSize: 12, color: Color(0xFFC0C4CC))),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
value,
|
||||
style: const TextStyle(fontSize: 12, color: Color(0xFF1D2129), fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -300,166 +291,29 @@ class DroneStationDetailPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// 状态行(带状态标签)
|
||||
Widget _buildStatusRow(String label, String value, {String? status}) {
|
||||
Widget _buildPositionStateRow(String label, PositionState? positionState) {
|
||||
String value = '未知';
|
||||
if (positionState != null) {
|
||||
value = 'GPS:${positionState.gpsNumber} RTX:${positionState.rtkNumber} 固定:${positionState.isFixed}';
|
||||
}
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
),
|
||||
Text(label, style: const TextStyle(fontSize: 13, color: Color(0xFF86909C))),
|
||||
const Spacer(),
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF1D2129),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
if (status != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF00B42A).withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
status,
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: Color(0xFF00B42A),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
Flexible(child: Text(value, style: const TextStyle(fontSize: 13, color: Color(0xFF1D2129), fontWeight: FontWeight.w500), textAlign: TextAlign.right)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// 带进度条的状态行
|
||||
Widget _buildStatusRowWithProgress(String label, String value, String progress) {
|
||||
Widget _buildCameraListRow(String label, List<CameraInfo> cameras) {
|
||||
String value = cameras.map((c) => '${c.cameraIndex}:${c.cameraPosition}').join(' | ');
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
),
|
||||
Text(label, style: const TextStyle(fontSize: 13, color: Color(0xFF86909C))),
|
||||
const Spacer(),
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF1D2129),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
progress,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF165DFF),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
Flexible(child: Text(value, style: const TextStyle(fontSize: 13, color: Color(0xFF1D2129), fontWeight: FontWeight.w500), textAlign: TextAlign.right)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// 气象条件行
|
||||
Widget _buildWeatherRow() {
|
||||
return Row(
|
||||
children: [
|
||||
const Text(
|
||||
'气象条件',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.wb_sunny, size: 16, color: Color(0xFFFF7D00)),
|
||||
const SizedBox(width: 4),
|
||||
const Text(
|
||||
'晴',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF1D2129),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
'25°C',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
'东南风 2级',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// 无人机电量行
|
||||
Widget _buildDroneBatteryRow() {
|
||||
return Row(
|
||||
children: [
|
||||
const Text(
|
||||
'电量',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.78,
|
||||
backgroundColor: const Color(0xFFF2F3F5),
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(Color(0xFF00B42A)),
|
||||
minHeight: 6,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
'78%',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF00B42A),
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,12 +182,12 @@ class DroneStationStatusPage extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRow('飞行模式', '待命'),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRow('机身状态', '正常'),
|
||||
const SizedBox(height: 12),
|
||||
_buildStatusRow('上次任务', '逆变器区巡检(05-20 10:30)'),
|
||||
// const SizedBox(height: 12),
|
||||
// _buildStatusRow('飞行模式', '待命'),
|
||||
// const SizedBox(height: 12),
|
||||
// _buildStatusRow('机身状态', '正常'),
|
||||
// const SizedBox(height: 12),
|
||||
// _buildStatusRow('上次任务', '逆变器区巡检(05-20 10:30)'),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user