Jenga Time Input
fun JengaTimeInput(time: LocalTime, onTimeChange: (LocalTime) -> Unit, hourLabel: String, minuteLabel: String, amLabel: String, pmLabel: String, modifier: Modifier = Modifier, style: JengaTimeInputStyle = JengaTimeInputStyle.Wheel, is24Hour: Boolean = false, minuteStep: Int = 1)(source)
A time input: hour and minute, plus AM / PM in 12-hour mode, as scroll wheels or typed fields. Every visible string comes from the caller.
Parameters
time
the selected time.
on Time Change
called with the new time.
hour Label
the label for the hour wheel or field (e.g. "Hour").
minute Label
the label for the minute wheel or field (e.g. "Minute").
am Label
the label for the morning half (e.g. "AM").
pm Label
the label for the afternoon half (e.g. "PM").
modifier
the Modifier for the input.
style
wheels or typed fields; see JengaTimeInputStyle.
is24Hour
whether hours run 0 to 23 with no AM / PM choice.
minute Step
the gap between minutes on the minute wheel (e.g. 5); typed fields accept any minute.
Samples
var time by remember {
mutableStateOf(
value = LocalTime(
hour = 9,
minute = 30,
),
)
}
JengaTimeInput(
time = time,
onTimeChange = { time = it },
hourLabel = "Hour",
minuteLabel = "Minute",
amLabel = "AM",
pmLabel = "PM",
)Content copied to clipboard