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