BasicTextField.len constructor
BasicTextField.len(
- int len, {
- String? diff,
- bool trim = false,
- String? blank,
- TextEditingController? controller,
- String? initialValue,
- InputDecoration? decoration = const InputDecoration(),
- TextInputAction? textInputAction,
- TextStyle? style,
- TextDirection? textDirection,
- TextAlign textAlign = TextAlign.start,
- bool readOnly = false,
- bool obscureText = false,
- bool autocorrect = true,
- String obscuringCharacter = '•',
- int? maxLength,
- TextInputType? keyboardType,
- ValueChanged<
String> ? onChanged, - VoidCallback? onEditingComplete,
- ValueChanged<
String> ? onFieldSubmitted, - FormFieldSetter<
String> ? onSaved, - FormFieldValidator<
String> ? validator, - List<
TextInputFormatter> ? inputFormatters, - bool? enabled,
- EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
- bool enableInteractiveSelection = true,
- AutovalidateMode? autovalidateMode,
- Key? key,
Text form field whose number of characters (length) must be equal to
len
characters.
len
the exact length of the input data; it must be > 0.
diff
the error message in case the length of the input data is different
from len
; that is, the entered text contains fewer or more characters
than len
.
trim
whether to trim or not the input data.
blank
the error message in case of blank field; if omitted, the field
will not be made required.
validator
an optional extra validation step.
Implementation
BasicTextField.len(
int len, {
String? diff,
bool trim = false,
String? blank,
TextEditingController? controller,
String? initialValue,
InputDecoration? decoration = const InputDecoration(),
TextInputAction? textInputAction,
TextStyle? style,
TextDirection? textDirection,
TextAlign textAlign = TextAlign.start,
bool readOnly = false,
bool obscureText = false,
bool autocorrect = true,
String obscuringCharacter = '•',
int? maxLength,
TextInputType? keyboardType,
ValueChanged<String>? onChanged,
VoidCallback? onEditingComplete,
ValueChanged<String>? onFieldSubmitted,
FormFieldSetter<String>? onSaved,
FormFieldValidator<String>? validator,
List<TextInputFormatter>? inputFormatters,
bool? enabled,
EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
bool enableInteractiveSelection = true,
AutovalidateMode? autovalidateMode,
Key? key,
}) : this(
validator: Pair.str2(Len(len, diff: diff), validator ?? _ok),
trim: trim,
blank: blank,
keyboardType: keyboardType,
controller: controller,
initialValue: initialValue,
decoration: decoration,
textInputAction: textInputAction,
style: style,
textDirection: textDirection,
textAlign: textAlign,
readOnly: readOnly,
obscuringCharacter: obscuringCharacter,
obscureText: obscureText,
autocorrect: autocorrect,
maxLength: maxLength,
onChanged: onChanged,
onEditingComplete: onEditingComplete,
onFieldSubmitted: onFieldSubmitted,
onSaved: onSaved,
inputFormatters: inputFormatters,
enabled: enabled,
scrollPadding: scrollPadding,
enableInteractiveSelection: enableInteractiveSelection,
autovalidateMode: autovalidateMode,
key: key,
);