我想在文本字段中使用 '*' 而不是 '•'。
TextField(
focusNode: _passwordFocusNode,
controller: _passwordController,
obscureText: true,
);
Run Code Online (Sandbox Code Playgroud)
现在,flutter 通过设置obscuringCharacter属性来支持文本字段的此功能,它需要严格限制为 1 个字符的字符串,并且 obliqueText 属性应该为 true 才能实现此效果
TextField(
obscuringCharacter: '&', // defaults to *
obscureText: true,
)
Run Code Online (Sandbox Code Playgroud)
Flutter 目前不支持此功能。模糊文本由采用布尔表达式的属性obscurText控制。正如您在文档中看到的
\n\n\n\n\n当此项设置为 true 时,文本字段中的所有字符都将替换为 U+2022 BULLET 字符 (\xe2\x80\xa2)。
\n
GitHub 上的这个问题可能会有所帮助:https://github.com/flutter/flutter/issues/36377
\n| 归档时间: |
|
| 查看次数: |
2559 次 |
| 最近记录: |