Skip to content

Commit c6cb477

Browse files
authored
[google_maps_flutter] Update google_maps_flutter to 2.10.0 (#816)
1 parent 8ea7516 commit c6cb477

File tree

14 files changed

+860
-26
lines changed

14 files changed

+860
-26
lines changed

packages/google_maps_flutter/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.1.11
2+
3+
* Update google_maps_flutter to 2.10.0.
4+
* Update google_maps_flutter_platform_interface to 2.10.0.
5+
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
6+
17
## 0.1.10
28

39
* Update webview_flutter_lwe to 0.3.7.

packages/google_maps_flutter/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ This package is not an _endorsed_ implementation of `google_maps_flutter`. There
2020

2121
```yaml
2222
dependencies:
23-
google_maps_flutter: ^2.7.0
24-
google_maps_flutter_tizen: ^0.1.10
23+
google_maps_flutter: ^2.10.0
24+
google_maps_flutter_tizen: ^0.1.11
2525
```
2626
2727
For detailed usage, see https://pub.dev/packages/google_maps_flutter#sample-usage.
@@ -36,4 +36,4 @@ In addition, you need a Maps JavaScript API Key to use this plugin. You can get
3636

3737
- This plugin was implemented using the [Google JavaScript API](https://developers.google.com/maps/documentation/javascript/overview).
3838
The Marker feature uses the [Legacy API](https://developers.google.com/maps/documentation/javascript/markers). Depending on the Deprecate plan of the JavaScript API, some parts may not work.
39-
- The [marker clustering feature](https://pub.dev/packages/google_maps_flutter_platform_interface/changelog#260) is not yet supported.
39+
- [Marker clustering features](https://pub.dev/packages/google_maps_flutter_platform_interface/changelog#260), [heatmap layers](https://pub.dev/packages/google_maps_flutter_platform_interface/changelog#290), and tile overlays are not yet supported.

packages/google_maps_flutter/example/integration_test/src/maps_controller.dart

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void runTests() {
9393
},
9494
),
9595
);
96-
await tester.pumpAndSettle(const Duration(seconds: 3));
96+
await tester.pumpAndSettle();
9797
final GoogleMapController mapController =
9898
await mapControllerCompleter.future;
9999

@@ -161,6 +161,8 @@ void runTests() {
161161

162162
const String mapStyle =
163163
'[{"elementType":"geometry","stylers":[{"color":"#242f3e"}]}]';
164+
// Intentionally testing the deprecated code path.
165+
// ignore: deprecated_member_use
164166
await controller.setMapStyle(mapStyle);
165167
});
166168

@@ -183,6 +185,8 @@ void runTests() {
183185
final GoogleMapController controller = await controllerCompleter.future;
184186

185187
try {
188+
// Intentionally testing the deprecated code path.
189+
// ignore: deprecated_member_use
186190
await controller.setMapStyle('invalid_value');
187191
fail('expected MapStyleException');
188192
} on MapStyleException catch (e) {
@@ -207,6 +211,8 @@ void runTests() {
207211
);
208212
final GoogleMapController controller = await controllerCompleter.future;
209213

214+
// Intentionally testing the deprecated code path.
215+
// ignore: deprecated_member_use
210216
await controller.setMapStyle(null);
211217
});
212218

@@ -231,7 +237,7 @@ void runTests() {
231237
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
232238
// in `mapRendered`.
233239
// https://github.com/flutter/flutter/issues/54758
234-
await Future<void>.delayed(const Duration(seconds: 3));
240+
await Future<void>.delayed(const Duration(seconds: 1));
235241

236242
final LatLngBounds visibleRegion = await controller.getVisibleRegion();
237243
final LatLng topLeft =
@@ -265,7 +271,7 @@ void runTests() {
265271
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
266272
// in `mapRendered`.
267273
// https://github.com/flutter/flutter/issues/54758
268-
await Future<void>.delayed(const Duration(seconds: 3));
274+
await Future<void>.delayed(const Duration(seconds: 1));
269275

270276
double zoom = await controller.getZoomLevel();
271277
expect(zoom, kInitialZoomLevel);
@@ -299,7 +305,7 @@ void runTests() {
299305
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
300306
// in `mapRendered`.
301307
// https://github.com/flutter/flutter/issues/54758
302-
await Future<void>.delayed(const Duration(seconds: 3));
308+
await Future<void>.delayed(const Duration(seconds: 1));
303309

304310
final LatLngBounds visibleRegion = await controller.getVisibleRegion();
305311
final LatLng northWest = LatLng(
@@ -346,7 +352,7 @@ void runTests() {
346352
// TODO(cyanglaz): Remove this after we added `mapRendered` callback, and `mapControllerCompleter.complete(controller)` above should happen
347353
// in `mapRendered`.
348354
// https://github.com/flutter/flutter/issues/54758
349-
await Future<void>.delayed(const Duration(seconds: 3));
355+
await Future<void>.delayed(const Duration(seconds: 1));
350356

351357
// Simple call to make sure that the app hasn't crashed.
352358
final LatLngBounds bounds1 = await controller.getVisibleRegion();
@@ -381,7 +387,7 @@ void runTests() {
381387
// https://github.com/flutter/flutter/issues/131783. It may be related
382388
// to https://github.com/flutter/flutter/issues/54758 and should be
383389
// re-evaluated when that issue is fixed.
384-
await Future<void>.delayed(const Duration(seconds: 3));
390+
await Future<void>.delayed(const Duration(seconds: 1));
385391

386392
bool iwVisibleStatus =
387393
await controller.isMarkerInfoWindowShown(marker.markerId);
@@ -470,6 +476,8 @@ void runTests() {
470476
final Set<Marker> markers = <Marker>{
471477
Marker(
472478
markerId: const MarkerId('1'),
479+
// Intentionally testing the deprecated code path.
480+
// ignore: deprecated_member_use
473481
icon: await BitmapDescriptor.fromAssetImage(
474482
imageConfiguration,
475483
'assets/red_square.png',
@@ -492,6 +500,8 @@ void runTests() {
492500
final Set<Marker> markers = <Marker>{
493501
Marker(
494502
markerId: const MarkerId('1'),
503+
// Intentionally testing the deprecated code path.
504+
// ignore: deprecated_member_use
495505
icon: BitmapDescriptor.fromBytes(
496506
bytes,
497507
size: const Size(100, 100),
@@ -527,7 +537,7 @@ void runTests() {
527537
final Uint8List? bytes = await controller.takeSnapshot();
528538
expect(bytes?.isNotEmpty, true);
529539
},
530-
// // In Tizen, TakeSnapshot is not supported.
540+
// In Tizen, TakeSnapshot is not supported.
531541
skip: true);
532542

533543
testWidgets(
@@ -552,7 +562,7 @@ void runTests() {
552562
// Await mapIdCompleter to finish to make sure map can be created with cloudMapId
553563
await mapIdCompleter.future;
554564
},
555-
// // In Tizen, CloudMap is not supported.
565+
// In Tizen, CloudMap is not supported.
556566
skip: true,
557567
);
558568

packages/google_maps_flutter/example/integration_test/src/maps_inspector.dart

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,4 +533,106 @@ void runTests() {
533533
expect(myLocationButtonEnabled, true);
534534
});
535535
}, skip: !isIOS);
536+
537+
testWidgets('marker clustering', (WidgetTester tester) async {
538+
final Key key = GlobalKey();
539+
const int clusterManagersAmount = 2;
540+
const int markersPerClusterManager = 5;
541+
final Map<MarkerId, Marker> markers = <MarkerId, Marker>{};
542+
final Set<ClusterManager> clusterManagers = <ClusterManager>{};
543+
544+
for (int i = 0; i < clusterManagersAmount; i++) {
545+
final ClusterManagerId clusterManagerId =
546+
ClusterManagerId('cluster_manager_$i');
547+
final ClusterManager clusterManager =
548+
ClusterManager(clusterManagerId: clusterManagerId);
549+
clusterManagers.add(clusterManager);
550+
}
551+
552+
for (final ClusterManager cm in clusterManagers) {
553+
for (int i = 0; i < markersPerClusterManager; i++) {
554+
final MarkerId markerId =
555+
MarkerId('${cm.clusterManagerId.value}_marker_$i');
556+
final Marker marker = Marker(
557+
markerId: markerId,
558+
clusterManagerId: cm.clusterManagerId,
559+
position: LatLng(
560+
kInitialMapCenter.latitude + i, kInitialMapCenter.longitude));
561+
markers[markerId] = marker;
562+
}
563+
}
564+
565+
final Completer<GoogleMapController> controllerCompleter =
566+
Completer<GoogleMapController>();
567+
568+
await pumpMap(
569+
tester,
570+
GoogleMap(
571+
key: key,
572+
initialCameraPosition: kInitialCameraPosition,
573+
clusterManagers: clusterManagers,
574+
markers: Set<Marker>.of(markers.values),
575+
onMapCreated: (GoogleMapController googleMapController) {
576+
controllerCompleter.complete(googleMapController);
577+
},
578+
),
579+
);
580+
581+
final GoogleMapController controller = await controllerCompleter.future;
582+
583+
final GoogleMapsInspectorPlatform inspector =
584+
GoogleMapsInspectorPlatform.instance!;
585+
586+
for (final ClusterManager cm in clusterManagers) {
587+
final List<Cluster> clusters = await inspector.getClusters(
588+
mapId: controller.mapId, clusterManagerId: cm.clusterManagerId);
589+
final int markersAmountForClusterManager = clusters
590+
.map<int>((Cluster cluster) => cluster.count)
591+
.reduce((int value, int element) => value + element);
592+
expect(markersAmountForClusterManager, markersPerClusterManager);
593+
}
594+
595+
// Remove markers from clusterManagers and test that clusterManagers are empty.
596+
for (final MapEntry<MarkerId, Marker> entry in markers.entries) {
597+
markers[entry.key] = _copyMarkerWithClusterManagerId(entry.value, null);
598+
}
599+
600+
await pumpMap(
601+
tester,
602+
GoogleMap(
603+
key: key,
604+
initialCameraPosition: kInitialCameraPosition,
605+
clusterManagers: clusterManagers,
606+
markers: Set<Marker>.of(markers.values)),
607+
);
608+
609+
for (final ClusterManager cm in clusterManagers) {
610+
final List<Cluster> clusters = await inspector.getClusters(
611+
mapId: controller.mapId, clusterManagerId: cm.clusterManagerId);
612+
expect(clusters.length, 0);
613+
}
614+
});
615+
}
616+
617+
Marker _copyMarkerWithClusterManagerId(
618+
Marker marker, ClusterManagerId? clusterManagerId) {
619+
return Marker(
620+
markerId: marker.markerId,
621+
alpha: marker.alpha,
622+
anchor: marker.anchor,
623+
consumeTapEvents: marker.consumeTapEvents,
624+
draggable: marker.draggable,
625+
flat: marker.flat,
626+
icon: marker.icon,
627+
infoWindow: marker.infoWindow,
628+
position: marker.position,
629+
rotation: marker.rotation,
630+
visible: marker.visible,
631+
zIndex: marker.zIndex,
632+
onTap: marker.onTap,
633+
onDragStart: marker.onDragStart,
634+
onDrag: marker.onDrag,
635+
onDragEnd: marker.onDragEnd,
636+
clusterManagerId: clusterManagerId,
637+
);
536638
}

0 commit comments

Comments
 (0)