I have a situation where I need to restrict users from entering a value greater than or less than a value (say x
<int>
type).
Here is my input field
TextField(
decoration: InputDecoration(
labelText: 'Amount',
border: OutlineInputBorder(),
enabled: widget.biller.paymentAmountExactness != 'EXACT',
),
keyboardType: TextInputType.numberWithOptions(decimal: true),
controller: _amountFieldCtrl,
),
For understanding, let's consider the amount fetched from API is 400.00
. Now, I have a condition which is also, coming from API where I need to check widget.biller.paymentAmountExactness
key. If the value key is EXACT_UP
then, the user can enter the value in the TextField
400.00 or more.
Similarly, if the value is EXACT_DOWN
, the user should not be able to enter the value in the field more than 400.00.
I don't find any max
or min
parameter in the TextField()
widget. How do I achieve such functionality?