flutter - 如何更改 TextField 中字符串输入的颜色?
问题描述
我正在使用我的应用程序的样式,我无法更改输入的颜色,TextField
没有任何属性可以更改它。
Theme(
data: new ThemeData(
hintColor: Colors.white
),
child:
TextField(
focusNode: _focusUsername,
controller: _controller,
decoration: InputDecoration(
border: InputBorder.none,
fillColor: Colors.grey,
filled: true,
hintText: 'Username',
))),
解决方案
您可以分配一个TextStyle
TextField(
style: TextStyle(color: Colors.white),
...
)
https://docs.flutter.io/flutter/painting/TextStyle-class.html
推荐阅读
- django - Django url dispatch error - AttributeError: 'WSGIRequest' object has no attribute 'data'
- python - Is there a way to guarantee that coroutines have been started before doing something that will allow them to finish?
- r - 带有 x10^x 符号 ggplot 标题的换行符
- tableau-api - 如何将网络上的数据导入 Tableau?
- json - 用bash中的空格解析JSON数组
- c# - 如何声明一个包含委托的元组?
- python - 尝试在 Windows 上使用 igraph,但 python 无法加载 cairo
- css - 在表单顶部设置固定导航
- amazon-web-services - 在负载均衡器上使用 SSL 的 CNAME
- c# - 从asp.net中的列表中提取特定数据