Track

@Composable
fun Track(sliderState: SliderState, modifier: Modifier = Modifier, enabled: Boolean = true, colors: SliderColors = colors(), drawStopIndicator: DrawScope.(Offset) -> Unit? = { drawStopIndicator( drawScope = this, offset = it, color = colors.trackColor(enabled, active = true), size = TrackStopIndicatorSize ) }, drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color -> drawStopIndicator(drawScope = this, offset = offset, color = color, size = TickSize) }, thumbTrackGapSize: Dp = ThumbTrackGapSize, trackInsideCornerSize: Dp = TrackInsideCornerSize)

The Default track for Slider

Parameters

sliderState

SliderState which is used to obtain the current active track.

modifier

the Modifier to be applied to the track.

enabled

controls the enabled state of this slider. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

colors

SliderColors that will be used to resolve the colors used for this track in different states. See SliderDefaults.colors.

drawStopIndicator

lambda that will be called to draw the stop indicator at the end of the track.

drawTick

lambda that will be called to draw the ticks if steps are greater than 0.

thumbTrackGapSize

size of the gap between the thumb and the track.

trackInsideCornerSize

size of the corners towards the thumb when a gap is set.


@Composable
fun Track(rangeSliderState: RangeSliderState, modifier: Modifier = Modifier, enabled: Boolean = true, colors: SliderColors = colors(), drawStopIndicator: DrawScope.(Offset) -> Unit? = { drawStopIndicator( drawScope = this, offset = it, color = colors.trackColor(enabled, active = true), size = TrackStopIndicatorSize ) }, drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color -> drawStopIndicator(drawScope = this, offset = offset, color = color, size = TickSize) }, thumbTrackGapSize: Dp = ThumbTrackGapSize, trackInsideCornerSize: Dp = TrackInsideCornerSize)

The Default track for RangeSlider

Parameters

rangeSliderState

RangeSliderState which is used to obtain the current active track.

modifier

the Modifier to be applied to the track.

enabled

controls the enabled state of this slider. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.

colors

SliderColors that will be used to resolve the colors used for this track in different states. See SliderDefaults.colors.

drawStopIndicator

lambda that will be called to draw the stop indicator at the start/end of the track.

drawTick

lambda that will be called to draw the ticks if steps are greater than 0.

thumbTrackGapSize

size of the gap between the thumbs and the track.

trackInsideCornerSize

size of the corners towards the thumbs when a gap is set.


@Composable
fun Track(sliderPositions: SliderPositions, modifier: Modifier = Modifier, colors: SliderColors = colors(), enabled: Boolean = true)

Deprecated

Use version that supports slider state

The Default track for Slider and RangeSlider

Parameters

sliderPositions

SliderPositions which is used to obtain the current active track and the tick positions if the slider is discrete.

modifier

the Modifier to be applied to the track.

colors

SliderColors that will be used to resolve the colors used for this track in different states. See SliderDefaults.colors.

enabled

controls the enabled state of this slider. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.