ZetaDateInput constructor
- Key? key,
- bool disabled = false,
- DateTime? initialValue,
- ValueChanged<
DateTime?> ? onChange, - ZetaFormFieldRequirement? requirementLevel = ZetaFormFieldRequirement.none,
- FormFieldValidator<
DateTime> ? validator, - ValueChanged<
DateTime?> ? onFieldSubmitted, - FormFieldSetter<
DateTime> ? onSaved, - AutovalidateMode? autovalidateMode,
- bool? rounded,
- String? label,
- String? hintText,
- String? errorText,
- ZetaWidgetSize size = ZetaWidgetSize.medium,
- String dateFormat = 'MM/dd/yyyy',
- DatePickerEntryMode? pickerInitialEntryMode,
- String? datePickerSemanticLabel,
- DateTime? minDate,
- DateTime? maxDate,
- String? clearSemanticLabel,
Creates a new ZetaDateInput
Implementation
ZetaDateInput({
super.key,
super.disabled = false,
super.initialValue,
super.onChange,
super.requirementLevel = ZetaFormFieldRequirement.none,
super.validator,
super.onFieldSubmitted,
super.onSaved,
super.autovalidateMode,
bool? rounded,
this.label,
this.hintText,
this.errorText,
this.size = ZetaWidgetSize.medium,
this.dateFormat = 'MM/dd/yyyy',
this.pickerInitialEntryMode,
this.datePickerSemanticLabel,
this.minDate,
this.maxDate,
this.clearSemanticLabel,
}) : super(
builder: (field) {
final _ZetaDateInputState state = field as _ZetaDateInputState;
final colors = Zeta.of(field.context).colors;
return InternalTextInput(
label: label,
constrained: true,
hintText: hintText,
errorText: field.errorText ?? errorText,
size: size,
placeholder: dateFormat,
controller: state.controller,
onSubmit: onFieldSubmitted != null ? (_) => onFieldSubmitted(field.value) : null,
requirementLevel: requirementLevel,
rounded: rounded,
disabled: disabled,
inputFormatters: [
state._dateFormatter,
],
suffix: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
if (state.controller.text.isNotEmpty)
InputIconButton(
icon: ZetaIcons.cancel,
onTap: state.clear,
disabled: disabled,
size: size,
color: colors.iconSubtle,
semanticLabel: clearSemanticLabel,
),
InputIconButton(
icon: ZetaIcons.calendar,
onTap: state.pickDate,
disabled: disabled,
size: size,
color: colors.iconDefault,
semanticLabel: datePickerSemanticLabel,
),
],
),
);
},
);