How to create circle on current location in flutter

后端 未结 5 2009
旧时难觅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:22

    This functionality is now available in the google_maps_flutter package:

    https://pub.dev/documentation/google_maps_flutter/latest/google_maps_flutter/Circle-class.html

    Partial example:

    Set circles = Set.from([Circle(
        circleId: CircleId(id),
        center: LatLng(latitude, longitude),
        radius: 4000,
    )]);
    
    GoogleMap(
        mapType: MapType.normal,
        myLocationEnabled: true,
        myLocationButtonEnabled: true,
        initialCameraPosition: initialMapLocation,
        onMapCreated: (GoogleMapController controller) {
          _controller.complete(controller);
        },
        onCameraMove: null,
        circles: circles,
      );
    

提交回复
热议问题