Android 12 Developer Preview is here! Try it out, and give us your feedback!

SliderDefaults

object SliderDefaults
kotlin.Any
   ↳ androidx.compose.material.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 methods
SliderColors
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))

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

Constants

DisabledActiveTrackAlpha

const val DisabledActiveTrackAlpha: Float

Default alpha for the track when it is disabled and inactive

Value: 0.32f

DisabledInactiveTrackAlpha

const val DisabledInactiveTrackAlpha: Float

Default alpha for the track when it is disabled but active

Value: 0.12f

DisabledTickAlpha

const val DisabledTickAlpha: Float

Default alpha for tick marks when they are disabled

Value: 0.12f

InactiveTrackAlpha

const val InactiveTrackAlpha: Float

Default alpha of the inactive part of the track

Value: 0.24f

TickAlpha

const val TickAlpha: Float

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

Value: 0.54f

Public methods

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),