路径规划和设备详情界面信息展示
This commit is contained in:
@@ -354,13 +354,20 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
);
|
||||
}
|
||||
|
||||
// ========== 新增:返回上一级页面的方法 ==========
|
||||
void _navigateBack() {
|
||||
// 关闭当前页面,返回上一级
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_positionSub?.cancel();
|
||||
_traceManager.reset();
|
||||
_mapController.dispose();
|
||||
_sub?.cancel();
|
||||
|
||||
// 修复:_sub 是 non-null 类型,直接 cancel 无需 ?
|
||||
_sub.cancel();
|
||||
_plotNameController.dispose(); // 新增:释放文本控制器资源
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -673,8 +680,6 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
),
|
||||
|
||||
/// ========== 新增:中心标与历史打点的虚线连线 ==========
|
||||
///
|
||||
/// if (_markedPoints.length >= 2)
|
||||
PolylineLayer(
|
||||
polylines: [
|
||||
for (int i = 0; i < _markedPoints.length - 1; i++)
|
||||
@@ -771,6 +776,53 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
],
|
||||
),
|
||||
|
||||
// ========== 悬浮返回按钮(核心修改) ==========
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 10,
|
||||
child: GestureDetector(
|
||||
// 自定义点击事件
|
||||
onTap: _navigateBack,
|
||||
// 自定义点击反馈(替代 IconButton 的高亮/水波纹)
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.8),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black12,
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
// 核心:用 Stack 实现点击高亮层 + 图标层
|
||||
child: Stack(
|
||||
alignment: Alignment.center, // 所有子组件居中
|
||||
children: [
|
||||
// 1. 点击高亮层(默认隐藏,点击时显示)
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent, // 默认透明
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 2. 图标层(绝对居中)
|
||||
const Icon(
|
||||
Icons.arrow_back_ios,
|
||||
color: Colors.black87,
|
||||
size: 20,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
/// ========== 核心:地图正中心固定定位标 ==========
|
||||
Positioned(
|
||||
left: 0,
|
||||
@@ -788,45 +840,37 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
//保存按钮
|
||||
if (_saveBoxOpen)
|
||||
Positioned(
|
||||
left: 16,
|
||||
right: 80,
|
||||
top: maxTop > 10 ? 11 : maxTop,
|
||||
child: // 改用小尺寸按钮容器,替代默认大尺寸FloatingActionButton
|
||||
Container(
|
||||
width: 40, // 按钮宽度(默认FAB是56,改为40更小巧)
|
||||
height: 40, // 按钮高度
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF00C853), // 保留绿色主题
|
||||
shape: BoxShape.circle, // 圆形
|
||||
color: const Color(0xFF00C853),
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black12,
|
||||
blurRadius: 4, // 对应elevation:4的阴影效果
|
||||
offset: const Offset(0, 2), // 阴影偏移
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
_showSavePlotDialog();
|
||||
//// 点击保存按钮的逻辑
|
||||
//// 1. 可以直接调用保存方法
|
||||
//_saveCurrentPath();
|
||||
//// 2. 也可以弹出输入框让用户输入路径名称(推荐)
|
||||
//_showSavePathDialog();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.save,
|
||||
color: Colors.white,
|
||||
size: 18, // 图标尺寸缩小(原20→18)
|
||||
),
|
||||
padding: EdgeInsets.zero, // 移除IconButton默认内边距
|
||||
constraints: const BoxConstraints(), // 解除IconButton尺寸限制
|
||||
icon: const Icon(Icons.save, color: Colors.white, size: 18),
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 右侧悬浮菜单
|
||||
Positioned(
|
||||
height: 336,
|
||||
@@ -852,7 +896,6 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
),
|
||||
),
|
||||
),
|
||||
//开始作业面板
|
||||
|
||||
// 底部操作面板
|
||||
if (_isPanelOpen)
|
||||
@@ -879,13 +922,12 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
setState(() => _currentAreaMode = mode);
|
||||
debugPrint('外部收到区域模式:$mode');
|
||||
},
|
||||
// ========== 绑定加号打点事件 ==========
|
||||
onAddTap: () {
|
||||
_addMarkedPoint(); // 点击加号打点
|
||||
_addMarkedPoint();
|
||||
debugPrint('外部处理加号按钮点击,已添加打点');
|
||||
},
|
||||
onDistanceTap: (distance) {
|
||||
_workDistance = distance; // 更新距离状态
|
||||
_workDistance = distance;
|
||||
debugPrint(
|
||||
'外部处理作业行距距离设置,当前距离:${distance.toStringAsFixed(1)}米',
|
||||
);
|
||||
@@ -920,7 +962,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
);
|
||||
_angle = result['optimalHeading'] == true
|
||||
? -1
|
||||
: result['direction']; // 更新航线方向角状态
|
||||
: result['direction'];
|
||||
debugPrint('外部处理航线方向设置,当前角度:${_angle}');
|
||||
setState(() => _directionBoxOpen = false);
|
||||
},
|
||||
@@ -929,14 +971,13 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
},
|
||||
),
|
||||
),
|
||||
// 在build方法的Stack中添加抽屉组件
|
||||
|
||||
// 列表面板
|
||||
if (_isListBoxOpen)
|
||||
// 半透明背景 + 底部抽屉
|
||||
Positioned.fill(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
// 1. 半透明遮罩(点击关闭抽屉)
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
@@ -947,14 +988,12 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
child: Container(color: Colors.black.withOpacity(0.3)),
|
||||
),
|
||||
),
|
||||
|
||||
// 2. 底部抽屉主体
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.vertical(
|
||||
top: Radius.circular(16), // 顶部圆角
|
||||
top: Radius.circular(16),
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
@@ -964,14 +1003,12 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
),
|
||||
],
|
||||
),
|
||||
// 限制抽屉高度(可自定义)
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: 600,
|
||||
minHeight: 200,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// 顶部标题栏
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
@@ -980,7 +1017,6 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// 标题:显示数据总数
|
||||
Text(
|
||||
'地块列表(共${_plotList.length}条)',
|
||||
style: const TextStyle(
|
||||
@@ -989,8 +1025,6 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
|
||||
// 关闭按钮
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
@@ -1006,14 +1040,10 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const Divider(height: 1, color: Colors.grey),
|
||||
|
||||
// 列表内容(可滚动)
|
||||
Expanded(
|
||||
child: _plotList.isEmpty
|
||||
? // 空数据提示
|
||||
const Center(
|
||||
? const Center(
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
@@ -1034,8 +1064,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
||||
],
|
||||
),
|
||||
)
|
||||
: // 列表项
|
||||
ListView.builder(
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user