我遇到了一个小问题。如您所见,我在 Flutter 中设置了 TextField 的 maxLength 1,但我无法隐藏文本计数器的底部标签。
最佳答案
要在使用 maxLength
属性时从 TextField 或 TextFormField 小部件中隐藏计数器值,请尝试以下操作:
TextField(
decoration: InputDecoration(
hintText: "Email",
counterText: "",
),
maxLength: 40,
),
在此,我在 InputDecoration
属性中将 counterText
属性设置为空值。希望它会有所帮助。
https://stackoverflow.com/questions/51893926/