Skip to content

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

@bderrien

Description

@bderrien

Is there an existing issue for this?

  • 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

  • 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<NavigationPage> {
     await _updateNewWaypointMarker(location);
   }
 
+
+  Future<void> _onMapLongClicked(LatLng location) async {
+    _lastClickedPoi = null;
+
+    setState(() {
+      _validRoute = false;
+    });
+
+    final Destinations destinations = Destinations(
+      waypoints: <NavigationWaypoint>[
+        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<void> _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<NavigationPage> {
                         ? GoogleMapsNavigationView(
                           onViewCreated: _onViewCreated,
                           onMapClicked: _onMapClicked,
-                          onMapLongClicked: _onMapClicked,
+                          onMapLongClicked: (location) => _onMapLongClicked(location),
                           onPoiClicked: _onPoiClicked,
                           onRecenterButtonClicked:
                               _onRecenterButtonClickedEvent,

Additional Context

No response

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions