优化轮播图 发送完成信号
This commit is contained in:
@@ -85,6 +85,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
bool _isRefreshing = false; // 新增:页面刷新状态标志
|
||||
bool _isVideoDialogOpen = false; // 控制视频弹窗显示
|
||||
String _videoStreamUrl = "";
|
||||
bool isStopWork = false; //是否点击过停止
|
||||
Offset _videoPopupPos = const Offset(0, 100); // 弹窗初始位置
|
||||
// 🔥 关键修复:添加截图全局Key
|
||||
final GlobalKey _mapRepaintKey = GlobalKey();
|
||||
@@ -381,23 +382,23 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isStartWork && headingStatus == 0) {
|
||||
if (isStartWork && headingStatus == 0 && !isStopWork) {
|
||||
if (!_showHeadingWarn) {
|
||||
// 仅状态变化时更新,避免重复刷新
|
||||
setState(() => _showHeadingWarn = true);
|
||||
}
|
||||
return;
|
||||
} else if (isStartWork && headingStatus == 1 && _showHeadingWarn) {
|
||||
} else if (isStartWork && headingStatus == 1 && _showHeadingWarn && !isStopWork) {
|
||||
// 条件不满足时隐藏提示
|
||||
setState(() => _showHeadingWarn = false);
|
||||
}
|
||||
|
||||
if (isStartWork && controlMode != "3") {
|
||||
if (isStartWork && controlMode != "3" && !isStopWork) {
|
||||
if (!_showControlModeWarn) {
|
||||
// 仅状态变化时更新
|
||||
setState(() => _showControlModeWarn = true);
|
||||
}
|
||||
} else if (isStartWork && controlMode == "3" && _showControlModeWarn) {
|
||||
} else if (isStartWork && controlMode == "3" && _showControlModeWarn && !isStopWork) {
|
||||
// 条件不满足时隐藏提示
|
||||
setState(() => _showControlModeWarn = false);
|
||||
}
|
||||
@@ -815,6 +816,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
isDjMapShow = false;
|
||||
_workStatus = WorkStatus.idle;
|
||||
isStartWork = false;
|
||||
isStopWork = false;
|
||||
});
|
||||
_clearLocalData();
|
||||
|
||||
@@ -1461,8 +1463,8 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
for (int i = 0; i < gctracePoint!.length - 1; i++)
|
||||
Polyline(
|
||||
points: [gctracePoint![i], gctracePoint![i + 1]],
|
||||
color: Colors.white,
|
||||
strokeWidth: 1.5,
|
||||
color: Colors.blueAccent,
|
||||
strokeWidth: 3,
|
||||
isDotted: true, // 虚线区分作业区域
|
||||
),
|
||||
],
|
||||
@@ -1473,11 +1475,11 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
|
||||
/// 开始作业
|
||||
void _startWork() async {
|
||||
isStopWork = false;
|
||||
if (startWorkList.isEmpty) {
|
||||
ToastUtils.showInfo(context, '作业列表为空,请重新选择路径');
|
||||
return;
|
||||
}
|
||||
isStartWork = true;
|
||||
_traceManager.setMode(TPMode.NAVIGATION);
|
||||
|
||||
setState(() {
|
||||
@@ -1490,7 +1492,6 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
// 🔥 延迟一下,确保状态已更新
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
|
||||
|
||||
//// 步骤1:将 List<LatLng> 转换为 List<DeviceAddPathPointModel>
|
||||
//final List<work_area_model.DeviceAddPathPointModel> pathModels = gcjPathPoints.map((latLng) {
|
||||
// return work_area_model.DeviceAddPathPointModel(
|
||||
@@ -1508,6 +1509,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
|
||||
// 步骤 3:调用 Cubit 方法(类型匹配)
|
||||
await context.read<DevicesCubit>().startRoutePlanning(pathQueue);
|
||||
|
||||
///context.read<DevicesCubit>().updateAppState(AppState.routePlanning);
|
||||
// 可选:显示作业提示
|
||||
ToastUtils.showSuccess(context, '作业已开始');
|
||||
@@ -1530,6 +1532,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
_workStatus = WorkStatus.idle;
|
||||
_showHeadingWarn = false;
|
||||
_showControlModeWarn = false;
|
||||
isStopWork = true; //已经点击过停止
|
||||
});
|
||||
_traceManager.setMode(TPMode.LOCATION);
|
||||
context.read<DevicesCubit>().updateAppState(AppState.none);
|
||||
@@ -1630,6 +1633,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
_showControlModeWarn = false;
|
||||
isStartWork = false;
|
||||
});
|
||||
if (isStopWork) return;
|
||||
_stopWork();
|
||||
},
|
||||
icon: const Icon(Icons.close, color: Colors.grey, size: 20),
|
||||
@@ -1642,30 +1646,30 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 2. 错误提示(如果加载失败)
|
||||
if (state.errorMessage != null)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red[50],
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
border: Border.all(color: Colors.red[200]!),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.error_outline, color: Colors.redAccent, size: 16),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
state.errorMessage!,
|
||||
style: const TextStyle(fontSize: 14, color: Colors.redAccent),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
//if (state.errorMessage != null)
|
||||
// Container(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
// margin: const EdgeInsets.only(bottom: 12),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.red[50],
|
||||
// borderRadius: BorderRadius.circular(6),
|
||||
// border: Border.all(color: Colors.red[200]!),
|
||||
// ),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// const Icon(Icons.error_outline, color: Colors.redAccent, size: 16),
|
||||
// const SizedBox(width: 8),
|
||||
// Expanded(
|
||||
// child: Text(
|
||||
// state.errorMessage!,
|
||||
// style: const TextStyle(fontSize: 14, color: Colors.redAccent),
|
||||
// maxLines: 2,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
|
||||
// 3. 开始作业按钮(加载中禁用)
|
||||
// 放在 Column/Row 的 children: [ ... ] 内部
|
||||
@@ -2034,6 +2038,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
LatLng? targetLatLng;
|
||||
if (arriLatitude != null && arriLongitude != null) {
|
||||
targetLatLng = LatLng(arriLatitude, arriLongitude);
|
||||
debugPrint("${targetLatLng}收到完成点gctracePoint");
|
||||
_traceManager.upsert(targetLatLng, TPAction.ADD);
|
||||
}
|
||||
|
||||
@@ -2043,11 +2048,12 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
int headingStatus = 0;
|
||||
String controlMode = "0";
|
||||
DeviceStatusUpdated? updatedState;
|
||||
//有停止信号
|
||||
if (isFinishWork) {
|
||||
_workStatus = WorkStatus.idle;
|
||||
ToastUtils.showError(context, '作业已停止');
|
||||
isStartWork = false;
|
||||
_traceManager.setMode(TPMode.LOCATION);
|
||||
isStopWork = true;
|
||||
}
|
||||
|
||||
if (state is DeviceStatusUpdated) {
|
||||
|
||||
Reference in New Issue
Block a user