PasswordInputTextField constructor
PasswordInputTextField({
- Key? key,
- required int passwordLength,
- ValueChanged<
String> ? onSubmit, - PasswordDecoration decoration = const BoxLooseDecoration(),
- List<
TextInputFormatter> ? inputFormatter, - TextInputType keyboardType = TextInputType.text,
- TextEditingController? controller,
- FocusNode? focusNode,
- bool autoFocus = false,
- TextInputAction textInputAction = TextInputAction.done,
- bool enabled = true,
- 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);