Skip to content

[google_maps_flutter_platform_(web/android/ios)] Add a new zIndexInt param to marker and deprecate zIndex #9408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Hari-07
Copy link
Contributor

@Hari-07 Hari-07 commented Jun 9, 2025

List which issues are fixed by this PR. You must list at least one issue.
This is just the web, android and ios package part of #8012

Pre-Review Checklist

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

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 3

@@ -730,3 +730,13 @@ gmaps.LatLng _pixelToLatLng(gmaps.Map map, int x, int y) {

return projection.fromPointToLatLng(point)!;
}

extension on Marker {
Copy link
Contributor

Choose a reason for hiding this comment

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

Extensions violate Flutter's style guide. There are cases where we have to use them for JS interop, but that doesn't apply here.

Why do we need this at all, vs just using zIndex with a comment like in the Android example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. IIRC this was written when 2 different parameters were there initially, now that we don't allow the constructor to pass in both at the same time, this isn't required

@@ -2,11 +2,11 @@ name: google_maps_flutter_web
description: Web platform implementation of google_maps_flutter
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
version: 0.5.12
version: 0.5.13
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be 0.5.12+1 as it's a very small change.

@@ -4,7 +4,7 @@ publish_to: none

environment:
sdk: ^3.6.0
flutter: ">=3.27.0"
flutter: '>=3.27.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this PR change the style of all the string values in pubspec.yaml files to deviate from our usual style?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume there might be something wrong with my linte, will fix that. I had to do it manually for the interface package

@Hari-07 Hari-07 requested a review from stuartmorgan-g June 9, 2025 15:21
@@ -21,7 +21,7 @@ dependencies:
flutter:
sdk: flutter
flutter_plugin_android_lifecycle: ^2.0.1
google_maps_flutter_platform_interface: ^2.11.0
google_maps_flutter_platform_interface: ^2.12.1
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the PR again... do we actually need any of the changes to this file? It looks like the only actual change is to the integration tests and the example pubspec, and those don't require publishing the package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case Im gonna close this PR. And since it doesn't need a new version, the main PR's overrides can all be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't it need to target the updated platform interface package though? Not sure if Im misunderstanding this line from the federated packages section

If new functionality is being added to the API surface of the app-facing package, be sure to update the version constraints of the implementation packages in its pubspec.yaml

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't it need to target the updated platform interface package though?

What is "it" here? If it's google_maps_flutter_android, what part of the google_maps_flutter_android requires the new APIs added to the platform interface?

If it's the app-facing package (in the other PR), yes, because it's exporting that surface to clients.

Not sure if Im misunderstanding this line from the federated packages section

If new functionality is being added to the API surface of the app-facing package, be sure to update the version constraints of the implementation packages in its pubspec.yaml

See the explanation in the following sentence for the reason this would need to be done.

For example, if the platform interface adds a new Future<void> foo() { throw UnimplementedError(); }, and all the platforms are updated to implement foo(), and the app-facing package is updated to call foo(), we don't want a valid set of resolved packages where clients can get the updated version of the app-facing and platform interface packages, but not the implementation packages, such that everything compiles but all calls to foo() throw.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok got it. For android we dont't need a new version. I guess even web doesn't need a new version by the same logic since that's just a comment change?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess even web doesn't need a new version by the same logic since that's just a comment change?

Correct; IIRC the tooling will do the right thing with a comment-only change, but if not we can override the version check.

@@ -2,7 +2,7 @@ name: google_maps_flutter_ios
description: iOS implementation of the google_maps_flutter plugin.
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
version: 2.15.2
version: 2.15.3
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, the only change to this package is to a file in the example app that's not the one visible on pub.dev, so this should be exempt from versioning.

Copy link
Contributor

Choose a reason for hiding this comment

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

Although, why is only the example changing for iOS? Shouldn't it be using zIndexInt instead of the deprecated zIndex now, since it can't use any fractional values anyway?

Copy link
Contributor Author

@Hari-07 Hari-07 Jun 10, 2025

Choose a reason for hiding this comment

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

You're right, not sure how that ended up getting removed or at what point. I think the reasonable thing to do would be to make ios's PlatformMarker expect an integral zIndex, so that this truncation would now be a type error to which we can pass zIndexInt

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, the iOS changes look good here.

Based on the CI failure though, it appears that the Obj-C compiler flags 64-bit int assignment to 32-bit int assignment as lossy, but did not flag it when it was assigning a double to a 32-bit int. Odd, but you'll need to add an explicit cast here to make the analysis check happy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's seems reasonable from flags.
-Wno-float-conversion looks like it allows implicit float conversion which is what was happening
-Wshorten-64-to-32 would disallow the long to int cast that's happening at the line you pointed out

@Hari-07 Hari-07 closed this Jun 10, 2025
@Hari-07 Hari-07 reopened this Jun 10, 2025
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

The changes to this file can be reverted as well; we don't need to CHANGELOG an integration test comment.

@stuartmorgan-g
Copy link
Contributor

@vashworth / @cbracken could you give the second approval here since the substantive change is iOS?

Copy link
Contributor

@vashworth vashworth left a comment

Choose a reason for hiding this comment

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

LGTM

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 16, 2025
@auto-submit auto-submit bot merged commit 538d174 into flutter:main Jun 16, 2025
78 checks passed
@Hari-07 Hari-07 deleted the maps-zindex-truncation-platform-implementations branch June 16, 2025 17:05
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 17, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Jun 17, 2025
flutter/packages@03a6abb...25d4fa4

2025-06-17 [email protected]
[google_maps_flutter] Add a new zIndexInt param to marker and deprecate
zIndex (flutter/packages#8012)
2025-06-17 [email protected] [pigeon] Use a
const for custom type ids for gobject generated files (#156100)
(flutter/packages#9306)
2025-06-16 [email protected]
[google_maps_flutter_platform_(web/android/ios)] Add a new zIndexInt
param to marker and deprecate zIndex (flutter/packages#9408)
2025-06-16 [email protected] [camera_avfoundation] fix race condition
when starting image stream on iOS (flutter/packages#8733)
2025-06-16 [email protected] Roll Flutter from
f79452e to 8303a96 (21 revisions) (flutter/packages#9433)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants