Object

SliderDefaults

Object to hold defaults used by Slider

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Common
object SliderDefaults

Object to hold defaults used by Slider

Properties

Common
const val InactiveTrackAlpha = 0.24f

Default alpha of the inactive part of the track

Common
const val DisabledInactiveTrackAlpha = 0.12f

Default alpha for the track when it is disabled but active

Common
const val DisabledActiveTrackAlpha = 0.32f

Default alpha for the track when it is disabled and inactive

Common
const val TickAlpha = 0.54f

Default alpha of the ticks that are drawn on top of the track

Common
const val DisabledTickAlpha = 0.12f

Default alpha for tick marks when they are disabled

Functions

colors

@Composable
    fun colors(
        thumbColor: Color = MaterialTheme.colors.primary,
        disabledThumbColor: Color =
            MaterialTheme.colors.onSurface
                .copy(alpha = ContentAlpha.disabled)
                .compositeOver(MaterialTheme.colors.surface),
        activeTrackColor: Color = MaterialTheme.colors.primary,
        inactiveTrackColor: Color = activeTrackColor.copy(alpha = InactiveTrackAlpha),
        disabledActiveTrackColor: Color =
            MaterialTheme.colors.onSurface.copy(alpha = DisabledActiveTrackAlpha),
        disabledInactiveTrackColor: Color =
            disabledActiveTrackColor.copy(alpha = DisabledInactiveTrackAlpha),
        activeTickColor: Color = contentColorFor(activeTrackColor).copy(alpha = TickAlpha),
        inactiveTickColor: Color = activeTrackColor.copy(alpha = TickAlpha),
        disabledActiveTickColor: Color = activeTickColor.copy(alpha = DisabledTickAlpha),
        disabledInactiveTickColor: Color =
            disabledInactiveTrackColor.copy(alpha = DisabledTickAlpha),
    ): SliderColors

Creates a SliderColors that represents the different colors used in parts of the Slider in different states.

For the name references below the words "active" and "inactive" are used. Active part of the slider is filled with progress, so if slider's progress is 30% out of 100%, left (or right in RTL) 30% of the track will be active, the rest is not active.

Parameters

thumbColor thumb color when enabled
disabledThumbColor thumb colors when disabled
activeTrackColor color of the track in the part that is "active", meaning that the thumb is ahead of it
inactiveTrackColor color of the track in the part that is "inactive", meaning that the thumb is before it
disabledActiveTrackColor color of the track in the "active" part when the Slider is disabled
disabledInactiveTrackColor color of the track in the "inactive" part when the Slider is disabled
activeTickColor colors to be used to draw tick marks on the active track, if steps is specified
inactiveTickColor colors to be used to draw tick marks on the inactive track, if steps are specified on the Slider is specified
disabledActiveTickColor colors to be used to draw tick marks on the active track when Slider is disabled and when steps are specified on it
disabledInactiveTickColor colors to be used to draw tick marks on the inactive part of the track when Slider is disabled and when steps are specified on it