DurationPickerState

class DurationPickerState(initialDuration: Duration = Duration.ZERO)

Saveable logical state for DurationPicker.

The state owns one scalar selectedDuration. selectedHours and selectedMinutes are derived views of that value, so programmatic multi-field changes cannot expose an intermediate state.

Parameters

initialDuration

Initial finite, non-negative, whole-minute duration.

Throws

if initialDuration is outside the supported duration domain or its elapsed whole-hour part does not fit in Int.

Constructors

Link copied to clipboard
constructor(initialDuration: Duration = Duration.ZERO)
constructor(initialHours: Int, initialMinutes: Int)

Creates state from elapsed initialHours and minute-within-hour initialMinutes.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The currently selected logical duration.

Link copied to clipboard

The elapsed whole-hour part of selectedDuration.

Link copied to clipboard

The minute-within-hour part of selectedDuration, in 0..59.

Functions

Link copied to clipboard
fun selectDuration(duration: Duration)

Programmatically selects duration without dispatching DurationPicker user callbacks.

fun selectDuration(hours: Int, minutes: Int)

Programmatically selects elapsed hours and minute-within-hour minutes.

Programmatically selects the closest duration to duration allowed by items.

fun selectDuration(hours: Int, minutes: Int, items: DurationPickerItems)

Programmatically selects the closest duration to hours/minutes allowed by items.