0

我在 Flutter 应用程序的 HERE 地图上显示了多个位置。总共有 4 个标记,其中 3 个标记在一个城市,1 个在另一个城市。目前,我的地图缩放到一个城市中只有 3 个标记可见,而第 4 个不可见的级别。为了看到那个标记,我必须缩小一个相当大的水平。

有没有办法,我可以显示地图范围内的所有标记?

我得到了 android 的答案,但没有 Flutter 的答案。

Zoom HERE 地图以显示所有标记 Android

4

1 回答 1

1

基于android 上的这个答案。我已经尝试过颤振并且它奏效了。

 GeoBox target = GeoBox.containingGeoCoordinates(geoCoordinateList);
_hereMapController.camera
      .lookAtAreaWithOrientation(target, MapCameraOrientationUpdate(20, 0));

geoCoordinateList是一个可见GeoCoordinates的列表MapMarkerHERE map

如果您在单击按钮时使用它,请直接使用它。如果您在将地理坐标添加到 geoCoordinateList 后直接使用它,则延迟使用它

Future.delayed(Duration(milliseconds: 10)).then((value) {
  GeoBox target = GeoBox.containingGeoCoordinates(geoCooList);
  _hereMapController.camera
      .lookAtAreaWithOrientation(target, MapCameraOrientationUpdate(20, 0));
});
于 2021-01-13T05:06:03.740 回答