更新时间:1970-01-01 07:57:36
Ffltter的TextField
或TextFormField
具有名为inputFormatters
的属性,该属性采用TextInputFormatter
的列表。
适用于您的案例的TextInputFormatters
示例。
FilteringTextInputFormatter.allow(RegExp("[a-z]"))
TextField(
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.allow(RegExp("[a-z]")),
],
)
您可以在这里看到TextInputFormatters
接口文档:Reference
(颤动1.20之前):
WhitelistingTextInputFormatter(RegExp("[a-z]")),
TextField(
inputFormatters: <TextInputFormatter>[
WhitelistingTextInputFormatter(RegExp("[a-z]")),
],
)
不清楚可以参考:Reference 2、Reference 3。
另请查看此SOF问题:Reference 4