草庐IT

whitelistingtextinputformatter

全部标签

regex - TextField在whitelistingtextinputformatter中添加2个十进制正数配置后不接受输入

keyboardType:TextInputType.number,inputFormatters:[WhitelistingTextInputFormatter(RegExp("^\s*(?=.*[1-9])\d*(?:\.\d{1,2})?\s*\$"))],),我在我的TextFormField中使用了这个设置,并使用了我从另一个SO帖子中获取的这个正则表达式。在regex101.com上测试似乎没问题,但我无法使用此正则表达式在我的表单上输入任何内容。我使用正则表达式的目标是获得两位十进制正float。Regexgreaterthanzerowith2decimalplaces