googlemaps / googlemaps/flutter-navigation-sdk

[Bug]: iOS – First gesture ignored after showRouteOverview() triggered from long press

Open
#663 2 comments 0 reactions 1 assignee Claimed by @jokerttu View on GitHub
priority: p2 type: bug
Dominant language
Dart
Stars
75
Forks
54
Avg merge
4d 2h
Merged PRs (30d)
5

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Description of the bug

On iOS, when executing the following sequence:
- Call GoogleMapsNavigator.setDestinations
- Then call _navigationViewController!.showRouteOverview()
Both triggered from the onMapLongClicked callback

The next map gesture is ignored :
- simple tap
- long press
- drag
- ...

I haven’t found any workaround yet

### Flutter version

3.38.5

### Package version

0.8.4

### Native SDK versions

- [x] I haven't changed the version of the native SDKs

### Flutter Doctor Output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.38.5, on macOS 26.4.1 25E253 darwin-arm64, locale en-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.4)
[✓] Chrome - develop for the web
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

### Steps to reproduce

'First, apply the following patch to implement a new long-press logic on the navigation map'

1. Open the navigation example page
2. Perform a long press on the map
→ A new destination is set and the camera updates
3. Perform any gesture (tap, long press, drag, zoom)
→ ❌ This first gesture does nothing
4. Perform the same (or another) gesture again
→ ✅ This time it works as expected

### Expected vs Actual Behavior

Expected behavior:
The first gesture after updating the route and calling showRouteOverview() should be handled normally.

Actual behavior:
The first gesture is ignored, and only the second one is recognized.

### Code Sample

i add new onMapLongClicked logic with set a destination + showOverview

```
diff --git forkSrcPrefix/example/lib/pages/navigation.dart forkDstPrefix/example/lib/pages/navigation.dart
index 7210a871dc0a1e2089c86660d8dec3209db38a97..56b70c6bf500f654cd0e102823789153a023491b 100644
--- forkSrcPrefix/example/lib/pages/navigation.dart
+++ forkDstPrefix/example/lib/pages/navigation.dart
@@ -806,6 +806,39 @@ class _NavigationPageState extends ExamplePageState {
await _updateNewWaypointMarker(location);
}

+
+ Future _onMapLongClicked(LatLng location) async {
+ _lastClickedPoi = null;
+
+ setState(() {
+ _validRoute = false;
+ });
+
+ final Destinations destinations = Destinations(
+ waypoints: [
+ NavigationWaypoint.withLatLngTarget(
+ title: 'Waypoint 1',
+ target: LatLng(latitude: location.latitude, longitude: location.longitude),
+ ),
+ ],
+ displayOptions: NavigationDisplayOptions(
+ showDestinationMarkers: false,
+ showStopSigns: true,
+ showTrafficLights: true,
+ ),
+ routingOptions: RoutingOptions(travelMode: _travelMode),
+ );
+
+ await GoogleMapsNavigator.setDestinations(destinations);
+ await _navigationViewController!.showRouteOverview();
+
+ setState(() {
+ _validRoute = true;
+ _errorOnSetDestinations = false;
+
+ });
+ }
+
Future _onPoiClicked(PointOfInterest poi) async {
_lastClickedPoi = poi; // Store POI info for waypoint title
await _updateNewWaypointMarker(poi.latLng, poiName: poi.name);
@@ -1298,7 +1331,7 @@ class _NavigationPageState extends ExamplePageState {
? GoogleMapsNavigationView(
onViewCreated: _onViewCreated,
onMapClicked: _onMapClicked,
- onMapLongClicked: _onMapClicked,
+ onMapLongClicked: (location) => _onMapLongClicked(location),
onPoiClicked: _onPoiClicked,
onRecenterButtonClicked:
_onRecenterButtonClickedEvent,

```

### Additional Context

_No response_

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.