Allow only two decimal number in flutter input?

后端 未结 9 1302
误落风尘
误落风尘 2020-12-30 07:03

I want only two digits after decimal point in the flutter input.User can\'t add more than two digits after decimal point.

9条回答
  •  长情又很酷
    2020-12-30 07:34

    May be this is a simpler solution

    inputFormatters: [
                FilteringTextInputFormatter.allow(RegExp(r'(^\d*\.?\d{0,2})'))
              ]
    

提交回复
热议问题