DialogTime constructor

const DialogTime({
  1. Key? key,
  2. String? title,
  3. required ValueChanged<TimeOfDay> onConfirm,
  4. bool showSeconds = false,
  5. bool use24HourFormat = false,
  6. String confirmText = "Done",
  7. String cancelText = "Cancel",
  8. TimeOfDay? initialTime,
})

Constructs a new DialogTime widget instance.

The onConfirm parameter is mandatory and defines the action taken upon user confirmation, receiving the selected TimeOfDay. Optional parameters allow customization:

  • title: Sets the dialog header text; omits the title if null.
  • initialTime: Pre-selects a time in the picker for quicker user input.
  • confirmText and cancelText: Customize button labels for localization or branding.
  • use24HourFormat: Enables 24-hour time display, useful for international apps.
  • showSeconds: Adds seconds to the picker for applications needing granular time control.

All optional parameters have sensible defaults to ensure immediate usability.

Implementation

const DialogTime({
  super.key,
  this.title,
  required this.onConfirm,
  this.showSeconds = false,
  this.use24HourFormat = false,
  this.confirmText = "Done",
  this.cancelText = "Cancel",
  this.initialTime,
});