集成接口 开始执行任务的领域层和数据层和UI层的开发啊(待测试)
集成功能 暂停 取消功能 恢复功能的接口的领域层和数据层的开发 下一步待集成到页面上 优化功能,优化了接口异常和未知异常对页面渲染的影响对用户的体验的不好情况。具体通过弹窗友好提示! 优化更新了tcp指示灯点击出现机器状态中添加选中设备的编号 方便用户使用的明白明了!。 优化更新关闭了tcp重连操作内链条中的获取用户设备和切换设备操作项。 调整了获取无人机状态信息的更新频率 为14秒一次
This commit is contained in:
@@ -4,12 +4,16 @@ import 'dart:math' as math;
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:syncfusion_flutter_gauges/gauges.dart';
|
||||
|
||||
import '../features/devices/presentation/bloc/device_status_bloc.dart';
|
||||
import '../features/devices/presentation/bloc/device_status_state.dart';
|
||||
import '../features/devices/presentation/bloc/device_status_event.dart';
|
||||
import '../features/devices/presentation/bloc/devices_cubit.dart';
|
||||
import '../features/remote_control/presentation/bloc/remote_control_cubit.dart';
|
||||
import '../features/remote_control/presentation/bloc/remote_control_state.dart';
|
||||
|
||||
const int DATA_TIMEOUT_SECONDS = 5;
|
||||
|
||||
@@ -46,6 +50,16 @@ class _DeviceStatusModalState extends State<DeviceStatusModal> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_startDataTimeoutTimer();
|
||||
// 🔥 页面初始化时自动调用刷新
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_onRefresh();
|
||||
});
|
||||
}
|
||||
|
||||
/// 🔥 刷新函数 - 与刷新按钮共享逻辑
|
||||
void _onRefresh() {
|
||||
context.read<DeviceStatusBloc>().add(DeviceStatusReset());
|
||||
_resetChartData();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -468,14 +482,35 @@ class _DeviceStatusModalState extends State<DeviceStatusModal> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('running_status.title'),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('running_status.title'),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
// 🔥 显示当前TCP认证的设备号
|
||||
BlocBuilder<RemoteControlCubit, RemoteControlState>(
|
||||
builder: (context, state) {
|
||||
var deviceS =
|
||||
state.targetDevice?.deviceName ?? '未选择';
|
||||
return Text(
|
||||
'设备: $deviceS',
|
||||
style: const TextStyle(
|
||||
color: Colors.white70,
|
||||
fontSize: 12,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
@@ -600,12 +635,7 @@ class _DeviceStatusModalState extends State<DeviceStatusModal> {
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh, color: Color(0xFF1677FF)),
|
||||
onPressed: () {
|
||||
context.read<DeviceStatusBloc>().add(
|
||||
DeviceStatusReset(),
|
||||
);
|
||||
_resetChartData();
|
||||
},
|
||||
onPressed: _onRefresh,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user