Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9cb7faf
Adds support for color scheme
martyfuhry Nov 19, 2025
838a768
adds color scheme to exportrs
martyfuhry Nov 19, 2025
e8c04e6
Renames to match naming convention
martyfuhry Nov 19, 2025
5854d68
Bumps version and updates changelog
martyfuhry Nov 19, 2025
f79f5c4
Merge branch 'main' into feat/web-colorscheme
martyfuhry Nov 19, 2025
ca8153c
updates the pubspec.yaml files to have path-based dependency overrides
martyfuhry Nov 20, 2025
c75420c
Updates pubspec.yaml of other touched plugins
martyfuhry Nov 20, 2025
5d53e49
adds CHANGELOG entries to affected federated packages. Reverts mistak…
martyfuhry Nov 20, 2025
24a65c4
Sets default color scheme to follow system and adds simple unit tests
martyfuhry Nov 20, 2025
ba0aa0c
Updates comment
martyfuhry Nov 20, 2025
47ff935
Fixes unit test and adds comments to clarify setting color scheme at …
martyfuhry Nov 20, 2025
d513046
format tests
martyfuhry Nov 20, 2025
5a03b72
Ran the update-release-info tool to fix changelogs
martyfuhry Nov 20, 2025
ddf41d3
Merge branch 'main' into feat/web-colorscheme
martyfuhry Nov 20, 2025
edc8972
fixes version change and changelog for platform interface
martyfuhry Nov 20, 2025
4344c6f
Reverts all changes for to google_maps_flutter_android and _ios
martyfuhry Dec 3, 2025
01e3dc8
Makes colorscheme nullable, removes default setting, fixes comments i…
martyfuhry Dec 3, 2025
4730f74
Fixes minor version bump in pubspec and changelogs
martyfuhry Dec 3, 2025
3fde10c
Resolves conflicts
martyfuhry Dec 3, 2025
89e5820
Fixes comments and adds unit tests.
martyfuhry Dec 3, 2025
2cc8021
Fixes comments. Adds fallthrough handling for color scheme enum mapping
martyfuhry Dec 3, 2025
51e97d1
fixes default color scheme null
martyfuhry Dec 4, 2025
17b73a0
fixes google_maps version
martyfuhry Dec 4, 2025
1b9b4a4
fixing versioning
martyfuhry Dec 4, 2025
42aecea
reverts remaining accidental clobbered changes from main rebase in io…
martyfuhry Dec 4, 2025
69f7b2b
Fixes the version mismatch in the changelog and pubspec
martyfuhry Dec 4, 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,11 +1,12 @@
## 2.14.1
## 2.15.0

* Replaces internal use of deprecated methods.
* Updates minimum supported SDK version to Flutter 3.32/Dart 3.8.
* Updates README to reflect currently supported OS versions for the latest
versions of the endorsed platform implementations.
* Applications built with older versions of Flutter will continue to
use compatible versions of the platform implementations.
* Adds `colorScheme` support for web cloud-based maps styling brightness.

## 2.14.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ flutter:
uses-material-design: true
assets:
- assets/
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
google_maps_flutter_platform_interface: {path: ../../../../packages/google_maps_flutter/google_maps_flutter_platform_interface}
google_maps_flutter_web: {path: ../../../../packages/google_maps_flutter/google_maps_flutter_web}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export 'package:google_maps_flutter_platform_interface/google_maps_flutter_platf
LatLng,
LatLngBounds,
MapBitmapScaling,
MapColorScheme,
MapStyleException,
MapType,
Marker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class GoogleMap extends StatefulWidget {
this.onTap,
this.onLongPress,
this.cloudMapId,
this.colorScheme,
});

/// Callback method for when the map is ready to be used.
Expand Down Expand Up @@ -373,6 +374,14 @@ class GoogleMap extends StatefulWidget {
/// for more details.
final String? cloudMapId;

/// Color scheme for the cloud-style map. Web only.
///
/// The colorScheme option can only be set when the map is initialized;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a blank line above it, per Effective Dart.

/// setting this option after the map is created will have no effect.
///
/// See https://developers.google.com/maps/documentation/javascript/mapcolorscheme for more details.
final MapColorScheme? colorScheme;

/// Creates a [State] for this [GoogleMap].
@override
State createState() => _GoogleMapState();
Expand Down Expand Up @@ -723,7 +732,8 @@ MapConfiguration _configurationFromMapWidget(GoogleMap map) {
indoorViewEnabled: map.indoorViewEnabled,
trafficEnabled: map.trafficEnabled,
buildingsEnabled: map.buildingsEnabled,
mapId: map.cloudMapId,
cloudMapId: map.cloudMapId,
colorScheme: map.colorScheme,
// A null style in the widget means no style, which is expressed as '' in
// the configuration to distinguish from no change (null).
style: map.style ?? '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
version: 2.14.1
version: 2.15.0

environment:
sdk: ^3.8.0
Expand Down Expand Up @@ -41,3 +41,8 @@ topics:
# The example deliberately includes limited-use secrets.
false_secrets:
- /example/web/index.html
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
google_maps_flutter_platform_interface: {path: ../../../packages/google_maps_flutter/google_maps_flutter_platform_interface}
google_maps_flutter_web: {path: ../../../packages/google_maps_flutter/google_maps_flutter_web}
Original file line number Diff line number Diff line change
Expand Up @@ -659,4 +659,37 @@ void main() {

expect(map.tileOverlaySets.length, 1);
});

testWidgets('Is default color scheme null', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
initialCameraPosition: CameraPosition(target: LatLng(10.0, 15.0)),
),
),
);

final PlatformMapStateRecorder map = platform.lastCreatedMap;

expect(map.mapConfiguration.colorScheme, null);
});

testWidgets('Can set color scheme to non-default', (
WidgetTester tester,
) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: GoogleMap(
initialCameraPosition: CameraPosition(target: LatLng(10.0, 15.0)),
colorScheme: MapColorScheme.light,
),
),
);

final PlatformMapStateRecorder map = platform.lastCreatedMap;

expect(map.mapConfiguration.colorScheme, MapColorScheme.light);
});
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.15.0

* Adds support for `colorScheme` for cloud-based maps styling brightness in web.

## 2.14.1

* Replaces internal use of deprecated methods.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// The color scheme of the map to be used with cloud styles.
enum MapColorScheme {
/// The light color scheme for the map.
light,

/// The dark color scheme for the map.
dark,

/// The system default color scheme for the map.
followSystem,
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to this file need to be unit tested.

Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class MapConfiguration {
String? cloudMapId,
this.style,
this.markerType,
this.colorScheme,
}) : mapId = mapId ?? cloudMapId;

/// This setting controls how the API handles gestures on the map. Web only.
Expand Down Expand Up @@ -152,6 +153,11 @@ class MapConfiguration {
@Deprecated('cloudMapId is deprecated. Use mapId instead.')
String? get cloudMapId => mapId;

/// Preferred color scheme for the cloud-styled map. Web only.
///
/// See https://developers.google.com/maps/documentation/javascript/mapcolorscheme for more details.
final MapColorScheme? colorScheme;

/// Returns a new options object containing only the values of this instance
/// that are different from [other].
MapConfiguration diffFrom(MapConfiguration other) {
Expand Down Expand Up @@ -225,6 +231,7 @@ class MapConfiguration {
? buildingsEnabled
: null,
mapId: mapId != other.mapId ? mapId : null,
colorScheme: colorScheme != other.colorScheme ? colorScheme : null,
style: style != other.style ? style : null,
markerType: markerType != other.markerType ? markerType : null,
);
Expand Down Expand Up @@ -264,6 +271,7 @@ class MapConfiguration {
buildingsEnabled: diff.buildingsEnabled ?? buildingsEnabled,
mapId: diff.mapId ?? mapId,
style: diff.style ?? style,
colorScheme: diff.colorScheme ?? colorScheme,
markerType: diff.markerType ?? markerType,
);
}
Expand Down Expand Up @@ -293,6 +301,7 @@ class MapConfiguration {
trafficEnabled == null &&
buildingsEnabled == null &&
mapId == null &&
colorScheme == null &&
style == null &&
markerType == null;

Expand Down Expand Up @@ -329,6 +338,7 @@ class MapConfiguration {
buildingsEnabled == other.buildingsEnabled &&
mapId == other.mapId &&
style == other.style &&
colorScheme == other.colorScheme &&
markerType == other.markerType;
}

Expand Down Expand Up @@ -358,6 +368,7 @@ class MapConfiguration {
buildingsEnabled,
mapId,
style,
colorScheme,
markerType,
]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export 'heatmap.dart';
export 'heatmap_updates.dart';
export 'joint_type.dart';
export 'location.dart';
export 'map_color_scheme.dart';
export 'map_configuration.dart';
export 'map_objects.dart';
export 'map_widget_configuration.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_maps_f
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.14.1
version: 2.15.0

environment:
sdk: ^3.8.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,22 @@ void main() {
// The hash code should change.
expect(empty.hashCode, isNot(diff.hashCode));
});

test('handle colorScheme', () async {
const diff = MapConfiguration(colorScheme: MapColorScheme.followSystem);

const empty = MapConfiguration();
final MapConfiguration updated = diffBase.applyDiff(diff);

// A diff applied to empty options should be the diff itself.
expect(empty.applyDiff(diff), diff);
// The diff from empty options should be the diff itself.
expect(diff.diffFrom(empty), diff);
// A diff applied to non-empty options should update that field.
expect(updated.colorScheme, MapColorScheme.followSystem);
// The hash code should change.
expect(empty.hashCode, isNot(diff.hashCode));
});
});

group('isEmpty', () {
Expand Down Expand Up @@ -641,5 +657,11 @@ void main() {

expect(diff.isEmpty, false);
});

test('is false with colorScheme', () async {
const diff = MapConfiguration(colorScheme: MapColorScheme.followSystem);

expect(diff.isEmpty, false);
});
});
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.5.15

* Adds `colorScheme` support for web cloud-based maps styling brightness.
* Updates minimum supported SDK version to Flutter 3.35/Dart 3.9.

## 0.5.14+3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ flutter:
assets:
- assets/

# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
# Override the google_maps_flutter dependency on google_maps_flutter_web.
# TODO(ditman): Unwind the circular dependency. This will create problems
# if we need to make a breaking change to google_maps_flutter_web.
google_maps_flutter_web:
path: ../
google_maps_flutter: {path: ../../../../packages/google_maps_flutter/google_maps_flutter}
google_maps_flutter_platform_interface: {path: ../../../../packages/google_maps_flutter/google_maps_flutter_platform_interface}
google_maps_flutter_web: {path: ../}
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ gmaps.MapOptions _configurationAndStyleToGmapsOptions(

options.mapId = configuration.mapId;

// Convert the color scheme, if any, and set it
final gmaps.ColorScheme? jsColorScheme = _gmapTypeColorSchemeForPluginColor(
configuration.colorScheme,
);
if (jsColorScheme != null) {
options.colorScheme = jsColorScheme;
}

return options;
}

Expand All @@ -155,6 +163,23 @@ gmaps.MapTypeId _gmapTypeIDForPluginType(MapType type) {
return gmaps.MapTypeId.ROADMAP;
}

gmaps.ColorScheme? _gmapTypeColorSchemeForPluginColor(MapColorScheme? scheme) {
if (scheme == null) {
return null;
}

switch (scheme) {
case MapColorScheme.dark:
return gmaps.ColorScheme.DARK;
case MapColorScheme.light:
return gmaps.ColorScheme.LIGHT;
case MapColorScheme.followSystem:
return gmaps.ColorScheme.FOLLOW_SYSTEM;
}
// ignore: dead_code
return gmaps.ColorScheme.FOLLOW_SYSTEM;
}

gmaps.MapOptions _applyInitialPosition(
CameraPosition initialPosition,
gmaps.MapOptions options,
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+3
version: 0.5.15

environment:
sdk: ^3.9.0
Expand Down Expand Up @@ -40,3 +40,7 @@ topics:
# The example deliberately includes limited-use secrets.
false_secrets:
- /example/web/index.html
# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE.
# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins
dependency_overrides:
google_maps_flutter_platform_interface: {path: ../../../packages/google_maps_flutter/google_maps_flutter_platform_interface}