I’m using flutter_map to display map on my flutter app.
here is the code
FlutterMap(
mapController: mapController,
options: MapOptions(
interactiveFlags:
InteractiveFlag.pinchZoom | InteractiveFlag.drag,
center: LatLng(9.964706, 76.289714),
zoom: 13.0,
rotation: 0,
),
children: [
TileLayer(
urlTemplate:
'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png',
subdomains: const ['a', 'b', 'c'],
),
MarkerLayer(
markers: List.generate(
userList.length,
(index) {
final user = userList[index];
return Marker(
width: 200,
height: 200,
point: LatLng(user.coords[0], user.coords[1]),
builder: (ctx) {
return GestureDetector(
onTap: () => showuserDetailSheet(context, user),
child: UserPointer(
color: user.color,
icon: user.gender == Gender.male
? Icons.male
: Icons.female,
name: user.username,
age: user.age,
),
);
},
);
},
))
],
),
here is the screenshots for better understanding
i want to reduce the size when the user zoom out the map or increase the size when user zoom in. how do i do that in flutter map
2
Answers
You can achieve this by listening to the
onPositionChanged
event of theMapOptions
and then update the marker size based on the zoom level.