ControlledTimePicker constructor
const
ControlledTimePicker({
- Key? key,
- TimePickerController? controller,
- TimeOfDay? initialValue,
- ValueChanged<
TimeOfDay?> ? onChanged, - bool enabled = true,
- PromptMode mode = PromptMode.dialog,
- Widget? placeholder,
- AlignmentGeometry? popoverAlignment,
- AlignmentGeometry? popoverAnchorAlignment,
- EdgeInsetsGeometry? popoverPadding,
- bool? use24HourFormat,
- bool showSeconds = false,
- Widget? dialogTitle,
Creates a ControlledTimePicker.
Either controller
or initialValue
should be provided to establish
the initial time state. The picker can be customized with various
presentation options and time format preferences.
Parameters:
controller
(TimePickerController?, optional): External controller for programmatic controlinitialValue
(TimeOfDay?, optional): Initial time when no controller is providedonChanged
(ValueChanged<TimeOfDay?>?, optional): Callback for time selection changesenabled
(bool, default: true): Whether the picker accepts user interactionmode
(PromptMode, default: PromptMode.dialog): Presentation style (dialog or popover)placeholder
(Widget?, optional): Content displayed when no time is selectedpopoverAlignment
(AlignmentGeometry?, optional): Popover positioning relative to anchorpopoverAnchorAlignment
(AlignmentGeometry?, optional): Anchor point on picker buttonpopoverPadding
(EdgeInsetsGeometry?, optional): Internal popover content paddinguse24HourFormat
(bool?, optional): Whether to use 24-hour time formatshowSeconds
(bool, default: false): Whether to include seconds selectiondialogTitle
(Widget?, optional): Title for dialog mode display
Example:
ControlledTimePicker(
initialValue: TimeOfDay(hour: 14, minute: 30),
mode: PromptMode.popover,
use24HourFormat: true,
onChanged: (time) => print('Selected: $time'),
);
Implementation
const ControlledTimePicker({
super.key,
this.controller,
this.initialValue,
this.onChanged,
this.enabled = true,
this.mode = PromptMode.dialog,
this.placeholder,
this.popoverAlignment,
this.popoverAnchorAlignment,
this.popoverPadding,
this.use24HourFormat,
this.showSeconds = false,
this.dialogTitle,
});