DateInput constructor
const
DateInput({
- Key? key,
- DatePickerController? controller,
- DateTime? initialValue,
- ValueChanged<
DateTime?> ? onChanged, - bool enabled = true,
- Widget? placeholder,
- PromptMode mode = PromptMode.dialog,
- CalendarView? initialView,
- AlignmentGeometry? popoverAlignment,
- AlignmentGeometry? popoverAnchorAlignment,
- EdgeInsetsGeometry? popoverPadding,
- Widget? dialogTitle,
- CalendarViewType? initialViewType,
- DateStateBuilder? stateBuilder,
- List<
DatePart> ? datePartsOrder, - InputPart? separator,
- Map<
DatePart, Widget> ? placeholders,
Creates a DateInput.
Either controller
or onChanged
should be provided for interactivity.
The widget supports both controller-based and callback-based state management
patterns with flexible date picker integration options.
Parameters:
controller
(DatePickerController?, optional): external state controllerinitialValue
(DateTime?, optional): starting date when no controlleronChanged
(ValueChanged<DateTime?>?, optional): date change callbackenabled
(bool, default: true): whether input is interactiveplaceholder
(Widget?, optional): widget shown when no date selectedmode
(PromptMode, default: dialog): date picker presentation modeinitialView
(CalendarView?, optional): starting calendar viewpopoverAlignment
(AlignmentGeometry?, optional): popover alignmentpopoverAnchorAlignment
(AlignmentGeometry?, optional): anchor alignmentpopoverPadding
(EdgeInsetsGeometry?, optional): popover paddingdialogTitle
(Widget?, optional): title for dialog modeinitialViewType
(CalendarViewType?, optional): calendar view typestateBuilder
(DateStateBuilder?, optional): custom date state builderdatePartsOrder
(Listseparator
(InputPart?, optional): separator between date partsplaceholders
(Map<DatePart, Widget>?, optional): placeholders for date parts
Example:
DateInput(
controller: controller,
mode: PromptMode.popover,
placeholder: Text('Select date'),
datePartsOrder: [DatePart.month, DatePart.day, DatePart.year],
)
Implementation
const DateInput({
super.key,
this.controller,
this.initialValue,
this.onChanged,
this.enabled = true,
this.placeholder,
this.mode = PromptMode.dialog,
this.initialView,
this.popoverAlignment,
this.popoverAnchorAlignment,
this.popoverPadding,
this.dialogTitle,
this.initialViewType,
this.stateBuilder,
this.datePartsOrder,
this.separator,
this.placeholders,
});