Skip to content

Commit

Permalink
chore: not adding by default the MapColorScheme (#603)
Browse files Browse the repository at this point in the history
* fix: not adding by default the MapColorScheme

* doc: doc updated
  • Loading branch information
kikoso authored Jul 9, 2024
1 parent b22fab2 commit b5cee56
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ import kotlinx.coroutines.awaitCancellation
* @param onPOIClick lambda invoked when a POI is clicked
* @param contentPadding the padding values used to signal that portions of the map around the edges
* may be obscured. The map will move the Google logo, etc. to avoid overlapping the padding.
* @param mapColorScheme Defines the color scheme for the Map. By default it will be
* [ComposeMapColorScheme.FOLLOW_SYSTEM].
* @param mapColorScheme Defines the color scheme for the Map.
* @param content the content of the map
*/
@Composable
Expand All @@ -92,7 +91,7 @@ public fun GoogleMap(
onMyLocationClick: ((Location) -> Unit)? = null,
onPOIClick: ((PointOfInterest) -> Unit)? = null,
contentPadding: PaddingValues = DefaultMapContentPadding,
mapColorScheme: ComposeMapColorScheme = ComposeMapColorScheme.FOLLOW_SYSTEM,
mapColorScheme: ComposeMapColorScheme? = null,
content: @Composable @GoogleMapComposable () -> Unit = {},
) {
// When in preview, early return a Box with the received modifier preserving layout
Expand Down Expand Up @@ -139,7 +138,7 @@ public fun GoogleMap(
locationSource = currentLocationSource,
mapProperties = currentMapProperties,
mapUiSettings = currentUiSettings,
colorMapScheme = currentColorScheme.value
colorMapScheme = currentColorScheme?.value
)

MapClickListenerUpdater()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ internal inline fun MapUpdater(
locationSource: LocationSource?,
mapProperties: MapProperties,
mapUiSettings: MapUiSettings,
colorMapScheme: Int,
colorMapScheme: Int?,
) {
val map = (currentComposer.applier as MapApplier).map
val mapView = (currentComposer.applier as MapApplier).mapView
Expand Down Expand Up @@ -141,7 +141,11 @@ internal inline fun MapUpdater(
set(mapProperties.mapType) { map.mapType = it.value }
set(mapProperties.maxZoomPreference) { map.setMaxZoomPreference(it) }
set(mapProperties.minZoomPreference) { map.setMinZoomPreference(it) }
set(colorMapScheme) { map.mapColorScheme = it }
set(colorMapScheme) {
if (it != null) {
map.mapColorScheme = it
}
}
set(contentPadding) {
val node = this
with(this.density) {
Expand Down

0 comments on commit b5cee56

Please sign in to comment.