I am displaying a map with flutter maps. Currently I have a marker plotted on a specific long and lat.
I am trying to implement a feature where users can press a button and then they will be back to the marker position even when they have moved far away
I implemented at button as below:
Align(
alignment: Alignment(0.94, 0.95),
child: Container(
child: IconButton(
onPressed: () {
print('hello');
},
icon: Icon(
Icons.near_me_sharp,
size: 30,
),
color: Colors.blue,
),
code where I display the map
Widget build(BuildContext context) {
return FlutterMap(
options: const MapOptions (
initialCenter: LatLng(38.8977, -77.0365),
initialZoom: 19,
interactionOptions:
InteractionOptions(flags: ~InteractiveFlag.doubleTapZoom)
),
children: [
openStreetMapTileLayer
CircleLayer(
circles: [
CircleMarker(
point: const LatLng(38.8977, -77.0365),
radius: 30,
borderColor: Colors.blue,
borderStrokeWidth: 5,
useRadiusInMeter: true,
color: const Color.fromARGB(255, 206, 192, 192).withOpacity(0.5))
]
),
],
);
trying to make a feature similar to maps on iphone where when a button is clicked the screen re-orients itelf to its original view