Object

SliderDefaults

Object to hold defaults used by Slider

Source set: Common

Added in 1.11.0-rc01

object SliderDefaults

Object to hold defaults used by Slider

Properties

InactiveTrackAlpha

Source set: Common

Added in 1.11.0-rc01

const val InactiveTrackAlpha = 0.24f

Default alpha of the inactive part of the track

DisabledInactiveTrackAlpha

Source set: Common

Added in 1.11.0-rc01

const val DisabledInactiveTrackAlpha = 0.12f

Default alpha for the track when it is disabled but active

DisabledActiveTrackAlpha

Source set: Common

Added in 1.11.0-rc01

const val DisabledActiveTrackAlpha = 0.32f

Default alpha for the track when it is disabled and inactive

TickAlpha

Source set: Common

Added in 1.11.0-rc01

const val TickAlpha = 0.54f

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

DisabledTickAlpha

Source set: Common

Added in 1.11.0-rc01

const val DisabledTickAlpha = 0.12f

Default alpha for tick marks when they are disabled

Functions

colors

colors

Added in 1.11.0-rc01

@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

Last updated: