Skip to content

[Bug] iOS - Tapping custom map overlay button triggers incorrect camera event order #665

@bderrien

Description

@bderrien

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

When tapping a custom button overlaid on the map, the camera event sequence behaves unexpectedly.
The idle event is triggered before move events

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

[✓] 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

'apply the following diff'

  1. Apply the provided diff
  2. Go to the navigation screen
  3. Tap the bottom button “Change camera position”
    → Logs show idle event occurs after move events (expected behavior)
  4. Manually move the camera to a new position
  5. Tap the top button “Change camera position” (overlay on the map)
    → Logs show idle event occurs before move events (unexpected behavior)

Expected vs Actual Behavior

/

Code Sample

diff --git forkSrcPrefix/example/lib/pages/navigation.dart forkDstPrefix/example/lib/pages/navigation.dart
index 7210a871dc0a1e2089c86660d8dec3209db38a97..9c837d1ffe1902f8a940c2abae8661170f10e43a 100644
--- forkSrcPrefix/example/lib/pages/navigation.dart
+++ forkDstPrefix/example/lib/pages/navigation.dart
@@ -1318,6 +1318,9 @@ class _NavigationPageState extends ExamplePageState<NavigationPage> {
                           mapId: MapIdManager.instance.mapId,
                           initialMapColorScheme: _mapColorScheme,
                           initialForceNightMode: _forceNightMode,
+                          onCameraIdle: (_) => print('==> onCameraIdle'),
+                          onCameraMove: (_) => print('==> onCameraMove'),
+                          onCameraMoveStarted: (_, __) => print('==> onCameraMoveStarted'),
                         )
                         : const Center(
                           child: Column(
@@ -1337,6 +1340,18 @@ class _NavigationPageState extends ExamplePageState<NavigationPage> {
               if (_navigationViewController != null) bottomControls,
             ],
           ),
+          Positioned(
+            top: 40,
+            left: 0,
+            right: 0,
+            child: TextButton(onPressed: () => _navigationViewController?.animateCamera(CameraUpdate.newLatLng(LatLng(latitude: 51.5160895, longitude: -0.1294527))), child: Container(color: Colors.red, height: 20, child: Text('Change camera position'))),
+          ),
+          Positioned(
+            bottom: 140,
+            left: 0,
+            right: 0,
+            child: TextButton(onPressed: () => _navigationViewController?.animateCamera(CameraUpdate.newLatLng(LatLng(latitude: 51.5160895, longitude: -0.1294527))), child: Container(color: Colors.red, height: 20, child: Text('Change camera position'))),
+          ),
           if (_showRemainingTimeAndDistanceLabels)
             _createRemainingTimeAndDistanceLabels(),
         ],

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