0

How can I modify the input keyboard that comes out for an autocomplete from alphanumeric to numeric only?

  • hi, try checking on this page maybe there is someone who discusses this problem https://stackoverflow.com/questions/49577781/how-to-create-number-input-field-in-flutter – uknown18user Sep 09 '22 at 02:15
  • Please provide enough code so others can better understand or reproduce the problem. – Community Sep 09 '22 at 04:17

1 Answers1

1
TextFormField(
  controller: _controller,
  keyboardType: TextInputType.number,
  inputFormatters: <TextInputFormatter>[
   // for below version 2 use this
 FilteringTextInputFormatter.allow(RegExp(r'[0-9]')), 
// for version 2 and greater youcan also use this
 FilteringTextInputFormatter.digitsOnly

  ],
  decoration: InputDecoration(
    labelText: "whatever you want",
    hintText: "whatever you want",
    icon: Icon(Icons.phone_iphone)
  )
)

use keyboardType: TextInputType.number,

MohitJadav86
  • 782
  • 3
  • 11