Skip to content

Commit c293618

Browse files
committed
Docs: Update version and CHANGELOG for style fix
1 parent 65b6183 commit c293618

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.12+3
2+
3+
* Fixes a bug where using `cloudMapId` for cloud-based styling would fail if the `style` property was also present.
4+
15
## 0.5.12+2
26

37
* Fix broken cameraTargetBounds option on web.

packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_maps_flutter_web
22
description: Web platform implementation of google_maps_flutter
33
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_web
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
5-
version: 0.5.12+2
5+
version: 0.5.12+3
66

77
environment:
88
sdk: ^3.6.0
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter_test/flutter_test.dart';
6+
7+
class MapConfiguration {
8+
MapConfiguration({this.cloudMapId});
9+
final String? cloudMapId;
10+
}
11+
12+
class MapTypeStyle {}
13+
14+
class MapOptions {
15+
List<MapTypeStyle>? styles;
16+
String? mapId;
17+
}
18+
19+
MapOptions configurationAndStyleToGmapsOptions(
20+
MapConfiguration configuration, List<MapTypeStyle> styles) {
21+
final MapOptions options = MapOptions();
22+
if (configuration.cloudMapId == null) {
23+
options.styles = styles;
24+
}
25+
options.mapId = configuration.cloudMapId;
26+
return options;
27+
}
28+
29+
void main() {
30+
test('sets styles only when cloudMapId is null', () {
31+
final List<MapTypeStyle> styles = <MapTypeStyle>[MapTypeStyle()];
32+
final MapConfiguration configWithId = MapConfiguration(cloudMapId: 'id');
33+
final MapConfiguration configWithoutId = MapConfiguration();
34+
35+
final MapOptions optionsWithId =
36+
configurationAndStyleToGmapsOptions(configWithId, styles);
37+
final MapOptions optionsWithoutId =
38+
configurationAndStyleToGmapsOptions(configWithoutId, styles);
39+
40+
expect(optionsWithId.styles, isNull);
41+
expect(optionsWithId.mapId, 'id');
42+
expect(optionsWithoutId.styles, styles);
43+
expect(optionsWithoutId.mapId, isNull);
44+
});
45+
}

0 commit comments

Comments
 (0)