无人机视频对接+支持无人机未在线时候5S执行一下查询操作。便于视频正常展示。
无人机视频的摄像头切换功能和参数切换功能(广角和红外 和等) 无人机航线任务创建页面的开发和接口对接 无人机航线任务搜索接口(支持时间过滤) 无人机执行航线任务功能开发和接口对接 无人机暂停执行任务功能开发和接口对接 无人机返航任务和取消返航功能开发和接口对接 无人机机场详情页中的展示信息的更正。
This commit is contained in:
@@ -3,7 +3,9 @@ import '../pages/drone_mission_control_page.dart';
|
||||
|
||||
/// 无人机机场与设备状态组件
|
||||
class DroneStationStatusWidget extends StatelessWidget {
|
||||
const DroneStationStatusWidget({super.key});
|
||||
final String? droneSn; // 无人机序列号
|
||||
|
||||
const DroneStationStatusWidget({super.key, this.droneSn});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -220,7 +222,8 @@ class DroneStationStatusWidget extends StatelessWidget {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const DroneMissionControlPage(),
|
||||
builder: (context) =>
|
||||
DroneMissionControlPage(droneSn: droneSn),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -252,19 +255,12 @@ class DroneStationStatusWidget extends StatelessWidget {
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: color,
|
||||
size: 24,
|
||||
),
|
||||
child: Icon(icon, color: color, size: 24),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
style: const TextStyle(fontSize: 12, color: Color(0xFF4E5969)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -277,10 +273,7 @@ class DroneStationStatusWidget extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
style: const TextStyle(fontSize: 13, color: Color(0xFF86909C)),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
@@ -314,15 +307,16 @@ class DroneStationStatusWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// 带进度条的状态行
|
||||
Widget _buildStatusRowWithProgress(String label, String value, String progress) {
|
||||
Widget _buildStatusRowWithProgress(
|
||||
String label,
|
||||
String value,
|
||||
String progress,
|
||||
) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
style: const TextStyle(fontSize: 13, color: Color(0xFF86909C)),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
@@ -343,11 +337,7 @@ class DroneStationStatusWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
const Icon(Icons.arrow_forward_ios, size: 12, color: Color(0xFF86909C)),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -358,10 +348,7 @@ class DroneStationStatusWidget extends StatelessWidget {
|
||||
children: [
|
||||
const Text(
|
||||
'气象条件',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
style: TextStyle(fontSize: 13, color: Color(0xFF86909C)),
|
||||
),
|
||||
const Spacer(),
|
||||
Row(
|
||||
@@ -379,18 +366,12 @@ class DroneStationStatusWidget extends StatelessWidget {
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
'25°C',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
style: TextStyle(fontSize: 13, color: Color(0xFF1D2129)),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
'东南风 2级',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
style: TextStyle(fontSize: 13, color: Color(0xFF1D2129)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -404,10 +385,7 @@ class DroneStationStatusWidget extends StatelessWidget {
|
||||
children: [
|
||||
const Text(
|
||||
'电量',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF86909C),
|
||||
),
|
||||
style: TextStyle(fontSize: 13, color: Color(0xFF86909C)),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
@@ -416,7 +394,9 @@ class DroneStationStatusWidget extends StatelessWidget {
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.78,
|
||||
backgroundColor: const Color(0xFFF2F3F5),
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(Color(0xFF00B42A)),
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(
|
||||
Color(0xFF00B42A),
|
||||
),
|
||||
minHeight: 6,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import '../../../../../core/consts/http_api_consts.dart';
|
||||
import '../../domain/entities/flight_task_entity.dart';
|
||||
import '../pages/create_task_page.dart';
|
||||
|
||||
class FlightTaskSelectorModal extends StatefulWidget {
|
||||
final String currentGatewaySn;
|
||||
@@ -40,16 +41,49 @@ class _FlightTaskSelectorModalState extends State<FlightTaskSelectorModal> {
|
||||
}
|
||||
|
||||
Future<void> _selectDateRange(BuildContext context) async {
|
||||
final picked = await showDateRangePicker(
|
||||
// 先选择日期范围
|
||||
final pickedDate = await showDateRangePicker(
|
||||
context: context,
|
||||
firstDate: DateTime(2020),
|
||||
lastDate: DateTime(2030),
|
||||
initialDateRange: _selectedDateRange,
|
||||
);
|
||||
if (picked != null) {
|
||||
setState(() {
|
||||
_selectedDateRange = picked;
|
||||
});
|
||||
|
||||
if (pickedDate != null) {
|
||||
// 选择开始时间(时分秒)
|
||||
final startTime = await showTimePicker(
|
||||
context: context,
|
||||
initialTime: TimeOfDay.fromDateTime(pickedDate.start),
|
||||
);
|
||||
|
||||
if (startTime != null) {
|
||||
// 选择结束时间(时分秒)
|
||||
final endTime = await showTimePicker(
|
||||
context: context,
|
||||
initialTime: const TimeOfDay(hour: 23, minute: 59),
|
||||
);
|
||||
|
||||
if (endTime != null) {
|
||||
setState(() {
|
||||
_selectedDateRange = DateTimeRange(
|
||||
start: DateTime(
|
||||
pickedDate.start.year,
|
||||
pickedDate.start.month,
|
||||
pickedDate.start.day,
|
||||
startTime.hour,
|
||||
startTime.minute,
|
||||
),
|
||||
end: DateTime(
|
||||
pickedDate.end.year,
|
||||
pickedDate.end.month,
|
||||
pickedDate.end.day,
|
||||
endTime.hour,
|
||||
endTime.minute,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +129,7 @@ class _FlightTaskSelectorModalState extends State<FlightTaskSelectorModal> {
|
||||
data.forEach((sn, value) {
|
||||
if (value != null && value['list'] != null) {
|
||||
final list = value['list'] as List<dynamic>;
|
||||
print(' [FlightTask] API返回的原始数据: $list');
|
||||
result[sn] = list.map((item) => FlightTaskEntity.fromJson(item)).toList();
|
||||
} else {
|
||||
result[sn] = null;
|
||||
@@ -129,15 +164,30 @@ class _FlightTaskSelectorModalState extends State<FlightTaskSelectorModal> {
|
||||
const SizedBox(height: 12),
|
||||
_buildDeviceSelector(),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: _isLoading ? null : _loadTasks,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF165DFF),
|
||||
minimumSize: const Size(double.infinity, 48),
|
||||
),
|
||||
child: _isLoading
|
||||
? const CircularProgressIndicator(color: Colors.white)
|
||||
: const Text('查询任务'),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
onPressed: _isLoading ? null : _loadTasks,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF165DFF),
|
||||
minimumSize: const Size(double.infinity, 48),
|
||||
),
|
||||
child: _isLoading
|
||||
? const CircularProgressIndicator(color: Colors.white)
|
||||
: const Text('查询任务'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
ElevatedButton(
|
||||
onPressed: _showCreateTaskDialog,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF00B42A),
|
||||
minimumSize: const Size(48, 48),
|
||||
),
|
||||
child: const Icon(Icons.add, color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (_errorMessage != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
@@ -173,7 +223,7 @@ class _FlightTaskSelectorModalState extends State<FlightTaskSelectorModal> {
|
||||
Expanded(
|
||||
child: Text(
|
||||
_selectedDateRange != null
|
||||
? '${_formatDate(_selectedDateRange!.start)} - ${_formatDate(_selectedDateRange!.end)}'
|
||||
? '${_formatDateTimeFull(_selectedDateRange!.start)} -\n${_formatDateTimeFull(_selectedDateRange!.end)}'
|
||||
: '选择时间范围',
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
@@ -307,6 +357,11 @@ class _FlightTaskSelectorModalState extends State<FlightTaskSelectorModal> {
|
||||
return '${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
String _formatDateTimeFull(DateTime dateTime) {
|
||||
return '${dateTime.year}-${dateTime.month.toString().padLeft(2, '0')}-${dateTime.day.toString().padLeft(2, '0')} '
|
||||
'${dateTime.hour.toString().padLeft(2, '0')}:${dateTime.minute.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
String _formatDateTime(String dateTimeStr) {
|
||||
try {
|
||||
final dateTime = DateTime.parse(dateTimeStr);
|
||||
@@ -315,4 +370,15 @@ class _FlightTaskSelectorModalState extends State<FlightTaskSelectorModal> {
|
||||
return dateTimeStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 显示创建任务对话框
|
||||
void _showCreateTaskDialog() {
|
||||
Navigator.pop(context); // 先关闭当前模态页
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CreateTaskPage(sn: widget.currentGatewaySn),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user