I want to input only decimal number in TextField
in Flutter
. I tried below code but that\'s not working. It allows alpha (a-z) and special characte
I am using this code and it's giving different results , on some phones it shows only numbers and on others it shows dashes and other chars , so it depends on the launcher or something like that i guess, in iPhone i guess it will show the correct keyboard ( i have tried on iPhone 7s plus).
the inputFormatters
will allow only numbers so you will get what you want.
TextField(
textAlign: TextAlign.start,
keyboardType: TextInputType.numberWithOptions(decimal: true),
inputFormatters: [
FilteringTextInputFormatter.digitsOnly
],
),