Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
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
@@ -1,3 +1,7 @@
## 0.1.0+6

* Ensure a single `InfoWindow` is shown at a time. [Issue](https://github.com/flutter/flutter/issues/67380).

## 0.1.0+5

* Update `package:google_maps` to `^3.4.5`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class MarkersController extends GeometryController {
///
/// See also [hideMarkerInfoWindow] and [isInfoWindowShown].
void showMarkerInfoWindow(MarkerId markerId) {
_hideAllMarkerInfoWindow();
MarkerController markerController = _markerIdToController[markerId];
markerController?.showInfoWindow();
}
Expand Down Expand Up @@ -145,4 +146,11 @@ class MarkersController extends GeometryController {
markerId,
));
}

void _hideAllMarkerInfoWindow() {
_markerIdToController.values
.where((controller) =>
controller == null ? false : controller.infoWindowShown)
.forEach((controller) => controller.hideInfoWindow());
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: google_maps_flutter_web
description: Web platform implementation of google_maps_flutter
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
version: 0.1.0+5
version: 0.1.0+6

flutter:
plugin:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,35 @@ void main() {
expect(controller.markers[MarkerId('1')].infoWindowShown, isFalse);
});

// https://github.com/flutter/flutter/issues/67380
testWidgets('only single InfoWindow is visible',
(WidgetTester tester) async {
final markers = {
Marker(
markerId: MarkerId('1'),
infoWindow: InfoWindow(title: "Title", snippet: "Snippet"),
),
Marker(
markerId: MarkerId('2'),
infoWindow: InfoWindow(title: "Title", snippet: "Snippet"),
),
};
controller.addMarkers(markers);

expect(controller.markers[MarkerId('1')].infoWindowShown, isFalse);
expect(controller.markers[MarkerId('2')].infoWindowShown, isFalse);

controller.showMarkerInfoWindow(MarkerId('1'));

expect(controller.markers[MarkerId('1')].infoWindowShown, isTrue);
expect(controller.markers[MarkerId('2')].infoWindowShown, isFalse);

controller.showMarkerInfoWindow(MarkerId('2'));

expect(controller.markers[MarkerId('1')].infoWindowShown, isFalse);
expect(controller.markers[MarkerId('2')].infoWindowShown, isTrue);
});

// https://github.com/flutter/flutter/issues/64938
testWidgets('markers with icon:null work', (WidgetTester tester) async {
final markers = {
Expand Down