Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3871f42
[google_maps_flutter_web] Omit styles when cloudMapId is set
WillBLogical Aug 22, 2025
377d223
Replace deprecated cloudMapId usage with mapId
WillBLogical Aug 22, 2025
d4af3d8
Updated version
WillBLogical Aug 22, 2025
70fb544
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Aug 22, 2025
e65b28e
Fixed the following issue
WillBLogical Aug 22, 2025
b7b5363
[google_maps_flutter_web] Omit styles when cloudMapId is set
WillBLogical Aug 22, 2025
27b320d
Replace deprecated cloudMapId usage with mapId
WillBLogical Aug 22, 2025
65cca33
Updated version
WillBLogical Aug 22, 2025
08c8c84
Fixed the following issue
WillBLogical Aug 22, 2025
0a3dfee
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Aug 23, 2025
74c07d5
Updated version
WillBLogical Aug 23, 2025
3d17075
Merge remote-tracking branch 'origin/fix-maps-web-style-conflict-v2' …
WillBLogical Aug 23, 2025
5a1b6eb
Updated version
WillBLogical Aug 23, 2025
7295738
Updated version
WillBLogical Aug 23, 2025
fa83792
Updated version
WillBLogical Aug 23, 2025
222842a
Updated version
WillBLogical Aug 24, 2025
b44a844
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Aug 25, 2025
fadbb6c
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Aug 26, 2025
2e91af2
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Aug 27, 2025
b9b4b66
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Aug 27, 2025
128a5a5
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Aug 31, 2025
c607b09
Updated version
WillBLogical Sep 3, 2025
dbbd066
Merge remote-tracking branch 'origin/fix-maps-web-style-conflict-v2' …
WillBLogical Sep 3, 2025
0603868
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Sep 3, 2025
e454303
[google_maps_flutter_web] Address review: revert code move; bump to 0…
WillBLogical Sep 3, 2025
21262ef
Merge remote-tracking branch 'origin/fix-maps-web-style-conflict-v2' …
WillBLogical Sep 3, 2025
964b445
[google_maps_flutter_web] bump to 0.5.14+2
WillBLogical Sep 3, 2025
0d5ca14
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Sep 3, 2025
9840a8c
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical Sep 3, 2025
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.5.14+2

* Fixes a bug where using `cloudMapId` for cloud-based styling would fail if the `style` property was also present.

## 0.5.14+1

* Stops processing events and cancels subscriptions when controller is disposed.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';
import 'package:flutter/widgets.dart'
show Directionality, SizedBox, TextDirection;
import 'package:flutter_test/flutter_test.dart';
import 'package:google_maps/google_maps.dart' as gmaps;
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'
show
CameraPosition,
LatLng,
MapConfiguration,
MapEvent,
MapWidgetConfiguration;
import 'package:google_maps_flutter_web/google_maps_flutter_web.dart'
show GoogleMapController;
import 'package:integration_test/integration_test.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

MapWidgetConfiguration cfg() => const MapWidgetConfiguration(
initialCameraPosition: CameraPosition(target: LatLng(0, 0), zoom: 1),
textDirection: TextDirection.ltr,
);

testWidgets('cloudMapId present => mapId set & styles omitted', (
WidgetTester tester,
) async {
const MapConfiguration testMapConfig = MapConfiguration(
mapId: 'test-cloud-map-id',
);

await tester.pumpWidget(
const Directionality(textDirection: TextDirection.ltr, child: SizedBox()),
);

final StreamController<MapEvent<Object?>> stream =
StreamController<MapEvent<Object?>>();
addTearDown(() {
// Stream is closed by controller.dispose()
});

gmaps.MapOptions? captured;

final GoogleMapController controller = GoogleMapController(
mapId: 1, // Internal controller ID
streamController: stream,
widgetConfiguration: cfg(),
mapConfiguration: testMapConfig, // cloudMapId is set here
);

controller.debugSetOverrides(
setOptions: (gmaps.MapOptions options) {
captured = options;
},
);

final List<gmaps.MapTypeStyle> styles = <gmaps.MapTypeStyle>[
gmaps.MapTypeStyle()
..featureType = 'road'
..elementType = 'geometry',
];

controller.updateStyles(styles);

await tester.pump();

expect(captured, isNotNull);
expect(captured!.mapId, testMapConfig.mapId);
expect(
captured!.styles == null || captured!.styles!.isEmpty,
isTrue,
reason: 'When cloudMapId is set, styles must not be applied.',
);

controller.dispose();
});

testWidgets('no cloudMapId => styles applied', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(textDirection: TextDirection.ltr, child: SizedBox()),
);

final StreamController<MapEvent<Object?>> stream =
StreamController<MapEvent<Object?>>();
addTearDown(() {
// Stream is closed by controller.dispose()
});

gmaps.MapOptions? captured;
final GoogleMapController controller = GoogleMapController(
mapId: 2, // Internal controller ID
streamController: stream,
widgetConfiguration: cfg(),
);

controller.debugSetOverrides(
setOptions: (gmaps.MapOptions options) {
captured = options;
},
);

final List<gmaps.MapTypeStyle> styles = <gmaps.MapTypeStyle>[
gmaps.MapTypeStyle()
..featureType = 'poi'
..elementType = 'labels',
];

controller.updateStyles(styles);

await tester.pump();

expect(captured, isNotNull);
expect(
captured!.mapId,
anyOf(isNull, isEmpty),
reason: 'mapId should be empty/null when no Cloud Map is used.',
);
expect(captured!.styles, isNotNull);
expect(
captured!.styles,
isNotEmpty,
reason: 'When cloudMapId is null, styles should be applied.',
);

controller.dispose();
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ gmaps.MapOptions _configurationAndStyleToGmapsOptions(
options.fullscreenControl = false;
options.streetViewControl = false;

// See updateMapConfiguration for why this is not using configuration.style.
options.styles = styles;
// If using cloud map, do not set options.styles
if (configuration.cloudMapId == null) {
options.styles = styles;
}

options.mapId = configuration.cloudMapId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_maps_flutter_web
description: Web platform implementation of google_maps_flutter
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
version: 0.5.14+1
version: 0.5.14+2

environment:
sdk: ^3.7.0
Expand Down