定位的逻辑
This commit is contained in:
@@ -629,8 +629,13 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
void _handleGotoLocation() {
|
||||||
|
_mapController.move(_currentLatLng!, 18);
|
||||||
|
}
|
||||||
|
|
||||||
/// ===============================
|
/// ===============================
|
||||||
/// 企业级定位初始化(已修复坐标系)
|
/// 企业级定位初始化(已修复坐标系)
|
||||||
|
///
|
||||||
Future<void> _initLocationEnterprise() async {
|
Future<void> _initLocationEnterprise() async {
|
||||||
// 1. 设置轨迹模式为 LOCATION(核心:确保模式正确)
|
// 1. 设置轨迹模式为 LOCATION(核心:确保模式正确)
|
||||||
_traceManager.setMode(TPMode.LOCATION);
|
_traceManager.setMode(TPMode.LOCATION);
|
||||||
@@ -692,8 +697,8 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
|
|
||||||
// 4. 重置轨迹管理器
|
// 4. 重置轨迹管理器
|
||||||
_traceManager.reset();
|
_traceManager.reset();
|
||||||
if (_isValidLatLng(_mapCenter.latitude, _mapCenter.longitude)) {
|
if (_currentLatLng != null && _isValidLatLng(_currentLatLng!.latitude, _currentLatLng!.longitude)) {
|
||||||
_mapController.move(_mapCenter, savedZoom);
|
_mapController.move(_currentLatLng!, savedZoom);
|
||||||
} else {
|
} else {
|
||||||
// 使用兜底的有效坐标(确保在高德瓦片覆盖范围内)
|
// 使用兜底的有效坐标(确保在高德瓦片覆盖范围内)
|
||||||
final defaultCenter = _getDefaultValidCenter();
|
final defaultCenter = _getDefaultValidCenter();
|
||||||
@@ -2154,6 +2159,7 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
|
|||||||
_currentWorkMode = mode;
|
_currentWorkMode = mode;
|
||||||
debugPrint('外部收到作业模式:$mode');
|
debugPrint('外部收到作业模式:$mode');
|
||||||
},
|
},
|
||||||
|
handleGotoLocation: _handleGotoLocation,
|
||||||
onRefreshTap: _handleRefresh, // 推荐用局部刷新
|
onRefreshTap: _handleRefresh, // 推荐用局部刷新
|
||||||
onVideoTap: _handleVideo,
|
onVideoTap: _handleVideo,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class VerticalFloatMenu extends StatefulWidget {
|
|||||||
final ValueChanged<WorkMode>? onWorkModeSelected;
|
final ValueChanged<WorkMode>? onWorkModeSelected;
|
||||||
final VoidCallback? onRefreshTap; // 新增刷新回调
|
final VoidCallback? onRefreshTap; // 新增刷新回调
|
||||||
final VoidCallback? onVideoTap;
|
final VoidCallback? onVideoTap;
|
||||||
|
final VoidCallback? handleGotoLocation;
|
||||||
|
|
||||||
const VerticalFloatMenu({
|
const VerticalFloatMenu({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -17,6 +18,7 @@ class VerticalFloatMenu extends StatefulWidget {
|
|||||||
this.onWorkModeSelected,
|
this.onWorkModeSelected,
|
||||||
this.onRefreshTap, // 接收刷新回调
|
this.onRefreshTap, // 接收刷新回调
|
||||||
this.onVideoTap,
|
this.onVideoTap,
|
||||||
|
this.handleGotoLocation,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -75,6 +77,9 @@ class _VerticalFloatMenuState extends State<VerticalFloatMenu> {
|
|||||||
if (index == 1) {
|
if (index == 1) {
|
||||||
widget.onListBox?.call(true);
|
widget.onListBox?.call(true);
|
||||||
}
|
}
|
||||||
|
if (index == 3) {
|
||||||
|
widget.handleGotoLocation?.call();
|
||||||
|
}
|
||||||
if (index == 4) {
|
if (index == 4) {
|
||||||
// 触发外部传入的刷新回调
|
// 触发外部传入的刷新回调
|
||||||
widget.onRefreshTap?.call();
|
widget.onRefreshTap?.call();
|
||||||
|
|||||||
Reference in New Issue
Block a user