Skip to content

Commit f00e440

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

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
6+
import 'package:flutter_test/flutter_test.dart';
7+
8+
class MapConfiguration {
9+
MapConfiguration({this.cloudMapId});
10+
final String? cloudMapId;
11+
}
12+
13+
class MapTypeStyle {}
14+
15+
class MapOptions {
16+
List<MapTypeStyle>? styles;
17+
String? mapId;
18+
}
19+
20+
MapOptions configurationAndStyleToGmapsOptions(
21+
MapConfiguration configuration, List<MapTypeStyle> styles) {
22+
final MapOptions options = MapOptions();
23+
if (configuration.cloudMapId == null) {
24+
options.styles = styles;
25+
}
26+
options.mapId = configuration.cloudMapId;
27+
return options;
28+
}
29+
30+
void main() {
31+
test('sets styles only when cloudMapId is null', () {
32+
final List<MapTypeStyle> styles = <MapTypeStyle>[MapTypeStyle()];
33+
final MapConfiguration configWithId = MapConfiguration(cloudMapId: 'id');
34+
final MapConfiguration configWithoutId = MapConfiguration();
35+
36+
final MapOptions optionsWithId = configurationAndStyleToGmapsOptions(configWithId, styles);
37+
final MapOptions optionsWithoutId = configurationAndStyleToGmapsOptions(configWithoutId, styles);
38+
39+
expect(optionsWithId.styles, isNull);
40+
expect(optionsWithId.mapId, 'id');
41+
expect(optionsWithoutId.styles, styles);
42+
expect(optionsWithoutId.mapId, isNull);
43+
});
44+
}

0 commit comments

Comments
 (0)