I want to display keyboard with only numbers, not Operators or any other symbols in keyboard. I tried filter output already using inputFormatters in textfield.
CodePudding user response:
You will need to add inputFormatters & keyboardType properties to enable keyboard with number inputs only to your TextField widget.
inputFormatters: <TextInputFormatter>[
WhitelistingTextInputFormatter.digitsOnly,
],
keyboardType: TextInputType.number,
CodePudding user response:
if its in a TextField use this :
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
or you can use this :
keyboardType: TextInputType.phone,
also you can check this package
check this package numeric_keyboard
CodePudding user response:
Use keyboardType
property of TextField
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly
],
CodePudding user response:
TextField(
keyboardType: TextInputType.number,
inputFormatters:<TextInputFormatter>.
[FilteringTextInputFormatter.digitsOnly]
decoration:InputDecoration(labelText: 'Number')
),