我在我的应用程序中使用flutter_map来显示带有标记的地图。问题是,当我缩放地图时,标记会移动,而不是停留在它们的位置上。每个标记周围都有一个CircleMarker,很快就会明显地发现它们没有正确居中(请参见下面的图像)。如何正确地固定标记图标,使其在缩放地图时不会移动?近距离标记:
缩小的标记:
进一步缩小视图的标记:
制作标记的代码:
Marker marker = Marker(
point:
LatLng(alertLatitude, alertLongitude),
width: 50,
height: 50,
anchorPos: AnchorPos.align(AnchorAlign.center),
builder: (context) => Icon(
Icons.location_on_sharp,
size: 60,
color: Color(aquarium),
));
制作FlutterMap的代码:
FlutterMap(
mapController: _mapController,
options: MapOptions(
center: determineMapStartLocation(),
zoom: 14,
plugins: [MarkerClusterPlugin()],
onTap: (_, __) => _popupController.hideAllPopups(),
),
layers: [
TileLayerOptions(
minZoom: 1,
maxZoom: 20,
backgroundColor: Colors.white,
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
subdomains: ['a', 'b', 'c'],
),
CircleLayerOptions(
circles: alertCirclesList,
),
MarkerClusterLayerOptions(
maxClusterRadius: 190,
disableClusteringAtZoom: 12,
size: Size(90, 90),
fitBoundsOptions: FitBoundsOptions(
padding: EdgeInsets.all(50),
),
markers: _alertMarkers,
...
)]);