본문 바로가기
Flutter

[Flutter] restrict textfield input type & setting keyboard type

by hymndaniel 2022. 4. 28.
TextField(
 inputFormatters: <TextInputFormatter>[
      FilteringTextInputFormatter.allow(RegExp("[0-9]")),
  ], // Only numbers can be entered
  keyboardType: TextInputType.numberWithOptions(decimal: true), // open decimal keyboard
),
 

 

 

 

 

References

https://stackoverflow.com/questions/50442372/restrict-special-character-input-flutter

 

Restrict Special Character Input Flutter

I have a TextField that will only take numbers as an input. The Keyboard that appears allows for the input of the the following characters: "-(hyphen) ,(comma) .(period) and space". How can I preve...

stackoverflow.com

https://stackoverflow.com/questions/64539013/how-to-limit-user-to-enter-more-or-less-a-particular-value-in-textfield-in-flutt

 

How to limit user to enter more or less a particular value in TextField in Flutter?

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( ...

stackoverflow.com

 

728x90