IntField constructor

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

Integer Numbers Form Field.

malformed the error message in case of non-numeric characters. blank the error message in case of blank field; if omitted, the field will not be made required. trim whether or not to trim the input value. validator an optional extra validation step.

Implementation

IntField({
  bool trim = false,
  FormFieldValidator<String>? validator,
  String? blank,
  String? malformed,
  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,
  bool? enabled,
  List<TextInputFormatter>? inputFormatters,
  EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  bool enableInteractiveSelection = true,
  AutovalidateMode? autovalidateMode,
  Key? key,
})  : _toIntField = ((context) {
        return BasicTextField(
          validator: Pair.str(Int(mal: malformed), validator ?? _dummy),
          keyboardType: const TextInputType.numberWithOptions(signed: true),
          inputFormatters: inputFormatters ??
              [FilteringTextInputFormatter.allow(RegExp('[0-9+-]'))],
          blank: blank,
          trim: trim,
          decoration: decoration ?? const InputDecoration(),
          controller: controller,
          initialValue: initialValue,
          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,
          enabled: enabled,
          scrollPadding: scrollPadding,
          enableInteractiveSelection: enableInteractiveSelection,
          autovalidateMode: autovalidateMode,
        );
      }),
      super(key: key);