Skip to content

[google_maps_flutter] Disable marker move animation on iOS#11792

Open
Gibbo97 wants to merge 2 commits into
flutter:mainfrom
Gibbo97:google-maps-flutter-disable-implicit-marker-position-animations
Open

[google_maps_flutter] Disable marker move animation on iOS#11792
Gibbo97 wants to merge 2 commits into
flutter:mainfrom
Gibbo97:google-maps-flutter-disable-implicit-marker-position-animations

Conversation

@Gibbo97
Copy link
Copy Markdown

@Gibbo97 Gibbo97 commented May 26, 2026

Disable the marker move animation google_maps_flutter on iOS. Currently when you update the position it takes some time to move. However, on other platforms; android, web in my testing, the marker move is not animated. Additionally other features like lines being moved is not animated.

Marker move has forced animation on google_maps_flutter iOS.
Issue: flutter/flutter#129826

Behaviour previously, showing lines and markers behaving differently:
https://github.com/user-attachments/assets/d129bbb6-af93-4825-9b05-10befed4fd87

Behaviour now showing markers and lines behaving the same:
https://github.com/user-attachments/assets/3437caf9-628c-489e-ac5d-f0fb55897a6e

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 26, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request prevents iOS marker position updates from being implicitly animated across multiple google_maps_flutter_ios packages by wrapping the position updates in a CATransaction block with disabled actions. It also adds corresponding unit tests. The review feedback suggests removing the redundant [CATransaction setAnimationDuration:0.0] call since actions are already disabled. Additionally, it is recommended to refactor the unit tests to avoid asserting directly inside the test helper class, instead recording the state on a property and asserting it within the test methods.

@Gibbo97 Gibbo97 force-pushed the google-maps-flutter-disable-implicit-marker-position-animations branch from c495802 to 5249ce1 Compare May 26, 2026 22:58
@stuartmorgan-g
Copy link
Copy Markdown
Collaborator

This is unconditionally making google_maps_flutter on iOS behave differently from the default behavior of Google Maps SDK on iOS, which is generally not the approach we take. Adding a map-level option to disable implicit animation for markers is fine, but unconditionally changing it may regress other clients.

@Gibbo97
Copy link
Copy Markdown
Author

Gibbo97 commented May 27, 2026

@stuartmorgan-g Thanks for the prompt reply.

Just so I can get something in which you would be more keen on: are you picturing a new field on PlatformMapConfiguration (defaulting to animated, matching the SDK's native behavior) that, when set to disabled, wraps the marker.position assignment in a CATransaction with actions disabled? So default to the current behaviour, opt in to the standardised behaviour.

Or are you thinking of a bigger change?

A couple other things I'd like to confirm before I sink an afternoon into this:

  1. Should the flag be exposed on the cross-platform GoogleMap widget (iOS-only effect, no-op elsewhere) or kept as an iOS-specific option?
  2. Any preference on naming/polarity (e.g. markerPositionAnimationsEnabled default-on)?
  3. Scope it to position only, or also cover other implicitly animated properties like rotation?

@stuartmorgan-g
Copy link
Copy Markdown
Collaborator

  1. Should the flag be exposed on the cross-platform GoogleMap widget (iOS-only effect, no-op elsewhere) or kept as an iOS-specific option?

Do other platforms have APIs that allow toggling animation for these properties? If so we would want to abstract them, if not it should be an iOS-specific option. (I'm not familiar with all of the differences of the Google Maps API surface and behaviors on each platform offhand.)

  1. Any preference on naming/polarity (e.g. markerPositionAnimationsEnabled default-on)?

APIs in this package should follow Flutter style guidance.

  1. Scope it to position only, or also cover other implicitly animated properties like rotation?

If there are other APIs that this could obviously apply to, it should be designed in such a way that it would be easily extensible to other properties. E.g., a simple data class of animation toggles for various objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants