DatePicker constructor
DatePicker({
- Key? key,
- required DateTime? selected,
- ValueChanged<
DateTime> ? onChanged, - VoidCallback? onCancel,
- String? header,
- TextStyle? headerStyle,
- bool showDay = true,
- bool showMonth = true,
- bool showYear = true,
- DateTime? startDate,
- DateTime? endDate,
- EdgeInsetsGeometry contentPadding = kPickerContentPadding,
- double popupHeight = kPickerPopupHeight,
- FocusNode? focusNode,
- bool autofocus = false,
- Locale? locale,
- List<
DatePickerField> ? fieldOrder, - List<
int> ? fieldFlex,
Creates a date picker.
Implementation
DatePicker({
super.key,
required this.selected,
this.onChanged,
this.onCancel,
this.header,
this.headerStyle,
this.showDay = true,
this.showMonth = true,
this.showYear = true,
DateTime? startDate,
DateTime? endDate,
this.contentPadding = kPickerContentPadding,
this.popupHeight = kPickerPopupHeight,
this.focusNode,
this.autofocus = false,
this.locale,
this.fieldOrder,
this.fieldFlex,
}) : startDate = startDate ?? DateTime.now().subtract(kYearDuration * 100),
endDate = endDate ?? DateTime.now().add(kYearDuration * 25),
assert(
fieldFlex == null || fieldFlex.length == 3,
'fieldFlex must be null or have a length of 3',
);