ZetaTimeInput constructor
- Key? key,
- bool disabled = false,
- TimeOfDay? initialValue,
- ValueChanged<
TimeOfDay?> ? onChange, - ZetaFormFieldRequirement? requirementLevel = ZetaFormFieldRequirement.none,
- FormFieldValidator<
TimeOfDay> ? validator, - @Deprecated('Use use24HourFormat instead') bool use12Hr = true,
- bool use24HourFormat = true,
- String? label,
- String? hintText,
- String? errorText,
- ZetaWidgetSize size = ZetaWidgetSize.medium,
- TimePickerEntryMode? pickerInitialEntryMode,
- String? clearSemanticLabel,
- String? timePickerSemanticLabel,
- AutovalidateMode? autovalidateMode,
- ValueChanged<
TimeOfDay?> ? onFieldSubmitted, - FormFieldSetter<
TimeOfDay> ? onSaved, - bool? rounded,
Creates a new ZetaTimeInput
Implementation
ZetaTimeInput({
super.key,
super.disabled = false,
super.initialValue,
super.onChange,
super.requirementLevel = ZetaFormFieldRequirement.none,
super.validator,
@Deprecated('Use use24HourFormat instead') bool use12Hr = true,
this.use24HourFormat = true,
this.label,
this.hintText,
this.errorText,
this.size = ZetaWidgetSize.medium,
this.pickerInitialEntryMode,
this.clearSemanticLabel,
this.timePickerSemanticLabel,
super.autovalidateMode,
super.onFieldSubmitted,
super.onSaved,
bool? rounded,
}) : super(
builder: (field) {
final _ZetaTimeInputState state = field as _ZetaTimeInputState;
final colors = Zeta.of(field.context).colors;
return InternalTextInput(
label: label,
hintText: hintText,
errorText: field.errorText ?? errorText,
size: size,
placeholder: state.timeFormat,
controller: state.controller,
onSubmit: onFieldSubmitted != null ? (_) => onFieldSubmitted(state.value) : null,
requirementLevel: requirementLevel,
rounded: rounded,
disabled: disabled,
inputFormatters: [
state.timeFormatter,
],
suffix: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
if (state.controller.text.isNotEmpty)
InputIconButton(
icon: ZetaIcons.cancel,
semanticLabel: clearSemanticLabel,
onTap: state.clear,
disabled: disabled,
size: size,
color: colors.iconSubtle,
),
InputIconButton(
icon: ZetaIcons.clock_outline,
semanticLabel: timePickerSemanticLabel,
onTap: state.pickTime,
disabled: disabled,
size: size,
color: colors.iconDefault,
),
],
),
);
},
);