Reputation: 65
How I could draw a circle around a CurrentLocationLayer from the package flutter_map_location_marker?
This is what I have so far:
Widget userLocationMarker(){
return CurrentLocationLayer(
style: LocationMarkerStyle(
showAccuracyCircle: false,
marker: DefaultLocationMarker(
child: CircleLayer(
circles: [
CircleMarker(
point: LatLng(initialPosition.latitude, initialPosition.Longitude),
radius: 15,
useRadiusInMeter: true
color: Colors.black54
)
]
),
),
)
);
}
The variable initialPosition is from using GeoLocator.getCurrentPosition() when the map page is initialised.
This kind of works, but the only issue is that panning the map moves the circle off of the marker.
With respect to it's physical position on the physical screen, the circle moves in the same direction as the marker when the map is panned, it just moves twice as fast!
I guess maybe because the circleLayer is being panned twice, once with the map movement and once with the location marker?
Is there any way I can stop the circle from moving off the marker when the map is panned? or an alternative way to display the circle?
I can't use CustomPainter because I need the circle to have a radius showing real world meters.
Upvotes: 1
Views: 190