删除撤回逻辑优化完善
This commit is contained in:
@@ -10,6 +10,7 @@ class BottomOperationPanel extends StatefulWidget {
|
||||
// 新增:外部控制初始选中的标签(默认地块)
|
||||
final String initialSelectedTab;
|
||||
final WorkMode initialWorkMode;
|
||||
final bool? canUndo; // 是否可以撤回(控制撤回按钮状态)
|
||||
// 回调函数:向外部传递事件
|
||||
final VoidCallback onComplete; // 完成按钮点击回调
|
||||
final ValueChanged<RobotMode>? onRobotModeChanged; // 机器人模式变更回调
|
||||
@@ -41,6 +42,7 @@ class BottomOperationPanel extends StatefulWidget {
|
||||
this.onDistanceTap,
|
||||
this.onDeleteTap,
|
||||
this.onUndoTap,
|
||||
this.canUndo, // 接收撤回按钮状态
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -52,6 +54,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
|
||||
late AreaMode _areaMode;
|
||||
// 新增:当前选中的标签(地块/航线)- 核心状态
|
||||
late String _currentTab;
|
||||
late bool canUndo;
|
||||
// 新增:航线模式下的作业行距(默认0.5米)
|
||||
double _operationDistance = 0.5;
|
||||
|
||||
@@ -62,6 +65,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
|
||||
_robotMode = widget.initialRobotMode;
|
||||
_areaMode = widget.initialAreaMode;
|
||||
// 初始化选中的标签
|
||||
canUndo = widget.canUndo ?? true;
|
||||
_currentTab = widget.initialSelectedTab;
|
||||
}
|
||||
|
||||
@@ -194,7 +198,7 @@ class _BottomOperationPanelState extends State<BottomOperationPanel> {
|
||||
debugPrint('点击了删除按钮,清空所有打点');
|
||||
widget.onDeleteTap?.call();
|
||||
}),
|
||||
_buildActionButton(Icons.undo_outlined, '撤回', true, () {
|
||||
_buildActionButton(Icons.undo_outlined, '撤回', widget.canUndo ?? true, () {
|
||||
debugPrint('点击了撤回按钮,删除最后一个打点');
|
||||
widget.onUndoTap?.call();
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user