diff --git a/lib/features/home/presentation/widgets/map/testmap_pages.dart b/lib/features/home/presentation/widgets/map/testmap_pages.dart index 81a63868..df055b92 100644 --- a/lib/features/home/presentation/widgets/map/testmap_pages.dart +++ b/lib/features/home/presentation/widgets/map/testmap_pages.dart @@ -1195,23 +1195,17 @@ class _MapPageEnterpriseState extends State { ), children: [ /// 高德瓦片(GCJ-02) - TileLayer( - //https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1' - // '&key=bbb1f0f20eed6bf679eddf2625630aba - urlTemplate: - 'https://webrd02.is.autonavi.com/appmaptile' - '?style=8&x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1' - '&key=bbb1f0f20eed6bf679eddf2625630aba', - // 🔥 修复:适配高DPI(替代pixelRatio) - // tileSize: 512, // 高清瓦片尺寸(默认256,改为512适配scale=2) - tileProvider: NetworkTileProvider( - // 自定义瓦片请求头(可选,提升兼容性) - headers: { - 'Referer': 'https://www.amap.com', // 高德要求的Referer - }, + Transform.scale( + scale: 1.5, // 地图背景放大1.5倍(可调整:1.2/1.3/1.5) + alignment: Alignment.center, // 以地图中心为缩放原点,避免偏移 + child: TileLayer( + urlTemplate: + 'https://webrd02.is.autonavi.com/appmaptile' + '?style=8&x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1' // 高清瓦片保证放大后不模糊 + '&key=bbb1f0f20eed6bf679eddf2625630aba', + tileProvider: NetworkTileProvider(headers: {'Referer': 'https://www.amap.com'}), + maxZoom: 18, ), - - maxZoom: 18, ), // 绘制path折线(Line模式) @@ -1272,7 +1266,7 @@ class _MapPageEnterpriseState extends State { ), /// 当前定位 Marker - if (_currentLatLng != null) + if (_currentLatLng != null && __isValidLatLng(_currentLatLng)) MarkerLayer( markers: [ Marker( @@ -2005,17 +1999,17 @@ class _MapPageEnterpriseState extends State { child: Stack( children: [ // 🔥 核心:用Transform.scale实现视觉放大1.5倍 - Transform.scale( - scale: 1.5, // 放大倍数 - // 对齐方式:以地图中心为缩放原点(避免偏移) - alignment: Alignment.center, - child: RepaintBoundary( - key: _mapRepaintKey, - // 你的地图构建方法 - child: _buildMap(currentLat, currentLng, obfFlag, headingStatus, controlMode), - ), - ), - //RepaintBoundary(key: _mapRepaintKey, child: _buildMap(currentLat, currentLng, obfFlag, headingStatus, controlMode)), + //Transform.scale( + // scale: 1.5, // 放大倍数 + // // 对齐方式:以地图中心为缩放原点(避免偏移) + // alignment: Alignment.center, + // child: RepaintBoundary( + // key: _mapRepaintKey, + // // 你的地图构建方法 + // child: _buildMap(currentLat, currentLng, obfFlag, headingStatus, controlMode), + // ), + //), + RepaintBoundary(key: _mapRepaintKey, child: _buildMap(currentLat, currentLng, obfFlag, headingStatus, controlMode)), // 地图核心组件 if (_isRefreshing)