Home > OS >  i want negative value two number after decimal in texinput format
i want negative value two number after decimal in texinput format

Time:09-28

  FilteringTextInputFormatter.allow(
                            RegExp(r'^\d \.?\d{0,2}')),

this flitering texinput only allow number and decimal value (eg,1.22) but i want (-1.22)

FilteringTextInputFormatter.allow(RegExp(r"[-0-9]")),

but this allow negative and postive value but i cannot deny decimaly more than two value after the point

CodePudding user response:

You can add escaped "-" in front

RegExp(r'^\-\d \.?\d{0,2}')

CodePudding user response:

Just add -* like this :

RegExp(r'^\-*\d \.?\d{0,2}')
  • Related