I want to allow the user to only put maximum of 5 numbers between 1 and 10.000, but this TextFormField is not required and should not be submitted through Form validation, but I want to let the user know if he is adding this field, that he can not exceed 10.000 and he must put only numbers from 1 to 10.000. The code for the TextFormField:
TextFormField(
keyboardType: TextInputType.number,
controller: _number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly //I have set this so the input is only numbers/digits
],
decoration: kTextFieldDecoration.copyWith(
hintText: 'Enter number between 1 and 10.000',
labelText: 'Number from 1 to 10.000',
),
),
I'm not sure how to achieve this, I used regex validation for the rest of the fields, but since this field is not required, I can't validate it through Form validation. Any form of help is appreciated. Thanks in advance!