BasicTextField.range constructor

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

Text form field whose number of characters (length) must within the range min–max.

min the minimum length of the input data; it must be > 0 and < max. max the maximum length of the input data; it must be > 0 and > min. short the error message if the length of the input data is shorter than min. long the error message if the length of the input data is longer than max. 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.range(
  int min,
  int max, {
  String? short,
  String? long,
  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.range(min, max, short: short, long: long),
          validator ?? _ok,
        ),
        trim: trim,
        blank: blank,
        controller: controller,
        initialValue: initialValue,
        decoration: decoration,
        keyboardType: keyboardType,
        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,
      );