NumField class Null safety
Numeric Form Field.
The Numeric field accepts integer and floating-point values. Letters and most symbols cannot be entered into this type of field. However, the negative sign ('-'), the positive sign ('+'), and '.' or ',' are allowed.
Non-numeric characters must somehow be filtered out so that they do not appear in the form field. This is accomplished by setting the following:
- Num as the validator to limit data to numeric values.
- TextInputType.numberWithOptions as the keyboardType.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- NumField
Constructors
-
NumField({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, List<TextInputFormatter> ? inputFormatters, bool? enabled, EdgeInsets scrollPadding = const EdgeInsets.all(20.0), bool enableInteractiveSelection = true, AutovalidateMode? autovalidateMode, Key? key}) - Numeric Form Field.
-
NumField.max(num max, {bool trim = false, FormFieldValidator<
String> ? validator, String? blank, String? malformed, String? large, String? initialValue, TextEditingController? controller, InputDecoration? decoration = const InputDecoration(), 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}) -
Constrains data to numeric values that are less than or equal to
max
. -
NumField.min(num min, {bool trim = false, FormFieldValidator<
String> ? validator, String? blank, String? malformed, String? small, 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}) -
Constrains data to numbers greater than or equal to
min
. -
NumField.neg({bool trim = false, FormFieldValidator<
String> ? validator, String? blank, String? malformed, String? pos, 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}) - Constrains entered data to negative numbers.
-
NumField.pos({bool trim = false, FormFieldValidator<
String> ? validator, String? blank, String? malformed, String? neg, 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}) - Constrains entered data to positive numbers.
-
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}) -
Constrains data to numbers within the range
min–max
.
Properties
Methods
-
build(
BuildContext context) → BasicTextField -
Builds a BasicTextField suitable for numeric values.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited