Jenga Time Picker Dialog
fun JengaTimePickerDialog(onDismissRequest: () -> Unit, onConfirm: (LocalTime) -> Unit, title: String, confirmLabel: String, dismissLabel: String, initialTime: LocalTime, hourLabel: String, minuteLabel: String, amLabel: String, pmLabel: String, modifier: Modifier = Modifier, style: JengaTimeInputStyle = JengaTimeInputStyle.Wheel, is24Hour: Boolean = false, minuteStep: Int = 1)(source)
A dialog holding a JengaTimeInput, with dismiss and confirm actions. The time is only reported when the confirm action is tapped.
Parameters
on Dismiss Request
called when the dialog is dismissed (dismiss action, scrim tap or back).
on Confirm
called with the picked time when the confirm action is tapped.
title
the dialog title (e.g. "Delivery time").
confirm Label
the confirm action label.
dismiss Label
the dismiss action label.
initial Time
the time shown when the dialog opens.
hour Label
the label for the hour wheel or field.
minute Label
the label for the minute wheel or field.
am Label
the label for the morning half.
pm Label
the label for the afternoon half.
modifier
the Modifier for the dialog surface.
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.
Samples
var open by remember {
mutableStateOf(
value = true,
)
}
if (open) {
JengaTimePickerDialog(
onDismissRequest = { open = false },
onConfirm = { open = false },
title = "Delivery time",
confirmLabel = "OK",
dismissLabel = "Cancel",
initialTime = LocalTime(
hour = 14,
minute = 0,
),
hourLabel = "Hour",
minuteLabel = "Minute",
amLabel = "AM",
pmLabel = "PM",
)
}Content copied to clipboard