Skip to content

[google_maps_flutter] Annotate zIndex usage #9462

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,7 @@ Marker _copyMarkerWithClusterManagerId(
rotation: marker.rotation,
visible: marker.visible,
// The deprecated parameter is used here to avoid losing precision.
// ignore: deprecated_member_use
zIndex: marker.zIndex,
onTap: marker.onTap,
onDragStart: marker.onDragStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ class PlaceMarkerBodyState extends State<PlaceMarkerBody> {

Future<void> _changeZIndex(MarkerId markerId) async {
final Marker marker = markers[markerId]!;
final double current = marker.zIndex;
final int current = marker.zIndexInt;
setState(() {
markers[markerId] = marker.copyWith(
zIndexParam: current == 12.0 ? 0.0 : current + 1.0,
zIndexIntParam: current == 12 ? 0 : current + 1,
);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,9 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform {
position: _platformLatLngFromLatLng(marker.position),
rotation: marker.rotation,
visible: marker.visible,
// The deprecated paramater is used to avoid losing precision, since the
// Android SDK uses doubles.
// ignore: deprecated_member_use
zIndex: marker.zIndex,
markerId: marker.markerId.value,
clusterManagerId: marker.clusterManagerId?.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ void main() {
expect(firstChanged.position.longitude, object2new.position.longitude);
expect(firstChanged.rotation, object2new.rotation);
expect(firstChanged.visible, object2new.visible);
// ignore: deprecated_member_use
expect(firstChanged.zIndex, object2new.zIndex);
expect(firstChanged.markerId, object2new.markerId.value);
expect(firstChanged.clusterManagerId, object2new.clusterManagerId?.value);
Expand Down Expand Up @@ -472,6 +473,7 @@ void main() {
expect(firstAdded.position.longitude, object3.position.longitude);
expect(firstAdded.rotation, object3.rotation);
expect(firstAdded.visible, object3.visible);
// ignore: deprecated_member_use
expect(firstAdded.zIndex, object3.zIndex);
expect(firstAdded.markerId, object3.markerId.value);
expect(firstAdded.clusterManagerId, object3.clusterManagerId?.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,7 @@ Marker _copyMarkerWithClusterManagerId(
position: marker.position,
rotation: marker.rotation,
visible: marker.visible,
zIndex: marker.zIndex,
zIndexInt: marker.zIndexInt,
onTap: marker.onTap,
onDragStart: marker.onDragStart,
onDrag: marker.onDrag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ void main() {
expect(firstChanged.position.longitude, object2new.position.longitude);
expect(firstChanged.rotation, object2new.rotation);
expect(firstChanged.visible, object2new.visible);
expect(firstChanged.zIndex, object2new.zIndex);
expect(firstChanged.zIndex, object2new.zIndexInt);
expect(firstChanged.markerId, object2new.markerId.value);
expect(firstChanged.clusterManagerId, object2new.clusterManagerId?.value);
}
Expand All @@ -473,7 +473,7 @@ void main() {
expect(firstAdded.position.longitude, object3.position.longitude);
expect(firstAdded.rotation, object3.rotation);
expect(firstAdded.visible, object3.visible);
expect(firstAdded.zIndex, object3.zIndex);
expect(firstAdded.zIndex, object3.zIndexInt);
expect(firstAdded.markerId, object3.markerId.value);
expect(firstAdded.clusterManagerId, object3.clusterManagerId?.value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ Marker _copyMarkerWithClusterManagerId(
position: marker.position,
rotation: marker.rotation,
visible: marker.visible,
// ignore: deprecated_member_use
zIndex: marker.zIndex,
onTap: marker.onTap,
onDragStart: marker.onDragStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ gmaps.InfoWindowOptions? _infoWindowOptionsFromMarker(Marker marker) {
return gmaps.InfoWindowOptions()
..content = container
// The deprecated parameter is used here to avoid losing precision.
// ignore: deprecated_member_use
..zIndex = marker.zIndex;
// TODO(ditman): Compute the pixelOffset of the infoWindow, from the size of the Marker,
// and the marker.infoWindow.anchor property.
Expand Down Expand Up @@ -467,6 +468,7 @@ Future<gmaps.MarkerOptions> _markerOptionsFromMarker(
)
..title = sanitizeHtml(marker.infoWindow.title ?? '')
// The deprecated parameter is used here to avoid losing precision.
// ignore: deprecated_member_use
..zIndex = marker.zIndex
..visible = marker.visible
..opacity = marker.alpha
Expand Down