feat(home): 更新完成页面UI并优化串口连接状态管理
- 更新设备屏幕尺寸配置从1920*1080调整为1024x600 - 添加完成页面的AppBar导航和返回功能 - 重构CompletePage布局,使用SafeArea和ConstrainedBox适配不同屏幕 - 添加国际化支持的完成按钮文本 - 优化完成页面视觉元素,包括图标大小和间距调整 - 实现串口连接状态的响应式管理,解决UI状态同步问题 - 优化串口运行器的状态更新逻辑,实现乐观更新机制 - 调整完成页面按钮布局,提供完成和重新运行选项
This commit is contained in:
@@ -66,6 +66,9 @@ class JsonSerialRunner implements Runner {
|
||||
final messageId = _msg.nextId();
|
||||
_pendingCreateTaskId = messageId;
|
||||
final msg = payload.toMessage(messageId, needAck: true);
|
||||
// 乐观更新:与 RunStateNotifier 的运行态保持一致,
|
||||
// 避免在 create_task 应答到达前的窗口里,pause/stop 被状态守卫静默丢弃。
|
||||
status = RunnerStatus.running;
|
||||
DeviceLog.info('Runner.start: program="${program.name}" steps=${steps.length} '
|
||||
'temperature=${program.temperature} airflow=${program.airflowTime}');
|
||||
_msg.send(msg).then((ok) {
|
||||
@@ -132,9 +135,9 @@ class JsonSerialRunner implements Runner {
|
||||
if (ack.ack != _pendingCreateTaskId) return;
|
||||
_pendingCreateTaskId = null;
|
||||
DeviceLog.info('Runner received create_task ack: id=${ack.messageId}');
|
||||
// ack 即视为下位机已接受任务,进入 running 状态
|
||||
if (status == RunnerStatus.idle || status == RunnerStatus.error) {
|
||||
status = RunnerStatus.running;
|
||||
// 状态已由 start() 乐观置为 running,此处仅启动本地兜底倒计时。
|
||||
// 若发送失败,.then() 已将 status 置为 error,不应再启动倒计时。
|
||||
if (status == RunnerStatus.running) {
|
||||
_startLocalTicker();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user