flutter / flutter/flutter

[google_maps_flutter] Add `onTap` for DefaultMarker

Open
#140,652 10 comments 3 reactions 0 assignees View on GitHub
c: new feature c: proposal p: maps P2 package team-ecosystem triaged-ecosystem
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### GooleMap displays default markers on surrounding landmarks. However, We can't detect `onTap` for that.

### Use case

let's say I want to set a destination by tapping the default marker on Map.
When I tap the marker, the value I want is the coordinate the marker points to, not the coordinate I tapped.

This may sound the same, but since the marker is not a point, a low zoom level makes a big difference.

### To be sure, here is the solution I am now doing instead.

1. `onTap` to get the `LatLng`.
2. use Google Maps API geocode the `LatLng` obtained in 1 to get the Place id.
3. use places api with the Place id obtained in step 2 to get the location information and point to the marker.

This works in many cases, but not reliably.

### Proposal

```dart
{void Function(LatLng)? onDefaultMarkerTap}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.