所有一级页面和不分二级页面

This commit is contained in:
2026-05-25 12:58:29 +08:00
parent b9f747de05
commit afef5c4ef1
158 changed files with 13082 additions and 1602 deletions

View File

@@ -0,0 +1,448 @@
import 'package:flutter/material.dart';
/// 清洗/除草机器人任务详情页
class CleaningWeedingRobotTaskPage extends StatelessWidget {
final Map<String, dynamic> robot;
const CleaningWeedingRobotTaskPage({super.key, required this.robot});
@override
Widget build(BuildContext context) {
final isCleaning = robot['type'] == '清洗机器人';
final title = isCleaning ? '清洗机器人任务' : '除草机器人任务';
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: Text(
title,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color(0xFF1D2129),
),
),
centerTitle: true,
actions: [
IconButton(
icon: const Icon(Icons.edit_outlined, color: Color(0xFF1D2129)),
onPressed: () {},
),
],
),
body: Column(
children: [
Expanded(
child: ListView(
padding: const EdgeInsets.all(16),
children: [
_buildTaskInfoCard(isCleaning),
const SizedBox(height: 12),
_buildProgressCard(isCleaning),
const SizedBox(height: 12),
_buildDeviceStatusCard(isCleaning),
],
),
),
_buildBottomButtons(),
],
),
);
}
Widget _buildTaskInfoCard(bool isCleaning) {
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: [
Row(
children: [
Expanded(
child: Text(
isCleaning ? '清洗任务-组件清洗A区' : '除草任务-光伏板除草B区',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Color(0xFF1D2129),
),
),
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: const Color(0xFF165DFF).withOpacity(0.1),
borderRadius: BorderRadius.circular(4),
),
child: const Text(
'进行中',
style: TextStyle(
fontSize: 12,
color: Color(0xFF165DFF),
fontWeight: FontWeight.w500,
),
),
),
],
),
const SizedBox(height: 16),
Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildInfoRow('任务编号', isCleaning ? 'CL-2025052001' : 'WD-2025052001'),
_buildInfoRow('作业区域', isCleaning ? '清洗区A区-01' : '除草区B区-02'),
_buildInfoRow('开始时间', '05-20 09:20'),
_buildInfoRow('预计完成', '05-20 14:30'),
],
),
),
const SizedBox(width: 12),
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Image.asset(
isCleaning ? 'assets/images/qinxi.png' : 'assets/images/chucao.png',
width: 80,
height: 80,
fit: BoxFit.cover,
),
),
],
),
],
),
);
}
Widget _buildInfoRow(String label, String value) {
return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Row(
children: [
Text(
'$label:',
style: const TextStyle(
fontSize: 13,
color: Color(0xFF86909C),
),
),
Text(
value,
style: const TextStyle(
fontSize: 13,
color: Color(0xFF1D2129),
fontWeight: FontWeight.w500,
),
),
],
),
);
}
Widget _buildProgressCard(bool isCleaning) {
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: 12),
Row(
children: [
Expanded(
child: Text(
'覆盖面积',
style: const TextStyle(
fontSize: 13,
color: Color(0xFF86909C),
),
),
),
Text(
isCleaning ? '8,230 m² / 15,000 m²' : '5,600 m² / 12,000 m²',
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xFF1D2129),
),
),
const SizedBox(width: 8),
Text(
isCleaning ? '55%' : '47%',
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xFF165DFF),
),
),
],
),
const SizedBox(height: 8),
ClipRRect(
borderRadius: BorderRadius.circular(4),
child: LinearProgressIndicator(
value: isCleaning ? 0.55 : 0.47,
backgroundColor: const Color(0xFFF2F3F5),
valueColor: const AlwaysStoppedAnimation<Color>(Color(0xFF165DFF)),
minHeight: 8,
),
),
const SizedBox(height: 12),
Row(
children: [
const Text(
'预计完成时间',
style: TextStyle(
fontSize: 13,
color: Color(0xFF86909C),
),
),
const SizedBox(width: 8),
Text(
'14:30(剩余 2h10m)',
style: const TextStyle(
fontSize: 13,
color: Color(0xFF1D2129),
fontWeight: FontWeight.w500,
),
),
],
),
],
),
);
}
Widget _buildDeviceStatusCard(bool isCleaning) {
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('电量', '68%', 0.68),
const SizedBox(height: 12),
if (isCleaning) ...[
_buildStatusRow('水箱水位', '62%', 0.62),
const SizedBox(height: 12),
_buildStatusRowWithBadge('喷淋压力', '0.45 MPa', '正常'),
const SizedBox(height: 12),
_buildStatusRowWithBadge('刷头状态', '正常', '正常'),
] else ...[
_buildStatusRow('燃油量', '75%', 0.75),
const SizedBox(height: 12),
_buildStatusRowWithBadge('刀片状态', '正常', '正常'),
const SizedBox(height: 12),
_buildStatusRowWithBadge('导航状态', '正常', '正常'),
],
],
),
);
}
Widget _buildStatusRow(String label, String value, double progress) {
return Row(
children: [
Text(
label,
style: const TextStyle(
fontSize: 13,
color: Color(0xFF4E5969),
),
),
const SizedBox(width: 12),
Text(
value,
style: const TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: Color(0xFF1D2129),
),
),
const Spacer(),
SizedBox(
width: 120,
child: ClipRRect(
borderRadius: BorderRadius.circular(4),
child: LinearProgressIndicator(
value: progress,
backgroundColor: const Color(0xFFF2F3F5),
valueColor: AlwaysStoppedAnimation<Color>(
progress > 0.5 ? const Color(0xFF00B42A) : const Color(0xFFFF7D00),
),
minHeight: 6,
),
),
),
],
);
}
Widget _buildStatusRowWithBadge(String label, String value, String badgeText) {
return Row(
children: [
Text(
label,
style: const TextStyle(
fontSize: 13,
color: Color(0xFF4E5969),
),
),
const Spacer(),
Text(
value,
style: const TextStyle(
fontSize: 13,
color: Color(0xFF1D2129),
),
),
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(
badgeText,
style: const TextStyle(
fontSize: 11,
color: Color(0xFF00B42A),
fontWeight: FontWeight.w500,
),
),
),
],
);
}
Widget _buildBottomButtons() {
return Container(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 20),
child: Row(
children: [
Expanded(
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF165DFF),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
elevation: 0,
),
child: const Text(
'开始作业',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
),
),
const SizedBox(width: 12),
Expanded(
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFFFF7D00),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
elevation: 0,
),
child: const Text(
'暂停',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
),
),
const SizedBox(width: 12),
Expanded(
child: OutlinedButton(
onPressed: () {},
style: OutlinedButton.styleFrom(
foregroundColor: const Color(0xFF4E5969),
side: const BorderSide(color: Color(0xFFC9CDD4)),
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: const Text(
'返航/回充',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,454 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../../../core/di/injection.dart';
import '../bloc/device_status_bloc.dart';
import '../bloc/device_status_event.dart';
import '../bloc/device_status_state.dart';
import '../widgets/device_item_widget.dart';
import '../widgets/drone_station_item_card.dart';
import 'robot_list_page.dart';
import 'drone_station_detail_page.dart';
/// 设备状态页面 - 使用 BLoC 模式
class DeviceStatusPage extends StatelessWidget {
const DeviceStatusPage({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (_) => sl<DeviceStatusBloc>()..add(const DeviceStatusLoadData()),
child: const DeviceStatusView(),
);
}
}
/// 设备状态视图
class DeviceStatusView extends StatelessWidget {
const DeviceStatusView({super.key});
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.dark,
),
child: Scaffold(
backgroundColor: const Color(0xFFF7F7F7),
body: SafeArea(
child: BlocBuilder<DeviceStatusBloc, DeviceStatusState>(
builder: (context, state) {
return Column(
children: [
_buildAppBar(),
_buildSearchBar(context),
_buildTypeFilterBar(context),
Expanded(
child: _buildContent(context, state),
),
],
);
},
),
),
),
);
}
Widget _buildAppBar() {
return Container(
height: 44.0,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: const Row(
children: [
Text(
'设备状态',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color(0xFF1D2129),
),
),
Spacer(),
Icon(
Icons.more_vert,
size: 24,
color: Color(0xFF1D2129),
),
],
),
);
}
Widget _buildSearchBar(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(16.0, 8, 16.0, 8),
child: TextField(
decoration: InputDecoration(
hintText: '搜索设备名称/编号',
hintStyle: const TextStyle(
color: Color(0xFF86909C),
fontSize: 14,
),
prefixIcon: const Icon(
Icons.search,
color: Color(0xFF86909C),
size: 24,
),
suffixIcon: TextButton(
onPressed: () {
// TODO: 触发搜索
},
child: const Text(
'搜索',
style: TextStyle(
color: Color(0xFF165DFF),
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
),
filled: true,
fillColor: const Color(0xFFF2F3F5),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(24.0),
borderSide: const BorderSide(
color: Color(0xFFE5E6EB),
width: 1,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(24.0),
borderSide: const BorderSide(
color: Color(0xFFE5E6EB),
width: 1,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(24.0),
borderSide: const BorderSide(
color: Color(0xFF165DFF),
width: 1,
),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
),
style: const TextStyle(
fontSize: 14,
color: Color(0xFF1D2129),
),
onSubmitted: (value) {
// 🔥 点击键盘确定键时触发搜索
context.read<DeviceStatusBloc>().add(DeviceStatusSearch(value));
},
),
);
}
Widget _buildTypeFilterBar(BuildContext context) {
final types = ['全部', '机器人', '无人机机场', '逆变器', '汇流箱', '组件', '监控'];
return BlocBuilder<DeviceStatusBloc, DeviceStatusState>(
builder: (context, state) {
String selectedType = '全部';
if (state is DeviceStatusLoaded) {
selectedType = state.selectedType;
}
return SizedBox(
height: 40,
child: ListView.separated(
scrollDirection: Axis.horizontal,
physics: const ClampingScrollPhysics(),
padding: const EdgeInsets.symmetric(horizontal: 16.0),
itemCount: types.length,
separatorBuilder: (context, index) => const SizedBox(width: 24.0),
itemBuilder: (context, index) {
final type = types[index];
final isSelected = selectedType == type;
return GestureDetector(
onTap: () {
context.read<DeviceStatusBloc>().add(DeviceStatusChangeType(type));
},
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
type,
style: TextStyle(
fontSize: 15,
color: isSelected ? const Color(0xFF135BFF) : const Color(0xFF666666),
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
),
),
const SizedBox(height: 4),
Container(
width: 20,
height: 2,
decoration: BoxDecoration(
color: isSelected ? const Color(0xFF0D57FF) : Colors.transparent,
borderRadius: BorderRadius.circular(1),
),
),
],
),
);
},
),
);
},
);
}
Widget _buildContent(BuildContext context, DeviceStatusState state) {
// 如果选择的是"机器人",显示机器人专属页面
if (state is DeviceStatusLoaded && state.selectedType == '机器人') {
return const RobotListPage();
}
// 如果选择的是"无人机机场",显示机场列表
if (state is DeviceStatusLoaded && state.selectedType == '无人机机场') {
return _buildDroneStationList(context);
}
// 其他类型显示原有设备列表
return _buildDeviceList(context, state);
}
Widget _buildDeviceList(BuildContext context, DeviceStatusState state) {
if (state is DeviceStatusLoading) {
return const Center(
child: CircularProgressIndicator(
color: Color(0xFF165DFF),
),
);
}
if (state is DeviceStatusError) {
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<DeviceStatusBloc>().add(const DeviceStatusLoadData());
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF165DFF),
foregroundColor: Colors.white,
),
child: const Text('重试'),
),
],
),
);
}
if (state is DeviceStatusLoaded) {
// 🔥 先根据类型过滤
List filteredByType = state.devices;
if (state.selectedType != '全部') {
filteredByType = state.devices.where((device) {
return device.type == state.selectedType;
}).toList();
}
// 🔥 再根据搜索关键词过滤
final filteredDevices = filteredByType.where((device) {
if (state.searchKeyword.isEmpty) return true;
return device.name.toLowerCase().contains(state.searchKeyword.toLowerCase()) ||
device.deviceId.toLowerCase().contains(state.searchKeyword.toLowerCase());
}).toList();
return RefreshIndicator(
onRefresh: () async {
context.read<DeviceStatusBloc>().add(const DeviceStatusRefresh());
},
color: const Color(0xFF165DFF),
child: ListView(
padding: const EdgeInsets.only(bottom: 16),
children: [
_buildStatusCard(state),
const SizedBox(height: 20.0),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.symmetric(horizontal: 16),
itemCount: filteredDevices.length,
itemBuilder: (context, index) {
final device = filteredDevices[index];
return Padding(
padding: const EdgeInsets.only(bottom: 12),
child: DeviceItemWidget(
device: device,
onTap: () {
debugPrint('点击设备: ${device.name}');
// TODO: 导航到设备详情页
},
),
);
},
),
],
),
);
}
return const Center(child: Text('暂无数据'));
}
Widget _buildDroneStationList(BuildContext context) {
// 模拟机场数据
final stations = [
{'name': '1号无人机机场', 'id': 'AIRPORT-01'},
{'name': '2号无人机机场', 'id': 'AIRPORT-02'},
{'name': '3号无人机机场', 'id': 'AIRPORT-03'},
];
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(),
),
);
},
);
},
);
}
Widget _buildStatusCard(DeviceStatusLoaded state) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 16.0),
padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.0),
boxShadow: const [
BoxShadow(
color: Color(0x0D000000),
blurRadius: 4,
offset: Offset(0, 2),
),
],
),
child: Row(
children: [
_buildStatItem(
value: state.deviceStatus.total.toString(),
label: '全部设备',
dotColor: const Color(0xFF86909C),
textColor: const Color(0xFF86909C), // 新增字体颜色
),
Container(
width: 1,
height: 40,
color: const Color(0xFFE5E6EB),
),
_buildStatItem(
value: state.deviceStatus.online.toString(),
label: '在线',
dotColor: const Color(0xFF00B42A),
textColor: const Color(0xFF00B42A),
),
Container(
width: 1,
height: 40,
color: const Color(0xFFE5E6EB),
),
_buildStatItem(
value: state.deviceStatus.exception.toString(),
label: '告警',
dotColor: const Color(0xFFFF7D00),
textColor: const Color(0xFFFF7D00),
),
Container(
width: 1,
height: 40,
color: const Color(0xFFE5E6EB),
),
_buildStatItem(
value: state.deviceStatus.offline.toString(),
label: '离线',
dotColor: const Color(0xFFF53F3F),
textColor: const Color(0xFFF53F3F),
),
],
),
);
}
Widget _buildStatItem({
required String value,
required String label,
required Color dotColor,
required Color? textColor, // 新增字体颜色
}) {
return Expanded(
child: Column(
children: [
Text(
value,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: textColor ?? const Color(0xFF1D2129),
),
),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 8,
height: 8,
decoration: BoxDecoration(
color: dotColor,
shape: BoxShape.circle,
),
),
const SizedBox(width: 4),
Text(
label,
style: TextStyle(
fontSize: 12,
color: textColor ?? const Color(0xFF4E5969),
),
),
],
),
],
),
);
}
}

View File

@@ -0,0 +1,384 @@
import 'package:flutter/material.dart';
/// 无人机任务与航线控制页面
class DroneMissionControlPage extends StatelessWidget {
const DroneMissionControlPage({super.key});
@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),
),
),
centerTitle: true,
actions: [
IconButton(
icon: const Icon(Icons.settings, color: Color(0xFF1D2129)),
onPressed: () {},
),
],
),
body: Column(
children: [
Expanded(
child: ListView(
padding: const EdgeInsets.all(16),
children: [
_buildMissionInfoCard(),
const SizedBox(height: 12),
_buildRouteMap(),
const SizedBox(height: 12),
_buildWaypointList(),
const SizedBox(height: 16),
],
),
),
_buildActionButtons(),
],
),
);
}
Widget _buildMissionInfoCard() {
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),
_buildInfoRow('任务名称', '逆变器区巡检任务'),
const SizedBox(height: 12),
Row(
children: [
_buildInfoColumn('任务编号', 'UAV-2025052001'),
const Spacer(),
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: const Color(0xFF165DFF).withOpacity(0.1),
borderRadius: BorderRadius.circular(4),
),
child: const Text(
'进行中',
style: TextStyle(
fontSize: 12,
color: Color(0xFF165DFF),
fontWeight: FontWeight.w500,
),
),
),
],
),
const SizedBox(height: 12),
_buildInfoRow('巡检区域', '逆变器区A区'),
const SizedBox(height: 12),
_buildInfoRow('飞行高度', '80 m'),
const SizedBox(height: 12),
_buildInfoRow('飞行速度', '8.0 m/s'),
const SizedBox(height: 12),
_buildInfoRow('预计时长', '26 min'),
const SizedBox(height: 12),
_buildInfoRow('电量预估', '68% (可飞行 22 min)'),
],
),
);
}
Widget _buildRouteMap() {
return Container(
height: 200,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color(0x0D000000),
blurRadius: 8,
offset: Offset(0, 2),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.asset(
'assets/images/xunjian.png',
fit: BoxFit.cover,
width: double.infinity,
),
),
);
}
Widget _buildWaypointList() {
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: [
Row(
children: [
const Text(
'航点列表',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Color(0xFF1D2129),
),
),
const Spacer(),
IconButton(
icon: const Icon(Icons.map, size: 20, color: Color(0xFF86909C)),
onPressed: () {},
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
),
const SizedBox(width: 8),
IconButton(
icon: const Icon(Icons.close, size: 20, color: Color(0xFF86909C)),
onPressed: () {},
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
),
],
),
const SizedBox(height: 12),
_buildWaypointItem('1', '起飞点', '50m', '拍照'),
const SizedBox(height: 8),
_buildWaypointItem('2', '航点1', '80m', '拍照'),
const SizedBox(height: 8),
_buildWaypointItem('3', '航点2', '80m', '拍照'),
const SizedBox(height: 8),
_buildWaypointItem('4', '航点3', '80m', '拍照'),
const SizedBox(height: 8),
_buildWaypointItem('5', '航点4', '80m', '拍照'),
const SizedBox(height: 8),
_buildWaypointItem('6', '航点5', '80m', '拍照'),
],
),
);
}
Widget _buildWaypointItem(String number, String name, String height, String action) {
return Row(
children: [
Container(
width: 24,
height: 24,
decoration: const BoxDecoration(
color: Color(0xFF165DFF),
shape: BoxShape.circle,
),
child: Center(
child: Text(
number,
style: const TextStyle(
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
const SizedBox(width: 12),
Expanded(
child: Text(
name,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Color(0xFF1D2129),
),
),
),
Text(
'H: $height',
style: const TextStyle(
fontSize: 13,
color: Color(0xFF86909C),
),
),
const SizedBox(width: 16),
Text(
action,
style: const TextStyle(
fontSize: 13,
color: Color(0xFF4E5969),
),
),
const SizedBox(width: 8),
const Icon(
Icons.download_outlined,
size: 18,
color: Color(0xFF165DFF),
),
],
);
}
Widget _buildActionButtons() {
return Container(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 20),
decoration: const BoxDecoration(
color: Color(0xFFF5F6F8),
),
child: Row(
children: [
Expanded(
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF165DFF),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
elevation: 0,
),
child: const Text(
'开始巡检',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
),
),
const SizedBox(width: 12),
Expanded(
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFFFF7D00),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
elevation: 0,
),
child: const Text(
'暂停任务',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
),
),
const SizedBox(width: 12),
Expanded(
child: OutlinedButton(
onPressed: () {},
style: OutlinedButton.styleFrom(
foregroundColor: const Color(0xFF4E5969),
side: const BorderSide(color: Color(0xFFC9CDD4)),
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: const Text(
'返航降落',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
),
),
],
),
);
}
Widget _buildInfoRow(String label, String value) {
return Row(
children: [
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,
),
),
],
);
}
Widget _buildInfoColumn(String label, String value) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: const TextStyle(
fontSize: 13,
color: Color(0xFF86909C),
),
),
const SizedBox(height: 4),
Text(
value,
style: const TextStyle(
fontSize: 13,
color: Color(0xFF1D2129),
fontWeight: FontWeight.w500,
),
),
],
);
}
}

View File

@@ -0,0 +1,465 @@
import 'package:flutter/material.dart';
import 'drone_mission_control_page.dart';
import 'drone_video_control_page.dart';
/// 无人机机场详情页面
class DroneStationDetailPage extends StatelessWidget {
const DroneStationDetailPage({super.key});
@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),
),
),
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() {
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),
),
],
),
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: const Color(0xFF00B42A).withOpacity(0.1),
borderRadius: BorderRadius.circular(4),
),
child: const Text(
'在线',
style: TextStyle(
fontSize: 12,
color: Color(0xFF00B42A),
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)'),
],
),
),
);
}
/// 快捷操作按钮
Widget _buildQuickActions(BuildContext context) {
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),
Row(
children: [
Expanded(
child: _buildQuickActionButton(
context,
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: () {},
),
),
const SizedBox(width: 12),
Expanded(
child: _buildQuickActionButton(
context,
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(),
),
);
},
),
),
],
),
],
),
);
}
/// 快捷操作按钮
Widget _buildQuickActionButton(
BuildContext context, {
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,
),
),
const SizedBox(height: 8),
Text(
label,
style: const TextStyle(
fontSize: 12,
color: Color(0xFF4E5969),
),
),
],
),
);
}
/// 状态行(带状态标签)
Widget _buildStatusRow(String label, String value, {String? status}) {
return Row(
children: [
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,
),
),
),
],
],
);
}
/// 带进度条的状态行
Widget _buildStatusRowWithProgress(String label, String value, String progress) {
return Row(
children: [
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),
),
],
);
}
/// 气象条件行
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,
),
),
],
);
}
}

View File

@@ -0,0 +1,466 @@
import 'package:flutter/material.dart';
/// 无人机机场与设备状态页面
class DroneStationStatusPage extends StatelessWidget {
const DroneStationStatusPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFF5F6F8),
body: CustomScrollView(
slivers: [
// 顶部导航栏
SliverAppBar(
backgroundColor: Colors.white,
elevation: 0,
pinned: true,
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,
actions: [
IconButton(
icon: const Icon(Icons.notifications_none, color: Color(0xFF1D2129)),
onPressed: () {},
),
],
),
// 内容区域
SliverToBoxAdapter(
child: Column(
children: [
ListView(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.all(16),
children: [
// 机场状态卡片
_buildAirportStatusCard(),
const SizedBox(height: 12),
// 无人机状态卡片
_buildDroneStatusCard(),
const SizedBox(height: 12),
// 快捷操作
_buildQuickActions(),
const SizedBox(height: 20),
],
),
const SizedBox(height: 80), // 为底部 Tab 栏留出空间
],
),
),
],
),
);
}
/// 机场状态卡片
Widget _buildAirportStatusCard() {
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() {
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: [
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: const Color(0xFF00B42A).withOpacity(0.1),
borderRadius: BorderRadius.circular(4),
),
child: const Text(
'在线',
style: TextStyle(
fontSize: 12,
color: Color(0xFF00B42A),
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)'),
],
),
);
}
/// 快捷操作按钮
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),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'快捷操作',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Color(0xFF1D2129),
),
),
const SizedBox(height: 16),
Row(
children: [
Expanded(
child: _buildQuickActionButton(
icon: Icons.flight_takeoff,
label: '开舱',
color: const Color(0xFF165DFF),
onTap: () {},
),
),
const SizedBox(width: 12),
Expanded(
child: _buildQuickActionButton(
icon: Icons.flight,
label: '起飞准备',
color: const Color(0xFF165DFF),
onTap: () {},
),
),
const SizedBox(width: 12),
Expanded(
child: _buildQuickActionButton(
icon: Icons.home,
label: '返航',
color: const Color(0xFFFF7D00),
onTap: () {},
),
),
const SizedBox(width: 12),
Expanded(
child: _buildQuickActionButton(
icon: Icons.task,
label: '任务下发',
color: const Color(0xFF165DFF),
onTap: () {},
),
),
],
),
],
),
);
}
/// 快捷操作按钮
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,
),
),
const SizedBox(height: 8),
Text(
label,
style: const TextStyle(
fontSize: 12,
color: Color(0xFF4E5969),
),
),
],
),
);
}
/// 状态行(带状态标签)
Widget _buildStatusRow(String label, String value, {String? status}) {
return Row(
children: [
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,
),
),
),
],
],
);
}
/// 带进度条的状态行
Widget _buildStatusRowWithProgress(String label, String value, String progress) {
return Row(
children: [
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),
),
],
);
}
/// 气象条件行
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,
),
),
],
);
}
}

View File

@@ -0,0 +1,456 @@
import 'package:flutter/material.dart';
/// 无人机视频回传/远程控制页面
class DroneVideoControlPage extends StatefulWidget {
const DroneVideoControlPage({super.key});
@override
State<DroneVideoControlPage> createState() => _DroneVideoControlPageState();
}
class _DroneVideoControlPageState extends State<DroneVideoControlPage> {
int _selectedTab = 0; // 0: 视频画面, 1: 热成像, 2: 抓拍记录
@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),
),
),
centerTitle: true,
actions: [
IconButton(
icon: const Icon(Icons.settings, color: Color(0xFF1D2129)),
onPressed: () {},
),
],
),
body: Column(
children: [
// Tab切换
_buildTabBar(),
// 内容区域
Expanded(
child: ListView(
padding: const EdgeInsets.all(16),
children: [
// 视频画面
_buildVideoPlayer(),
const SizedBox(height: 12),
// 飞行数据
_buildFlightData(),
const SizedBox(height: 12),
// AI识别结果
_buildAIResults(),
const SizedBox(height: 12),
// 地图和摇杆
_buildMapAndJoystick(),
const SizedBox(height: 16),
// 底部工具栏
_buildBottomToolbar(),
],
),
),
],
),
);
}
/// Tab切换栏
Widget _buildTabBar() {
return Container(
color: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
_buildTabItem('视频画面', 0),
const SizedBox(width: 8),
_buildTabItem('热成像', 1),
const SizedBox(width: 8),
_buildTabItem('抓拍记录', 2),
],
),
);
}
Widget _buildTabItem(String label, int index) {
final isSelected = _selectedTab == index;
return Expanded(
child: GestureDetector(
onTap: () {
setState(() {
_selectedTab = index;
});
},
child: Container(
padding: const EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
color: isSelected ? const Color(0xFF165DFF) : const Color(0xFFF2F3F5),
borderRadius: BorderRadius.circular(8),
),
child: Text(
label,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: isSelected ? Colors.white : const Color(0xFF4E5969),
),
),
),
),
);
}
/// 视频播放器
Widget _buildVideoPlayer() {
return Stack(
children: [
Container(
height: 240,
decoration: BoxDecoration(
color: const Color(0xFF1D2129),
borderRadius: BorderRadius.circular(12),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.asset(
'assets/images/xunjian.png',
fit: BoxFit.cover,
width: double.infinity,
),
),
),
// 录制标识
Positioned(
top: 12,
left: 12,
child: Row(
children: [
Container(
width: 8,
height: 8,
decoration: const BoxDecoration(
color: Color(0xFFF53F3F),
shape: BoxShape.circle,
),
),
const SizedBox(width: 6),
const Text(
'REC 00:12:36',
style: TextStyle(
fontSize: 12,
color: Colors.white,
fontWeight: FontWeight.w500,
),
),
],
),
),
// 缩放标识
Positioned(
bottom: 12,
right: 12,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.5),
borderRadius: BorderRadius.circular(4),
),
child: const Text(
'1.0x',
style: TextStyle(
fontSize: 12,
color: Colors.white,
),
),
),
),
],
);
}
/// 飞行数据
Widget _buildFlightData() {
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: Row(
children: [
_buildDataItem('高度', '78 m'),
const SizedBox(width: 16),
_buildDataItem('速度', '7.5 m/s'),
const SizedBox(width: 16),
_buildDataItem('距离', '1.26 km'),
const SizedBox(width: 16),
_buildDataItem('云台角度', '-15° / 0°'),
],
),
);
}
Widget _buildDataItem(String label, String value) {
return Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: const TextStyle(
fontSize: 12,
color: Color(0xFF86909C),
),
),
const SizedBox(height: 4),
Text(
value,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xFF1D2129),
),
),
],
),
);
}
/// AI识别结果
Widget _buildAIResults() {
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(
'AI 识别结果',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Color(0xFF1D2129),
),
),
const SizedBox(height: 12),
_buildAIResultItem('热斑疑似', '3 处'),
const SizedBox(height: 8),
_buildAIResultItem('组件异常', '2 处'),
],
),
);
}
Widget _buildAIResultItem(String label, String count) {
return GestureDetector(
onTap: () {},
child: Row(
children: [
const Icon(
Icons.warning_amber_rounded,
color: Color(0xFFFF7D00),
size: 20,
),
const SizedBox(width: 8),
Expanded(
child: Text(
label,
style: const TextStyle(
fontSize: 14,
color: Color(0xFF1D2129),
),
),
),
Text(
count,
style: const TextStyle(
fontSize: 14,
color: Color(0xFF4E5969),
),
),
const SizedBox(width: 4),
const Icon(
Icons.chevron_right,
color: Color(0xFF86909C),
size: 20,
),
],
),
);
}
/// 地图和摇杆
Widget _buildMapAndJoystick() {
return Row(
children: [
// 地图
Expanded(
child: Container(
height: 160,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color(0x0D000000),
blurRadius: 8,
offset: Offset(0, 2),
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.asset(
'assets/images/xunjian.png',
fit: BoxFit.cover,
width: double.infinity,
),
),
),
),
const SizedBox(width: 12),
// 摇杆控制器
Expanded(
child: Container(
height: 160,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color(0x0D000000),
blurRadius: 8,
offset: Offset(0, 2),
),
],
),
child: Stack(
alignment: Alignment.center,
children: [
// 中心圆点
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: const Color(0xFFC9CDD4),
shape: BoxShape.circle,
),
),
// 上
Positioned(
top: 16,
child: IconButton(
icon: const Icon(Icons.arrow_drop_up, size: 32, color: Color(0xFF4E5969)),
onPressed: () {},
),
),
// 下
Positioned(
bottom: 16,
child: IconButton(
icon: const Icon(Icons.arrow_drop_down, size: 32, color: Color(0xFF4E5969)),
onPressed: () {},
),
),
// 左
Positioned(
left: 16,
child: IconButton(
icon: const Icon(Icons.arrow_left, size: 32, color: Color(0xFF4E5969)),
onPressed: () {},
),
),
// 右
Positioned(
right: 16,
child: IconButton(
icon: const Icon(Icons.arrow_right, size: 32, color: Color(0xFF4E5969)),
onPressed: () {},
),
),
],
),
),
),
],
);
}
/// 底部工具栏
Widget _buildBottomToolbar() {
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: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buildToolItem(Icons.camera_alt_outlined, '抓拍'),
_buildToolItem(Icons.videocam_outlined, '录像'),
_buildToolItem(Icons.zoom_in_outlined, '变焦'),
_buildToolItem(Icons.lightbulb_outline, '补光灯'),
],
),
);
}
Widget _buildToolItem(IconData icon, String label) {
return GestureDetector(
onTap: () {},
child: Column(
children: [
Icon(icon, size: 28, color: const Color(0xFF4E5969)),
const SizedBox(height: 4),
Text(
label,
style: const TextStyle(
fontSize: 12,
color: Color(0xFF4E5969),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,79 @@
import 'package:flutter/material.dart';
import '../widgets/robot_header_card.dart';
import '../widgets/robot_status_bar.dart';
import '../widgets/robot_control_panel.dart';
import '../widgets/robot_checklist.dart';
import '../widgets/robot_task_info.dart';
import '../widgets/robot_action_buttons.dart';
/// 机器人控制详情页
class RobotControlPage extends StatelessWidget {
final Map<String, dynamic> robot;
const RobotControlPage({super.key, required this.robot});
@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: Text(
'${robot['type']}控制',
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color(0xFF1D2129),
),
),
centerTitle: true,
actions: [
IconButton(
icon: const Icon(Icons.edit_outlined, color: Color(0xFF1D2129)),
onPressed: () {},
),
],
),
body: Column(
children: [
Expanded(
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
children: [
RobotHeaderCard(robot: robot),
const SizedBox(height: 8),
RobotStatusBar(robot: robot),
const SizedBox(height: 8),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
children: [
RobotControlPanel(robot: robot),
const SizedBox(height: 8),
RobotTaskInfo(robot: robot),
],
),
),
const SizedBox(width: 8),
Expanded(child: RobotChecklist(robot: robot)),
],
),
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 20),
child: RobotActionButtons(robot: robot),
),
],
),
);
}
}

View File

@@ -0,0 +1,380 @@
import 'package:flutter/material.dart';
import '../widgets/robot_item_card.dart';
import 'robot_control_page.dart';
import 'cleaning_weeding_robot_task_page.dart';
/// 机器人列表页面
class RobotListPage extends StatefulWidget {
const RobotListPage({super.key});
@override
State<RobotListPage> createState() => _RobotListPageState();
}
class _RobotListPageState extends State<RobotListPage> {
String? _selectedType; // 选中的类型
@override
Widget build(BuildContext context) {
return ListView(
padding: const EdgeInsets.only(bottom: 16),
children: [
_buildStatsCard(),
_buildQuickActions(),
_buildCurrentTask(),
..._buildRobotList(),
],
);
}
Widget _buildStatsCard() {
return Container(
margin: const EdgeInsets.fromLTRB(16, 16, 16, 12),
padding: const EdgeInsets.symmetric(vertical: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [
BoxShadow(
color: Color(0x0D000000),
blurRadius: 8,
offset: Offset(0, 2),
),
],
),
child: Row(
children: [
Expanded(
child: GestureDetector(
onTap: () => setState(() {
_selectedType = _selectedType == '巡检机器人' ? null : '巡检机器人';
}),
child: Column(
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
decoration: BoxDecoration(
gradient: _selectedType == '巡检机器人'
? const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFFE8F4FF),
Color(0xFFFFFFFF),
],
)
: null,
color: _selectedType != '巡检机器人' ? Colors.transparent : null,
borderRadius: BorderRadius.circular(4),
),
child: Text(
'巡检机器人',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: _selectedType == '巡检机器人'
? const Color(0xFF165DFF)
: const Color(0xFF1D2129),
),
),
),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset('assets/images/xunjian.png', width: 48, height: 48),
const SizedBox(width: 8),
const Text('12', style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold, color: Color(0xFF165DFF))),
],
),
const SizedBox(height: 8),
Text(
'在线9台',
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: _selectedType == '巡检机器人'
? const Color(0xFF165DFF)
: const Color(0xFF00B42A),
),
),
],
),
),
),
Container(width: 1, height: 100, color: const Color(0xFFE5E6EB)),
Expanded(
child: GestureDetector(
onTap: () => setState(() {
_selectedType = _selectedType == '清洗机器人' ? null : '清洗机器人';
}),
child: Column(
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
decoration: BoxDecoration(
gradient: _selectedType == '清洗机器人'
? const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFFE8F4FF),
Color(0xFFFFFFFF),
],
)
: null,
color: _selectedType != '清洗机器人' ? Colors.transparent : null,
borderRadius: BorderRadius.circular(4),
),
child: Text(
'清洗机器人',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: _selectedType == '清洗机器人'
? const Color(0xFF165DFF)
: const Color(0xFF1D2129),
),
),
),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset('assets/images/qinxi.png', width: 48, height: 48),
const SizedBox(width: 8),
const Text('8', style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold, color: Color(0xFF165DFF))),
],
),
const SizedBox(height: 8),
Text(
'在线6台',
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: _selectedType == '清洗机器人'
? const Color(0xFF165DFF)
: const Color(0xFF00B42A),
),
),
],
),
),
),
Container(width: 1, height: 100, color: const Color(0xFFE5E6EB)),
Expanded(
child: GestureDetector(
onTap: () => setState(() {
_selectedType = _selectedType == '除草机器人' ? null : '除草机器人';
}),
child: Column(
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
decoration: BoxDecoration(
gradient: _selectedType == '除草机器人'
? const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFFE8F4FF),
Color(0xFFFFFFFF),
],
)
: null,
color: _selectedType != '除草机器人' ? Colors.transparent : null,
borderRadius: BorderRadius.circular(4),
),
child: Text(
'除草机器人',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: _selectedType == '除草机器人'
? const Color(0xFF165DFF)
: const Color(0xFF1D2129),
),
),
),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset('assets/images/chucao.png', width: 48, height: 48),
const SizedBox(width: 8),
Text(
'6',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: _selectedType == '除草机器人'
? const Color(0xFF165DFF)
: const Color(0xFF00B42A),
),
),
],
),
const SizedBox(height: 8),
Text(
'在线4台',
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w500,
color: _selectedType == '除草机器人'
? const Color(0xFF165DFF)
: const Color(0xFF00B42A),
),
),
],
),
),
),
],
),
);
}
Widget _buildQuickActions() {
return Container(
margin: const EdgeInsets.fromLTRB(16, 0, 16, 12),
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: const [BoxShadow(color: Color(0x0D000000), blurRadius: 8, offset: Offset(0, 2))],
),
child: Row(
children: [
_buildStatusItem(value: '19', label: '在线设备', valueColor: const Color(0xFF165DFF)),
Container(width: 1, height: 40, color: const Color(0xFFE5E6EB)),
_buildStatusItem(value: '8', label: '作业中', valueColor: const Color(0xFF00B42A)),
Container(width: 1, height: 40, color: const Color(0xFFE5E6EB)),
_buildStatusItem(value: '12', label: '待命', valueColor: const Color(0xFFFF7D00)),
Container(width: 1, height: 40, color: const Color(0xFFE5E6EB)),
_buildStatusItem(value: '2', label: '故障数', valueColor: const Color(0xFFF53F3F)),
],
),
);
}
Widget _buildStatusItem({required String value, required String label, required Color valueColor}) {
return Expanded(
child: Column(
children: [
Text(value, style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: valueColor)),
const SizedBox(height: 4),
Text(label, style: const TextStyle(fontSize: 13, color: Color(0xFF4E5969))),
],
),
);
}
Widget _buildCurrentTask() {
return Container(
margin: const EdgeInsets.fromLTRB(16, 0, 16, 12),
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: 12),
Row(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Image.asset('assets/images/xunjian.png', width: 80, height: 80, fit: BoxFit.cover),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
const Expanded(child: Text('巡检任务-逆变器区巡检', style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500, color: Color(0xFF1D2129)))),
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
decoration: BoxDecoration(color: const Color(0xFF165DFF).withOpacity(0.1), borderRadius: BorderRadius.circular(4)),
child: const Text('进行中', style: TextStyle(fontSize: 11, color: Color(0xFF165DFF), fontWeight: FontWeight.w500)),
),
],
),
const SizedBox(height: 8),
_buildTaskInfo('机器人:', '巡检机器人-01'),
_buildTaskInfo('区域:', '逆变器区A区'),
_buildTaskInfo('进度:', '62%'),
_buildTaskInfo('预计完成:', '12:30'),
],
),
),
],
),
],
),
);
}
Widget _buildTaskInfo(String label, String value) {
return Padding(
padding: const EdgeInsets.only(bottom: 4),
child: RichText(
text: TextSpan(
children: [
TextSpan(text: label, style: const TextStyle(fontSize: 13, color: Color(0xFF86909C))),
TextSpan(text: value, style: const TextStyle(fontSize: 13, color: Color(0xFF1D2129))),
],
),
),
);
}
List<Widget> _buildRobotList() {
final allRobots = [
{'name': '巡检机器人-01', 'id': 'RB001', 'type': '巡检机器人', 'status': '在线', 'battery': 85.0, 'task': '逆变器区域巡检'},
{'name': '巡检机器人-02', 'id': 'RB002', 'type': '巡检机器人', 'status': '在线', 'battery': 62.0, 'task': '组件区域巡检'},
{'name': '巡检机器人-03', 'id': 'RB003', 'type': '巡检机器人', 'status': '离线', 'battery': 15.0, 'task': '充电中'},
{'name': '清洗机器人-01', 'id': 'RB004', 'type': '清洗机器人', 'status': '在线', 'battery': 78.0, 'task': '组件清洗作业'},
{'name': '清洗机器人-02', 'id': 'RB005', 'type': '清洗机器人', 'status': '在线', 'battery': 91.0, 'task': '待机中'},
{'name': '除草机器人-01', 'id': 'RB006', 'type': '除草机器人', 'status': '在线', 'battery': 55.0, 'task': '光伏板除草'},
];
final filteredRobots = _selectedType == null ? allRobots : allRobots.where((robot) => robot['type'] == _selectedType).toList();
if (filteredRobots.isEmpty) {
return [const Center(child: Padding(padding: EdgeInsets.all(32), child: Text('暂无机器人数据', style: TextStyle(fontSize: 14, color: Color(0xFF86909C)))))];
}
return filteredRobots.map((robot) => RobotItemCard(
name: robot['name'] as String,
id: robot['id'] as String,
type: robot['type'] as String,
status: robot['status'] as String,
battery: robot['battery'] as double,
task: robot['task'] as String,
onTap: () {
// 巡检机器人使用原来的控制页面
// 清洗/除草机器人使用新的任务详情页面
if (robot['type'] == '巡检机器人') {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RobotControlPage(robot: robot),
),
);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CleaningWeedingRobotTaskPage(robot: robot),
),
);
}
},
)).toList();
}
}