albert-heijn-technology / platform_maps_flutter

A Flutter package to provide the native maps to Android/iOS
BSD 2-Clause "Simplified" License
80 stars 64 forks source link

Map takes tap event when tap is performed on marker #29

Open anuroopsinghal07 opened 3 years ago

anuroopsinghal07 commented 3 years ago

Hello, I have added a feature to add pins on tap of map. Pin also displays info window when tap is performed on pin. When I tap on pin to open info window, map also adds new pin because map takes tap event. I could not find anything to fix it and looks like a defect.

dev4jam commented 2 years ago

I have a similar problem: when I tap on a marker onTap callback is triggered. The second time I tap on the same marker the onTap callback is NOT triggered.

Tapaniya25 commented 2 years ago

I have same issue @dev4jam. Have you found any solution?

ChrisMarxDev commented 1 year ago

I faced the same issue and found a very hacky workaround for it. I just append a random uuid to the marker id and call setState() when tapping the marker. E.g.

PlatformMap(
                initialCameraPosition: initialCamera,
                markers: locations.map(
                        (location) {
                          return Marker(
                            markerId:
                                MarkerId(location.locationId + uuid.v4()),
                            position: LatLng(
                              location.geoCoordinate.latitude,
                              location.geoCoordinate.longitude,
                            ),
                            consumeTapEvents: true,
                            onTap: () {
                              // handle tap logic
                              setState(() {});
                            },
                          );
                        },
                      ).toSet(),
                gestureRecognizers: const {
                  Factory<OneSequenceGestureRecognizer>(
                    EagerGestureRecognizer.new,
                  ),
                },
)
SDAChess commented 12 months ago

We are still experiencing this issue. Any ideas?