SliderDefaults

object SliderDefaults


Object to hold defaults used by Slider

Summary

Constants

const Float

Default alpha for the track when it is disabled and inactive

const Float

Default alpha for the track when it is disabled but active

const Float

Default alpha for tick marks when they are disabled

const Float

Default alpha of the inactive part of the track

const Float

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

Public functions

@Composable SliderColors
colors(
    thumbColor: Color,
    disabledThumbColor: Color,
    activeTrackColor: Color,
    inactiveTrackColor: Color,
    disabledActiveTrackColor: Color,
    disabledInactiveTrackColor: Color,
    activeTickColor: Color,
    inactiveTickColor: Color,
    disabledActiveTickColor: Color,
    disabledInactiveTickColor: Color
)

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

Constants

DisabledActiveTrackAlpha

const val DisabledActiveTrackAlphaFloat

Default alpha for the track when it is disabled and inactive

DisabledInactiveTrackAlpha

const val DisabledInactiveTrackAlphaFloat

Default alpha for the track when it is disabled but active

DisabledTickAlpha

const val DisabledTickAlphaFloat

Default alpha for tick marks when they are disabled

InactiveTrackAlpha

const val InactiveTrackAlphaFloat

Default alpha of the inactive part of the track

TickAlpha

const val TickAlphaFloat

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

Public 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: Color = MaterialTheme.colors.primary

thumb color when enabled

disabledThumbColor: Color = MaterialTheme.colors.onSurface .copy(alpha = ContentAlpha.disabled) .compositeOver(MaterialTheme.colors.surface)

thumb colors when disabled

activeTrackColor: Color = MaterialTheme.colors.primary

color of the track in the part that is "active", meaning that the thumb is ahead of it

inactiveTrackColor: Color = activeTrackColor.copy(alpha = InactiveTrackAlpha)

color of the track in the part that is "inactive", meaning that the thumb is before it

disabledActiveTrackColor: Color = MaterialTheme.colors.onSurface.copy(alpha = DisabledActiveTrackAlpha)

color of the track in the "active" part when the Slider is disabled

disabledInactiveTrackColor: Color = disabledActiveTrackColor.copy(alpha = DisabledInactiveTrackAlpha)

color of the track in the "inactive" part when the Slider is disabled

activeTickColor: Color = contentColorFor(activeTrackColor).copy(alpha = TickAlpha)

colors to be used to draw tick marks on the active track, if steps is specified

inactiveTickColor: Color = activeTrackColor.copy(alpha = TickAlpha)

colors to be used to draw tick marks on the inactive track, if steps are specified on the Slider is specified

disabledActiveTickColor: Color = activeTickColor.copy(alpha = DisabledTickAlpha)

colors to be used to draw tick marks on the active track when Slider is disabled and when steps are specified on it

disabledInactiveTickColor: Color = disabledInactiveTrackColor .copy(alpha = DisabledTickAlpha)

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