showMaterialTimePicker function
void
showMaterialTimePicker({
- required BuildContext context,
- String? title,
- required TimeOfDay selectedTime,
- String? confirmText,
- String? cancelText,
- ValueChanged<
TimeOfDay> ? onChanged, - VoidCallback? onConfirmed,
- VoidCallback? onCancelled,
Allows selection of a time
Implementation
void showMaterialTimePicker({
required BuildContext context,
String? title,
required TimeOfDay selectedTime,
String? confirmText,
String? cancelText,
ValueChanged<TimeOfDay>? onChanged,
VoidCallback? onConfirmed,
VoidCallback? onCancelled,
}) {
showTimePicker(
context: context,
initialTime: selectedTime,
cancelText: cancelText,
confirmText: confirmText,
).then((selection) {
if (onChanged != null && selection != null) onChanged(selection);
if (onCancelled != null && selection == null) onCancelled();
if (onConfirmed != null && selection != null) onConfirmed();
});
}