SliderDefaults
-
Cmn
object SliderDefaults
Object to hold defaults used by Slider
Summary
Public functions |
||
---|---|---|
Unit |
@ExperimentalMaterial3ExpressiveApi The Default centered track for |
Cmn
|
Unit |
@Composable The Default thumb for |
Cmn
|
Unit |
@ExperimentalMaterial3ExpressiveApi The Default thumb for |
Cmn
|
Unit |
@Composable This function is deprecated. Use version that supports slider state |
Cmn
|
Unit |
@Composable The Default track for |
Cmn
|
Unit |
@ExperimentalMaterial3Api The Default track for |
Cmn
|
Unit |
@ExperimentalMaterial3ExpressiveApi The Default track for |
Cmn
|
SliderColors |
Creates a |
Cmn
|
SliderColors |
@Composable Creates a |
Cmn
|
Unit |
DrawScope.drawStopIndicator(offset: Offset, size: Dp, color: Color) The Default stop indicator. |
Cmn
|
Public properties |
||
---|---|---|
Dp |
The default size for the ticks if steps are greater than 0. |
Cmn
|
Dp |
The default size for the stop indicator at the end of the track. |
Cmn
|
Public functions
CenteredTrack
@ExperimentalMaterial3ExpressiveApi
@Composable
fun CenteredTrack(
sliderState: SliderState,
modifier: Modifier = Modifier,
enabled: Boolean = true,
colors: SliderColors = colors(),
drawStopIndicator: (DrawScope.(Offset) -> Unit)? = { drawStopIndicator( offset = it, color = colors.trackColor(enabled, active = true), size = TrackStopIndicatorSize ) },
drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color -> drawStopIndicator(offset = offset, color = color, size = TickSize) },
thumbTrackGapSize: Dp = ThumbTrackGapSize,
trackInsideCornerSize: Dp = TrackInsideCornerSize,
trackCornerSize: Dp = Dp.Unspecified
): Unit
The Default centered track for Slider
and VerticalSlider
This track starts from the center of the slider.
Parameters | |
---|---|
sliderState: SliderState |
|
modifier: Modifier = Modifier |
the |
enabled: Boolean = true |
controls the enabled state of this slider. When |
colors: SliderColors = colors() |
|
drawStopIndicator: (DrawScope.(Offset) -> Unit)? = {
drawStopIndicator(
offset = it,
color = colors.trackColor(enabled, active = true),
size = TrackStopIndicatorSize
)
} |
lambda that will be called to draw the stop indicator at the end of the track. |
drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color ->
drawStopIndicator(offset = offset, color = color, size = TickSize)
} |
lambda that will be called to draw the ticks if steps are greater than 0. |
thumbTrackGapSize: Dp = ThumbTrackGapSize |
size of the gap between the thumb and the track. |
trackInsideCornerSize: Dp = TrackInsideCornerSize |
size of the corners towards the thumb when a gap is set. |
trackCornerSize: Dp = Dp.Unspecified |
size of the external corners. |
Thumb
@Composable
fun Thumb(
interactionSource: MutableInteractionSource,
modifier: Modifier = Modifier,
colors: SliderColors = colors(),
enabled: Boolean = true,
thumbSize: DpSize = ThumbSize
): Unit
The Default thumb for Slider
and RangeSlider
Parameters | |
---|---|
interactionSource: MutableInteractionSource |
the |
modifier: Modifier = Modifier |
the |
colors: SliderColors = colors() |
|
enabled: Boolean = true |
controls the enabled state of this slider. When |
thumbSize: DpSize = ThumbSize |
the size of the thumb. |
Thumb
@ExperimentalMaterial3ExpressiveApi
@Composable
fun Thumb(
interactionSource: MutableInteractionSource,
sliderState: SliderState,
modifier: Modifier = Modifier,
colors: SliderColors = colors(),
enabled: Boolean = true,
thumbSize: DpSize = ThumbSize
): Unit
The Default thumb for Slider
, VerticalSlider
and RangeSlider
Parameters | |
---|---|
interactionSource: MutableInteractionSource |
the |
sliderState: SliderState |
|
modifier: Modifier = Modifier |
the |
colors: SliderColors = colors() |
|
enabled: Boolean = true |
controls the enabled state of this slider. When |
thumbSize: DpSize = ThumbSize |
the size of the thumb. |
Track
@Composable
funTrack(
sliderPositions: SliderPositions,
modifier: Modifier = Modifier,
colors: SliderColors = colors(),
enabled: Boolean = true
): Unit
The Default track for Slider
and RangeSlider
Parameters | |
---|---|
sliderPositions: SliderPositions |
|
modifier: Modifier = Modifier |
the |
colors: SliderColors = colors() |
|
enabled: Boolean = true |
controls the enabled state of this slider. When |
Track
@Composable
fun Track(
rangeSliderState: RangeSliderState,
modifier: Modifier = Modifier,
enabled: Boolean = true,
colors: SliderColors = colors(),
drawStopIndicator: (DrawScope.(Offset) -> Unit)? = { drawStopIndicator( offset = it, color = colors.trackColor(enabled, active = true), size = TrackStopIndicatorSize ) },
drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color -> drawStopIndicator(offset = offset, color = color, size = TickSize) },
thumbTrackGapSize: Dp = ThumbTrackGapSize,
trackInsideCornerSize: Dp = TrackInsideCornerSize
): Unit
The Default track for RangeSlider
Parameters | |
---|---|
rangeSliderState: RangeSliderState |
|
modifier: Modifier = Modifier |
the |
enabled: Boolean = true |
controls the enabled state of this slider. When |
colors: SliderColors = colors() |
|
drawStopIndicator: (DrawScope.(Offset) -> Unit)? = {
drawStopIndicator(
offset = it,
color = colors.trackColor(enabled, active = true),
size = TrackStopIndicatorSize
)
} |
lambda that will be called to draw the stop indicator at the start/end of the track. |
drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color ->
drawStopIndicator(offset = offset, color = color, size = TickSize)
} |
lambda that will be called to draw the ticks if steps are greater than 0. |
thumbTrackGapSize: Dp = ThumbTrackGapSize |
size of the gap between the thumbs and the track. |
trackInsideCornerSize: Dp = TrackInsideCornerSize |
size of the corners towards the thumbs when a gap is set. |
Track
@ExperimentalMaterial3Api
@Composable
fun Track(
sliderState: SliderState,
modifier: Modifier = Modifier,
enabled: Boolean = true,
colors: SliderColors = colors(),
drawStopIndicator: (DrawScope.(Offset) -> Unit)? = { drawStopIndicator( offset = it, color = colors.trackColor(enabled, active = true), size = TrackStopIndicatorSize ) },
drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color -> drawStopIndicator(offset = offset, color = color, size = TickSize) },
thumbTrackGapSize: Dp = ThumbTrackGapSize,
trackInsideCornerSize: Dp = TrackInsideCornerSize
): Unit
The Default track for Slider
Parameters | |
---|---|
sliderState: SliderState |
|
modifier: Modifier = Modifier |
the |
enabled: Boolean = true |
controls the enabled state of this slider. When |
colors: SliderColors = colors() |
|
drawStopIndicator: (DrawScope.(Offset) -> Unit)? = {
drawStopIndicator(
offset = it,
color = colors.trackColor(enabled, active = true),
size = TrackStopIndicatorSize
)
} |
lambda that will be called to draw the stop indicator at the end of the track. |
drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color ->
drawStopIndicator(offset = offset, color = color, size = TickSize)
} |
lambda that will be called to draw the ticks if steps are greater than 0. |
thumbTrackGapSize: Dp = ThumbTrackGapSize |
size of the gap between the thumb and the track. |
trackInsideCornerSize: Dp = TrackInsideCornerSize |
size of the corners towards the thumb when a gap is set. |
Track
@ExperimentalMaterial3ExpressiveApi
@Composable
fun Track(
sliderState: SliderState,
trackCornerSize: Dp,
modifier: Modifier = Modifier,
enabled: Boolean = true,
colors: SliderColors = colors(),
drawStopIndicator: (DrawScope.(Offset) -> Unit)? = { drawStopIndicator( offset = it, color = colors.trackColor(enabled, active = true), size = TrackStopIndicatorSize ) },
drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color -> drawStopIndicator(offset = offset, color = color, size = TickSize) },
thumbTrackGapSize: Dp = ThumbTrackGapSize,
trackInsideCornerSize: Dp = TrackInsideCornerSize
): Unit
The Default track for Slider
and VerticalSlider
This track has a different corner treatment where the corner size decreases as the thumb gets closer.
Parameters | |
---|---|
sliderState: SliderState |
|
trackCornerSize: Dp |
size of the external corners. |
modifier: Modifier = Modifier |
the |
enabled: Boolean = true |
controls the enabled state of this slider. When |
colors: SliderColors = colors() |
|
drawStopIndicator: (DrawScope.(Offset) -> Unit)? = {
drawStopIndicator(
offset = it,
color = colors.trackColor(enabled, active = true),
size = TrackStopIndicatorSize
)
} |
lambda that will be called to draw the stop indicator at the end of the track. |
drawTick: DrawScope.(Offset, Color) -> Unit = { offset, color ->
drawStopIndicator(offset = offset, color = color, size = TickSize)
} |
lambda that will be called to draw the ticks if steps are greater than 0. |
thumbTrackGapSize: Dp = ThumbTrackGapSize |
size of the gap between the thumb and the track. |
trackInsideCornerSize: Dp = TrackInsideCornerSize |
size of the corners towards the thumb when a gap is set. |
colors
@Composable
fun colors(): SliderColors
Creates a SliderColors
that represents the different colors used in parts of the Slider
in different states.
colors
@Composable
fun colors(
thumbColor: Color = Color.Unspecified,
activeTrackColor: Color = Color.Unspecified,
activeTickColor: Color = Color.Unspecified,
inactiveTrackColor: Color = Color.Unspecified,
inactiveTickColor: Color = Color.Unspecified,
disabledThumbColor: Color = Color.Unspecified,
disabledActiveTrackColor: Color = Color.Unspecified,
disabledActiveTickColor: Color = Color.Unspecified,
disabledInactiveTrackColor: Color = Color.Unspecified,
disabledInactiveTickColor: Color = Color.Unspecified
): 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, while the rest is inactive.
Parameters | |
---|---|
thumbColor: Color = Color.Unspecified |
thumb color when enabled |
activeTrackColor: Color = Color.Unspecified |
color of the track in the part that is "active", meaning that the thumb is ahead of it |
activeTickColor: Color = Color.Unspecified |
colors to be used to draw tick marks on the active track, if |
inactiveTrackColor: Color = Color.Unspecified |
color of the track in the part that is "inactive", meaning that the thumb is before it |
inactiveTickColor: Color = Color.Unspecified |
colors to be used to draw tick marks on the inactive track, if |
disabledThumbColor: Color = Color.Unspecified |
thumb colors when disabled |
disabledActiveTrackColor: Color = Color.Unspecified |
color of the track in the "active" part when the Slider is disabled |
disabledActiveTickColor: Color = Color.Unspecified |
colors to be used to draw tick marks on the active track when Slider is disabled and when |
disabledInactiveTrackColor: Color = Color.Unspecified |
color of the track in the "inactive" part when the Slider is disabled |
disabledInactiveTickColor: Color = Color.Unspecified |
colors to be used to draw tick marks on the inactive part of the track when Slider is disabled and when |
Public properties
TrackStopIndicatorSize
val TrackStopIndicatorSize: Dp
The default size for the stop indicator at the end of the track.