flutter - 如何在颤动中更改TextField的颜色样式
问题描述
我有一个像这样的简单 TextField 小部件
TextField(
obscureText: widget.placeholder == "Password" ? _isHidePassword : false,
decoration: InputDecoration(
hintText: "${widget.placeholder}",
hintStyle: TextStyle(
color: Colors.grey,
),
// labelText: "${widget.placeholder}",
// labelStyle: TextStyle(color: greenMain),
),
)
有没有办法将蓝色变成另一种?喜欢红色的还是绿色的?
解决方案
咱们试试吧
Theme(
data: new ThemeData(
primaryColor: Colors.redAccent,
primaryColorDark: Colors.red,
),
child: TextField(
keyboardType: TextInputType.text,
decoration: InputDecoration(
labelText: "Text field*",
),
),
),
推荐阅读
- r - 用新数据重新训练随机森林
- java - 用于 CRUD 应用程序的 ViewModel
- firebase - Firestore 侦听器在将新项目添加到列表时触发两项更改
- flutter - FileSystemException (FileSystemException: Creation failed, path = '/sdcard/you' (OS Error: Operation not allowed, errno = 1))
- arrays - 从指针数组中提取 C 中字符串的一部分
- google-sheets - 如何使用索引功能使谷歌表格中的过滤功能更加灵活?
- javascript - 如何在 BootStrap 中创建一个与边缘有间距的进度条
- python - 如何在另一种方法中查看实例属性的更改版本?Python
- reactjs - Spring boot:提供多页面反应内容
- c++ - 在结构上应用标准算法?