ZetaTimeInput constructor

ZetaTimeInput({
  1. Key? key,
  2. bool disabled = false,
  3. TimeOfDay? initialValue,
  4. ValueChanged<TimeOfDay?>? onChange,
  5. ZetaFormFieldRequirement? requirementLevel = ZetaFormFieldRequirement.none,
  6. FormFieldValidator<TimeOfDay>? validator,
  7. @Deprecated('Use use24HourFormat instead') bool use12Hr = true,
  8. bool use24HourFormat = true,
  9. String? label,
  10. String? hintText,
  11. String? errorText,
  12. ZetaWidgetSize size = ZetaWidgetSize.medium,
  13. TimePickerEntryMode? pickerInitialEntryMode,
  14. String? clearSemanticLabel,
  15. String? timePickerSemanticLabel,
  16. AutovalidateMode? autovalidateMode,
  17. ValueChanged<TimeOfDay?>? onFieldSubmitted,
  18. FormFieldSetter<TimeOfDay>? onSaved,
  19. 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,
            constrained: true,
            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,
                ),
              ],
            ),
          );
        },
      );