rememberRangeSliderState

Functions summary

RangeSliderState
@Composable
rememberRangeSliderState(
    activeRangeStart: Float,
    activeRangeEnd: Float,
    steps: @IntRange(from = 0) Int,
    onValueChangeFinished: (() -> Unit)?,
    valueRange: ClosedFloatingPointRange<Float>
)

Creates a RangeSliderState that is remembered across compositions.

Cmn

Functions

rememberRangeSliderState

@Composable
fun rememberRangeSliderState(
    activeRangeStart: Float = 0.0f,
    activeRangeEnd: Float = 1.0f,
    steps: @IntRange(from = 0) Int = 0,
    onValueChangeFinished: (() -> Unit)? = null,
    valueRange: ClosedFloatingPointRange<Float> = 0f..1f
): RangeSliderState

Creates a RangeSliderState that is remembered across compositions.

Changes to the provided initial values will not result in the state being recreated or changed in any way if it has already been created.

Parameters
activeRangeStart: Float = 0.0f

Float that indicates the initial start value of the selected active range (for the start thumb). This represents a specific position on the track and is coerced to the bounds of valueRange.

activeRangeEnd: Float = 1.0f

Float that indicates the initial end value of the selected active range (for the end thumb). This represents a specific position on the track and is coerced to the bounds of valueRange.

steps: @IntRange(from = 0) Int = 0

if positive, specifies the amount of discrete allowable values between the endpoints of valueRange. For example, a range from 0 to 10 with 4 steps allows 4 values evenly distributed between 0 and 10 (i.e., 2, 4, 6, 8). If steps is 0, the slider will behave continuously and allow any value from the range. Must not be negative.

onValueChangeFinished: (() -> Unit)? = null

lambda to be invoked when value change has ended. This callback shouldn't be used to update the range slider values (use RangeSliderState.onValueChange for that), but rather to know when the user has completed selecting a new value by ending a drag or a click. For keyboard movements, this is called on every step.

valueRange: ClosedFloatingPointRange<Float> = 0f..1f

the full range of values that the entire Range Slider track represents. This defines the absolute boundaries/constraints of the slider (from minimum to maximum), and the individual thumb values (activeRangeStart and activeRangeEnd) are coerced to this range.