修改初始化 弹窗
This commit is contained in:
@@ -77,13 +77,13 @@ class ToastUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 显示错误提示(红色背景 + 85%不透明度)
|
/// 显示错误提示(红色背景 + 85%不透明度)
|
||||||
static void showError(BuildContext context, String message) {
|
static void showError(BuildContext context, String message, {int seconds = 1}) {
|
||||||
showToast(
|
showToast(
|
||||||
context,
|
context,
|
||||||
message,
|
message,
|
||||||
// 红色:0xFFFF5252 → 调整为 0xD9FF5252(D9=85%不透明度)
|
// 红色:0xFFFF5252 → 调整为 0xD9FF5252(D9=85%不透明度)
|
||||||
backgroundColor: const Color(0xD9FF5252),
|
backgroundColor: const Color(0xD9FF5252),
|
||||||
duration: const Duration(seconds: 1),
|
duration: Duration(seconds: seconds),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -331,8 +331,6 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
return LatLngBounds.fromPoints(points);
|
return LatLngBounds.fromPoints(points);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== 新增:移动地图到坐标中心 ==========
|
|
||||||
// ========== 移动地图到坐标中心(无需修改) ==========
|
|
||||||
void moveMapToPointsCenter(List<LatLng> points) {
|
void moveMapToPointsCenter(List<LatLng> points) {
|
||||||
if (points.isEmpty || !mounted) return;
|
if (points.isEmpty || !mounted) return;
|
||||||
|
|
||||||
@@ -522,9 +520,6 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
debugPrint('====================================');
|
debugPrint('====================================');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 保存地块数据的核心方法(这里写你的实际保存逻辑)
|
|
||||||
// 🔥 关键修改:增加 imgBase64 参数
|
|
||||||
// 🔥 新的保存方法,严格匹配后端结构
|
|
||||||
Future<void> _savePlotData(String plotName, String? imgBase64) async {
|
Future<void> _savePlotData(String plotName, String? imgBase64) async {
|
||||||
// 1. 获取用户ID
|
// 1. 获取用户ID
|
||||||
final userId = context.read<AppUserCubit>().state.user?.userId ?? "";
|
final userId = context.read<AppUserCubit>().state.user?.userId ?? "";
|
||||||
@@ -973,7 +968,6 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔥 改动2:修改 _buildPlotListItem 方法,增加删除时调用Bloc的逻辑
|
|
||||||
Widget _buildPlotListItem(PlotData plot, Function(PlotData) onDelete) {
|
Widget _buildPlotListItem(PlotData plot, Function(PlotData) onDelete) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
// 核心:点击列表项触发选中逻辑
|
// 核心:点击列表项触发选中逻辑
|
||||||
@@ -1646,30 +1640,73 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
// 2. 错误提示(如果加载失败)
|
// 2. 错误提示(如果加载失败)
|
||||||
//if (state.errorMessage != null)
|
if (startWorkList.isEmpty || _showHeadingWarn)
|
||||||
// Container(
|
Row(
|
||||||
// padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// margin: const EdgeInsets.only(bottom: 12),
|
children: [
|
||||||
// decoration: BoxDecoration(
|
// 路径为空提示 50%
|
||||||
// color: Colors.red[50],
|
if (startWorkList.isEmpty)
|
||||||
// borderRadius: BorderRadius.circular(6),
|
Expanded(
|
||||||
// border: Border.all(color: Colors.red[200]!),
|
flex: 1,
|
||||||
// ),
|
child: Container(
|
||||||
// child: Row(
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
// children: [
|
margin: const EdgeInsets.only(right: 6, bottom: 12),
|
||||||
// const Icon(Icons.error_outline, color: Colors.redAccent, size: 16),
|
decoration: BoxDecoration(
|
||||||
// const SizedBox(width: 8),
|
color: Colors.red[50],
|
||||||
// Expanded(
|
borderRadius: BorderRadius.circular(6),
|
||||||
// child: Text(
|
border: Border.all(color: Colors.red[200]!),
|
||||||
// state.errorMessage!,
|
),
|
||||||
// style: const TextStyle(fontSize: 14, color: Colors.redAccent),
|
child: const Row(
|
||||||
// maxLines: 2,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// overflow: TextOverflow.ellipsis,
|
children: [
|
||||||
// ),
|
Icon(Icons.error_outline, color: Colors.redAccent, size: 16),
|
||||||
// ),
|
SizedBox(width: 8),
|
||||||
// ],
|
Expanded(
|
||||||
// ),
|
child: Text(
|
||||||
// ),
|
"路径区域为空",
|
||||||
|
style: TextStyle(fontSize: 14, color: Colors.redAccent),
|
||||||
|
softWrap: true,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// 航向异常提示 50%
|
||||||
|
if (_showHeadingWarn)
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
|
margin: const EdgeInsets.only(left: 6, bottom: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.red[50],
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
border: Border.all(color: Colors.red[200]!),
|
||||||
|
),
|
||||||
|
child: const Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.error_outline, color: Colors.redAccent, size: 16),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"航向信息异常",
|
||||||
|
style: TextStyle(fontSize: 14, color: Colors.redAccent),
|
||||||
|
softWrap: true,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
// 3. 开始作业按钮(加载中禁用)
|
// 3. 开始作业按钮(加载中禁用)
|
||||||
// 放在 Column/Row 的 children: [ ... ] 内部
|
// 放在 Column/Row 的 children: [ ... ] 内部
|
||||||
@@ -1678,10 +1715,9 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: state.isLoading || startWorkList.isEmpty
|
onPressed: state.isLoading || startWorkList.isEmpty || _showHeadingWarn
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
// 开始作业逻辑
|
|
||||||
_startWork();
|
_startWork();
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
|||||||
Reference in New Issue
Block a user