优化远程遥控和航向角未初始化的 提醒
This commit is contained in:
@@ -106,6 +106,8 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
bool _directionBoxOpen = false; //航线面板显示/隐藏
|
||||
bool _saveBoxOpen = false; //保存按钮显示/隐藏
|
||||
bool _isListBoxOpen = false; //列表面板显示/隐藏
|
||||
bool _showHeadingWarn = false; // 航向角未初始化提示
|
||||
bool _showControlModeWarn = false; // 远程模式提示
|
||||
// 新增:存储选中的地块(null表示未选中)
|
||||
PlotData? _selectedPlot;
|
||||
PlotDataPath? _selectedPlotPath; // 存储选中地块的路径数据(可选)
|
||||
@@ -361,12 +363,26 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
}
|
||||
|
||||
if (isStartWork && headingStatus == 0) {
|
||||
ToastUtils.showWarn(context, '航向角未初始化');
|
||||
if (!_showHeadingWarn) {
|
||||
// 仅状态变化时更新,避免重复刷新
|
||||
setState(() => _showHeadingWarn = true);
|
||||
}
|
||||
return;
|
||||
} else if (isStartWork && headingStatus == 1 && _showHeadingWarn) {
|
||||
// 条件不满足时隐藏提示
|
||||
setState(() => _showHeadingWarn = false);
|
||||
}
|
||||
|
||||
if (isStartWork && controlMode != "3") {
|
||||
ToastUtils.showWarn(context, '请切换到远程模式');
|
||||
if (!_showControlModeWarn) {
|
||||
// 仅状态变化时更新
|
||||
setState(() => _showControlModeWarn = true);
|
||||
}
|
||||
} else if (isStartWork && controlMode == "3" && _showControlModeWarn) {
|
||||
// 条件不满足时隐藏提示
|
||||
setState(() => _showControlModeWarn = false);
|
||||
}
|
||||
|
||||
//if (isStartWork && obfFlag) {
|
||||
// ObsToastWidget.show(context: context, message: "小迈提醒您前方有障碍物哦!");
|
||||
//} else {
|
||||
@@ -2328,6 +2344,54 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
);
|
||||
},
|
||||
),
|
||||
if (_showHeadingWarn)
|
||||
Positioned(
|
||||
top: 100, // 调整位置,避免遮挡核心内容
|
||||
left: 20,
|
||||
right: 20,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.orange.withOpacity(0.9),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 4, offset: const Offset(0, 2))],
|
||||
),
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(Icons.warning_amber_rounded, color: Colors.white, size: 20),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text('航向角未初始化,无法开始作业', style: TextStyle(color: Colors.white, fontSize: 14)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 2. 远程模式提示
|
||||
if (_showControlModeWarn)
|
||||
Positioned(
|
||||
top: 160, // 与上一个提示错开位置
|
||||
left: 20,
|
||||
right: 20,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.withOpacity(0.9),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 4, offset: const Offset(0, 2))],
|
||||
),
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(Icons.error_rounded, color: Colors.white, size: 20),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text('请切换到远程模式后再开始作业', style: TextStyle(color: Colors.white, fontSize: 14)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
if (_isWorkPanelOpen) _buildWorkPanel(),
|
||||
if (_isVideoDialogOpen) _buildVideoPopup(),
|
||||
|
||||
Reference in New Issue
Block a user