How to create circle on current location in flutter

后端 未结 5 2014
旧时难觅i
旧时难觅i 2021-02-07 07:06

I am working on flutter project.On which I have to draw one circle on my current location on google map.Does any one have idea.

I want like this in flutter

5条回答
  •  余生分开走
    2021-02-07 07:46

    One way to do this is by changing the icon of the Marker

                mapController.addMarker(MarkerOptions(
                    position: LatLng(37.4219999, -122.0862462),
                    icon: BitmapDescriptor.fromAsset('images/circle.png',),
                  ),);
    

    After setting appropriate permission on android/ios, set trackCameraPosition: true and myLocationEnabled: true on google maps options, after that you can add your image in current location by following code

               mapController.addMarker(MarkerOptions(
                    position: mapController.cameraPosition.target,
                    icon: BitmapDescriptor.fromAsset('images/circle.png',),
                  ),);
    

    Here is an excellent article which explains all possible things you can do with Google Maps for Flutter (Developers Preview) plugin article

提交回复
热议问题