地图倍率

This commit is contained in:
mmc
2026-03-09 13:42:52 +08:00
parent 36def6006a
commit 3f55de3593

View File

@@ -1186,10 +1186,11 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
mapController: _mapController,
options: MapOptions(
initialCenter: __isValidLatLng(_currentLatLng) ? _currentLatLng! : initCenter,
initialZoom: 22,
maxZoom: 22,
initialZoom: 18,
maxZoom: 18,
minZoom: 3,
enableScrollWheel: true,
// 🔥 视觉放大:通过缩放系数实现"伪20级"显示(无空白)
onTap: (_, __) {}, // 空实现,禁用地图点击响应
),
children: [
@@ -1201,6 +1202,16 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
'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
},
),
maxZoom: 18,
),
// 绘制path折线(Line模式)
@@ -1993,7 +2004,18 @@ class _MapPageEnterpriseState extends State<MapPageEnterprise> {
body: SafeArea(
child: Stack(
children: [
RepaintBoundary(key: _mapRepaintKey, child: _buildMap(currentLat, currentLng, obfFlag, headingStatus, controlMode)),
// 🔥 核心:用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)),
// 地图核心组件
if (_isRefreshing)