showMaterialTimePicker function

Future<TimeOfDay?> showMaterialTimePicker({
  1. required BuildContext context,
  2. String? title,
  3. required TimeOfDay selectedTime,
  4. String? confirmText,
  5. String? cancelText,
  6. ValueChanged<TimeOfDay>? onChanged,
  7. VoidCallback? onConfirmed,
  8. VoidCallback? onCancelled,

Allows selection of a time


Future<TimeOfDay?> showMaterialTimePicker({
  required BuildContext context,

  /// The title for the dialog box
  String? title,

  /// The initially selected time
  required TimeOfDay selectedTime,

  /// Text to display in the confirm button
  String? confirmText,

  /// Text to display in the cancel button
  String? cancelText,

  /// Function that gets called when the value is changed
  ValueChanged<TimeOfDay>? onChanged,

  /// Function that gets called when the confirm button is pressed
  VoidCallback? onConfirmed,

  /// Function that gets called when the cancel button is pressed
  VoidCallback? onCancelled,
}) {
  return showTimePicker(
    context: context,
    initialTime: selectedTime,
    cancelText: cancelText,
    confirmText: confirmText,
  ).then((selection) {
    if (selection != null) {
    } else {
    return selection;