0

I have a TextFiled in a Flatter app and I need it to only be able to enter a number from 1 to 49. Thanks in advance for all the tips.

TextField(
  controller: TextEditingController()
    ..text = (quantity ?? "").toString()
    ..selection = TextSelection.collapsed(offset: (quantity ?? "").toString().length),
   inputFormatters: <TextInputFormatter>[
    LengthLimitingTextInputFormatter(2),
    FilteringTextInputFormatter.digitsOnly,    
  ],
  enabled: true,
),
Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56
Laco
  • 39
  • 1
  • 3

0 Answers0