NumField.range constructor

NumField.range(
  1. num min,
  2. num max, {
  3. bool trim = false,
  4. FormFieldValidator<String>? validator,
  5. String? blank,
  6. String? malformed,
  7. String? small,
  8. String? large,
  9. String? initialValue,
  10. TextEditingController? controller,
  11. InputDecoration? decoration,
  12. TextInputAction? textInputAction,
  13. TextStyle? style,
  14. TextDirection? textDirection,
  15. TextAlign textAlign = TextAlign.start,
  16. bool readOnly = false,
  17. String obscuringCharacter = '•',
  18. bool obscureText = false,
  19. bool autocorrect = true,
  20. int? maxLength,
  21. ValueChanged<String>? onChanged,
  22. VoidCallback? onEditingComplete,
  23. ValueChanged<String>? onFieldSubmitted,
  24. FormFieldSetter<String>? onSaved,
  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,
})

Constrains data to numbers within the range min–max.

min the smallest valid number; it must be < max. max the largest valid number; it must be > min. trim whether or not to trim the input value. validator an optional extra validation step. blank the error message in case of blank field; if omitted, the field malformed the error message for non-integer input values. small the error message if a number is too small. large the error message if a number is too large.

Implementation

NumField.range(
  num min,
  num max, {
  bool trim = false,
  FormFieldValidator<String>? validator,
  String? blank,
  String? malformed,
  String? small,
  String? large,
  String? initialValue,
  TextEditingController? controller,
  InputDecoration? decoration,
  TextInputAction? textInputAction,
  TextStyle? style,
  TextDirection? textDirection,
  TextAlign textAlign = TextAlign.start,
  bool readOnly = false,
  String obscuringCharacter = '•',
  bool obscureText = false,
  bool autocorrect = true,
  int? maxLength,
  ValueChanged<String>? onChanged,
  VoidCallback? onEditingComplete,
  ValueChanged<String>? onFieldSubmitted,
  FormFieldSetter<String>? onSaved,
  List<TextInputFormatter>? inputFormatters,
  bool? enabled,
  EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  bool enableInteractiveSelection = true,
  AutovalidateMode? autovalidateMode,
  Key? key,
}) : this(
        validator: Pair.str(
          Num.range(min, max, small: small, large: large),
          validator ?? _dummy,
        ),
        malformed: malformed,
        blank: blank,
        trim: trim,
        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,
      );