Quick creation of a TimePickerDialog not yet part of (material3:1.3.0-alpha02), similar to DatePickerDialog provided in Material3 Library
As of material3:1.3.0-alpha02 there is not TimePickerDialog similar to DatePickerDialog so we have to create our own for similar behavior to the date picker provided.
var showTimePickerState by remember {
mutableStateOf(false)
}
if (showTimePickerState) {
TimePickerDialog(
onCancel = { showTimePickerState = false },
onConfirm = {
//Your confirm behavior here
val newTime = LocalTime(timePickerState.hour, timePickerState.minute)
showTimePickerState = false
},
) {
TimePicker(state = timePickerState)
}
}
