Reputation: 4316
How can we execute a function for example _markerPressed()
in google map when user taps on a marker?
I dont want to show a popup I know its possible using infoWindow
.
I want to, for example open a card on screen.
I've tried the onTap:
and onLongPress:
functions but it's only working while tapping on the map not the markers.
Thank you in advance
Upvotes: 0
Views: 944
Reputation: 566
final Marker marker = Marker(
markerId: markerId,
position: LatLng(
center.latitude + sin(_markerIdCounter * pi / 6.0) / 20.0,
center.longitude + cos(_markerIdCounter * pi / 6.0) / 20.0,
),
infoWindow: InfoWindow(title: markerIdVal, snippet: '*'),
onTap: (){
//TODO: show your card
},
onDragEnd: (LatLng position) => _onMarkerDragEnd(markerId, position),
onDrag: (LatLng position) => _onMarkerDrag(markerId, position),
);
Upvotes: 1