ZetaPasswordInput constructor

ZetaPasswordInput({
  1. Key? key,
  2. bool? rounded,
  3. String? initialValue,
  4. AutovalidateMode? autovalidateMode,
  5. ZetaFormFieldRequirement? requirementLevel = ZetaFormFieldRequirement.none,
  6. ValueChanged<String?>? onChange,
  7. FormFieldSetter<String>? onSaved,
  8. ValueChanged<String?>? onFieldSubmitted,
  9. bool disabled = false,
  10. ZetaWidgetSize size = ZetaWidgetSize.medium,
  11. FormFieldValidator<String>? validator,
  12. void onSubmit(
    1. String? val
    )?,
  13. TextEditingController? controller,
  14. String? hintText,
  15. String? errorText,
  16. String? label,
  17. String? placeholder,
  18. String? semanticLabel,
  19. String? obscureSemanticLabel,
  20. String? showSemanticLabel,
})

Constructs ZetaPasswordInput

Implementation

ZetaPasswordInput({
  super.key,
  bool? rounded,
  super.initialValue,
  super.autovalidateMode,
  super.requirementLevel = ZetaFormFieldRequirement.none,
  super.onChange,
  super.onSaved,
  super.onFieldSubmitted,
  super.disabled = false,
  this.size = ZetaWidgetSize.medium,
  super.validator,
  this.onSubmit,
  super.controller,
  this.hintText,
  this.errorText,
  this.label,
  this.placeholder,
  this.semanticLabel,
  this.obscureSemanticLabel,
  this.showSemanticLabel,
}) : super(
        builder: (field) {
          final _ZetaPasswordInputState state = field as _ZetaPasswordInputState;

          return InternalTextInput(
            size: size,
            rounded: rounded,
            controller: state.effectiveController,
            hintText: hintText,
            placeholder: placeholder,
            label: label,
            onChange: state.didChange,
            requirementLevel: requirementLevel,
            errorText: field.errorText ?? errorText,
            onSubmit: onSubmit,
            constrained: true,
            disabled: disabled,
            obscureText: state._obscureText,
            semanticLabel: semanticLabel,
            suffix: MergeSemantics(
              child: Semantics(
                label: state._obscureText ? showSemanticLabel : obscureSemanticLabel,
                child: Builder(
                  builder: (context) {
                    return IconButton(
                      icon: Icon(
                        state._obscureText
                            ? (context.rounded ? ZetaIcons.visibility_off_round : ZetaIcons.visibility_off_sharp)
                            : (context.rounded ? ZetaIcons.visibility_round : ZetaIcons.visibility_sharp),
                      ),
                      onPressed: state.toggleVisibility,
                    );
                  },
                ),
              ),
            ),
          );
        },
      );