-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[google_maps_flutter_web] Omit styles when cloudMapId is set #9869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
auto-submit
merged 29 commits into
flutter:main
from
WillBLogical:fix-maps-web-style-conflict-v2
Sep 4, 2025
Merged
Changes from 1 commit
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 377d223
Replace deprecated cloudMapId usage with mapId
WillBLogical d4af3d8
Updated version
WillBLogical 70fb544
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical e65b28e
Fixed the following issue
WillBLogical b7b5363
[google_maps_flutter_web] Omit styles when cloudMapId is set
WillBLogical 27b320d
Replace deprecated cloudMapId usage with mapId
WillBLogical 65cca33
Updated version
WillBLogical 08c8c84
Fixed the following issue
WillBLogical 0a3dfee
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical 74c07d5
Updated version
WillBLogical 3d17075
Merge remote-tracking branch 'origin/fix-maps-web-style-conflict-v2' …
WillBLogical 5a1b6eb
Updated version
WillBLogical 7295738
Updated version
WillBLogical fa83792
Updated version
WillBLogical 222842a
Updated version
WillBLogical b44a844
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical fadbb6c
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical 2e91af2
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical b9b4b66
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical 128a5a5
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical c607b09
Updated version
WillBLogical dbbd066
Merge remote-tracking branch 'origin/fix-maps-web-style-conflict-v2' …
WillBLogical 0603868
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical e454303
[google_maps_flutter_web] Address review: revert code move; bump to 0…
WillBLogical 21262ef
Merge remote-tracking branch 'origin/fix-maps-web-style-conflict-v2' …
WillBLogical 964b445
[google_maps_flutter_web] bump to 0.5.14+2
WillBLogical 0d5ca14
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical 9840a8c
Merge branch 'main' into fix-maps-web-style-conflict-v2
WillBLogical File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
..._maps_flutter/google_maps_flutter_web/example/integration_test/cloud_map_styles_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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( | ||
| cloudMapId: '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.cloudMapId); | ||
WillBLogical marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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(); | ||
| }); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.