BasicTextField.len constructor

BasicTextField.len(
  1. int len, {
  2. String? diff,
  3. bool trim = false,
  4. String? blank,
  5. TextEditingController? controller,
  6. String? initialValue,
  7. InputDecoration? decoration = const InputDecoration(),
  8. TextInputAction? textInputAction,
  9. TextStyle? style,
  10. TextDirection? textDirection,
  11. TextAlign textAlign = TextAlign.start,
  12. bool readOnly = false,
  13. bool obscureText = false,
  14. bool autocorrect = true,
  15. String obscuringCharacter = '•',
  16. int? maxLength,
  17. TextInputType? keyboardType,
  18. ValueChanged<String>? onChanged,
  19. VoidCallback? onEditingComplete,
  20. ValueChanged<String>? onFieldSubmitted,
  21. FormFieldSetter<String>? onSaved,
  22. FormFieldValidator<String>? validator,
  23. List<TextInputFormatter>? inputFormatters,
  24. bool? enabled,
  25. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  26. bool enableInteractiveSelection = true,
  27. AutovalidateMode? autovalidateMode,
  28. 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,
      );