SliderState

class SliderState(value: Float = 0.0f, @IntRange(from = 0) val steps: Int = 0, var onValueChangeFinished: () -> Unit? = null, val valueRange: ClosedFloatingPointRange<Float> = 0f..1f) : DraggableState

Class that holds information about Slider's active range.

Parameters

value

Float that indicates the initial position of the thumb. If outside of valueRange provided, value will be coerced to this range.

steps

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

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

valueRange

range of values that Slider values can take. value will be coerced to this range.

Constructors

Link copied to clipboard
constructor(value: Float = 0.0f, @IntRange(from = 0) steps: Int = 0, onValueChangeFinished: () -> Unit? = null, valueRange: ClosedFloatingPointRange<Float> = 0f..1f)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The fraction of the track that the thumb currently is in.

Link copied to clipboard
Link copied to clipboard

Callback in which value should be updated.

Link copied to clipboard
Link copied to clipboard
@get:JvmName(name = "shouldAutoSnap")
var shouldAutoSnap: Boolean

Controls the auto-snapping mechanism, disabling it may be useful for custom animations.

Link copied to clipboard
val steps: Int
Link copied to clipboard

Float that indicates the value that the thumb currently is in respect to the track.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun dispatchRawDelta(delta: Float)
Link copied to clipboard
open suspend override fun drag(dragPriority: MutatePriority, block: suspend DragScope.() -> Unit)