Reputation: 43
I'm working on a Flutter app that uses the Google Maps plugin. I have implemented a map with markers, and each marker is supposed to display an InfoWindow
when tapped. However, the InfoWindow
does not appear when I tap on the markers.
Here's my code
for (var student in _students) {
_markers.add(
Marker(
markerId: MarkerId(student.id),
position: LatLng(student.gps.latitude, student.gps.longitude),
infoWindow: InfoWindow(
title: student.nombre,
snippet: student.gps.idRfid,
),
onTap: () {
_moveCamera(LatLng(student.gps.latitude, student.gps.longitude), zoomIn: true);
context.read<MapStateCubit>().showParadas(student);
lastUpdateTime = student.gps.lastUpdateTime;
},
icon: markerBusIcon!,
),
);
}
The Marker is added to a Set<Marker>
which is passed to the GoogleMap
widget:
GoogleMap(
mapType: MapType.normal,
onMapCreated: _onMapCreated,
initialCameraPosition: CameraPosition(
target: _initialPosition,
zoom: 12,
),
markers: _markers.toSet(),
myLocationEnabled: true,
myLocationButtonEnabled: true,
zoomControlsEnabled: true,
)
What I've tried so far:
infoWindow
is defined with a title and snippet for each marker.onTap
callback on the marker works (the camera moves correctly).Despite these checks, the InfoWindow
does not appear.
Upvotes: 4
Views: 289
Reputation: 46
have you read this github issue perhaps? Overriding the google_maps_flutter_ios dependancy to version 2.13.1 worked for me, now the Info Window pops up again on iOS in my app. Of course, let's hope they fix the issue in a future release of the package.
Upvotes: 3