扑谷歌地图标记当前位置

时间:2020-07-02 15:43:03

标签: flutter marker

我该如何使用goolge地图的当前位置样式标记,甚至可以显示当前位置的方向?

这是我的代码,我的代码的标记样式只是一针 具有Google地图的标记样式甚至可以显示当前位置的方向。

 _markerSet.add(
    Marker(
      markerId: MarkerId('current_Postion'),
      infoWindow: InfoWindow(title: 'Current Position'),
      position: _userCurrentPositionLatLng,
      icon: BitmapDescriptor.defaultMarkerWithHue(
        BitmapDescriptor.hueGreen,
      ),
    ),

这是我的标记的样子 enter image description here

这是我想要的Google标记 enter image description here

有任何建议提示吗?

1 个答案:

答案 0 :(得分:1)

编辑:myLocationEnabled: true,小部件上设置GoogleMap。它将自动进行处理。

这适用于自定义标记:
您无法直接从Google Map获取位置。
您可以使用此location包来获取用户的位置(经度和纬度),然后将标记相应地添加到地图。