Skip to content

Commit

Permalink
[google_maps_flutter] fixed a small bug in example app. (flutter#3590)
Browse files Browse the repository at this point in the history
in _onMarkerTapped function we were changing markers[markerId] to defaultMarker and than again markers[markerId] to hueGreen marker, while instead we should have changed markers[selectedMarker] to defaultMarker first instead of markers[markerId]
  • Loading branch information
vishnuagbly authored Feb 23, 2021
1 parent b45875f commit 34d0aa5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.0-nullsafety.1

* Fix in example app to properly change marker icon.

## 2.0.0-nullsafety

* Migrate to null-safety
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ class PlaceMarkerBodyState extends State<PlaceMarkerBody> {
final Marker? tappedMarker = markers[markerId];
if (tappedMarker != null) {
setState(() {
if (markers.containsKey(markerId)) {
final Marker resetOld = markers[markerId]!
final MarkerId? previousMarkerId = selectedMarker;
if (previousMarkerId != null && markers.containsKey(previousMarkerId)) {
final Marker resetOld = markers[previousMarkerId]!
.copyWith(iconParam: BitmapDescriptor.defaultMarker);
markers[markerId] = resetOld;
markers[previousMarkerId] = resetOld;
}
selectedMarker = markerId;
final Marker newMarker = tappedMarker.copyWith(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter
version: 2.0.0-nullsafety
version: 2.0.0-nullsafety.1

dependencies:
flutter:
Expand Down

0 comments on commit 34d0aa5

Please sign in to comment.