Reputation: 1049
I am developing an application with Flutter. I put TextFormField
. I want to prevent entering numbers in this TextFormField
. How can I do that?
Upvotes: 0
Views: 611
Reputation: 888
Try this:
TextFormField(
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny(RegExp('[0-9]')),
],
),
Upvotes: 5
Reputation: 2077
inputFormatters: [
FilteringTextInputFormatter.deny(RegExp("[0-9]")),
],
You need to add this
Upvotes: 1
Reputation: 3548
You can use the validator
argument to create a callback if the user input a number.
You can also add the keyboardType
argument to limit the user to only text with the value TextInputType.text
Upvotes: 3