From 58d5e8bf9f694255816f5a4ea050394fc3800986 Mon Sep 17 00:00:00 2001 From: mmc <1556375442@qq.com> Date: Tue, 10 Mar 2026 08:58:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/presentation/widgets/map/testmap_pages.dart | 10 ++++++++-- .../home/presentation/widgets/path_list_pages.dart | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/features/home/presentation/widgets/map/testmap_pages.dart b/lib/features/home/presentation/widgets/map/testmap_pages.dart index 94591b64..a7560142 100644 --- a/lib/features/home/presentation/widgets/map/testmap_pages.dart +++ b/lib/features/home/presentation/widgets/map/testmap_pages.dart @@ -629,8 +629,13 @@ class _MapPageEnterpriseState extends State { // } //} + void _handleGotoLocation() { + _mapController.move(_currentLatLng!, 18); + } + /// =============================== /// 企业级定位初始化(已修复坐标系) + /// Future _initLocationEnterprise() async { // 1. 设置轨迹模式为 LOCATION(核心:确保模式正确) _traceManager.setMode(TPMode.LOCATION); @@ -692,8 +697,8 @@ class _MapPageEnterpriseState extends State { // 4. 重置轨迹管理器 _traceManager.reset(); - if (_isValidLatLng(_mapCenter.latitude, _mapCenter.longitude)) { - _mapController.move(_mapCenter, savedZoom); + if (_currentLatLng != null && _isValidLatLng(_currentLatLng!.latitude, _currentLatLng!.longitude)) { + _mapController.move(_currentLatLng!, savedZoom); } else { // 使用兜底的有效坐标(确保在高德瓦片覆盖范围内) final defaultCenter = _getDefaultValidCenter(); @@ -2154,6 +2159,7 @@ class _MapPageEnterpriseState extends State { _currentWorkMode = mode; debugPrint('外部收到作业模式:$mode'); }, + handleGotoLocation: _handleGotoLocation, onRefreshTap: _handleRefresh, // 推荐用局部刷新 onVideoTap: _handleVideo, ), diff --git a/lib/features/home/presentation/widgets/path_list_pages.dart b/lib/features/home/presentation/widgets/path_list_pages.dart index 56309bfb..8e13eda6 100644 --- a/lib/features/home/presentation/widgets/path_list_pages.dart +++ b/lib/features/home/presentation/widgets/path_list_pages.dart @@ -8,6 +8,7 @@ class VerticalFloatMenu extends StatefulWidget { final ValueChanged? onWorkModeSelected; final VoidCallback? onRefreshTap; // 新增刷新回调 final VoidCallback? onVideoTap; + final VoidCallback? handleGotoLocation; const VerticalFloatMenu({ super.key, @@ -17,6 +18,7 @@ class VerticalFloatMenu extends StatefulWidget { this.onWorkModeSelected, this.onRefreshTap, // 接收刷新回调 this.onVideoTap, + this.handleGotoLocation, }); @override @@ -75,6 +77,9 @@ class _VerticalFloatMenuState extends State { if (index == 1) { widget.onListBox?.call(true); } + if (index == 3) { + widget.handleGotoLocation?.call(); + } if (index == 4) { // 触发外部传入的刷新回调 widget.onRefreshTap?.call();