build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Implementation

@override
Widget build(BuildContext context) {
  return TextFormField(
    key: UniqueKey(),
    controller: controller,
    cursorColor: cursorColor,
    obscureText: !showPassword,
    maxLength: maxLength,
    keyboardType: TextInputType.visiblePassword,
    textInputAction: textInputAction,
    onFieldSubmitted: (s) => onSubmitted?.call(s),
    validator: LengthValidator(minLength: minLength, maxLength: maxLength, allowEmpty: false).call,
    focusNode: focusNode,
    onTapOutside: (e) => focusNode.unfocus(),
    decoration: InputDecoration(
      prefixIcon: prefixIcon,
      labelText: label,
      counterText: "",
      suffixIcon: IconButton(
        icon: showPassword ? const Icon(Icons.visibility_off) : const Icon(Icons.visibility),
        onPressed: () {
          showPassword = !showPassword;
          updateState();
        },
      ),
    ),
  );
}