PasswordInputTextField constructor

PasswordInputTextField({
  1. Key? key,
  2. required int passwordLength,
  3. ValueChanged<String>? onSubmit,
  4. PasswordDecoration decoration = const BoxLooseDecoration(),
  5. List<TextInputFormatter>? inputFormatter,
  6. TextInputType keyboardType = TextInputType.text,
  7. TextEditingController? controller,
  8. FocusNode? focusNode,
  9. bool autoFocus = false,
  10. TextInputAction textInputAction = TextInputAction.done,
  11. bool enabled = true,
  12. ValueChanged<String>? onChanged,
})

Implementation

PasswordInputTextField({
  Key? key,
  required this.passwordLength,
  this.onSubmit,
  this.decoration: const BoxLooseDecoration(),
  List<TextInputFormatter>? inputFormatter,
  this.keyboardType: TextInputType.text,
  this.controller,
  this.focusNode,
  this.autoFocus = false,
  this.textInputAction = TextInputAction.done,
  this.enabled = true,
  this.onChanged,
})  :

      /// passwordLength must larger than 0.
      /// If passwordEditingController isn't null, guarantee the [passwordLength] equals to the passwordEditingController's _passwordMaxLength
      assert(passwordLength > 0),

      /// Hint length must equal to the [passwordLength].
      assert(decoration.hintText == null ||
          decoration.hintText!.length == passwordLength),
      assert(decoration is BoxTightDecoration ||
          (decoration is UnderlineDecoration &&
              passwordLength - 1 ==
                  (decoration.gapSpaces?.length ?? (passwordLength - 1))) ||
          (decoration is BoxLooseDecoration &&
              passwordLength - 1 ==
                  (decoration.gapSpaces?.length ?? (passwordLength - 1)))),
      inputFormatters = inputFormatter == null
          ? <TextInputFormatter>[
              FilteringTextInputFormatter.singleLineFormatter,
              LengthLimitingTextInputFormatter(passwordLength)
            ]
          : inputFormatter
        ..add(LengthLimitingTextInputFormatter(passwordLength)),
      super(key: key);