【发布时间】:2020-09-30 23:42:16
【问题描述】:
我设法改变了hintStyle-color
@override
ThemeData appBarTheme(BuildContext context) {
return ThemeData(
primaryColor: kPrimaryColor,
primaryIconTheme: IconThemeData(
color: Colors.white,
),
inputDecorationTheme: InputDecorationTheme(
hintStyle:
Theme.of(context).textTheme.title.copyWith(color: Colors.white),
),
);
}
但是如果我在 appbar 搜索字段中输入一些内容,颜色仍然是黑色...
如何正确更改SearchDelegate 类中的textcolor?
【问题讨论】:
-
在
appBarTheme检查textTheme属性。 -
我尝试添加
textTheme: TextTheme(display2: TextStyle(color: Colors.white)),,但它不起作用。或者你的意思是别的什么@dev-aentgs? -
@Matthias 发现 this 有点相似,无需处理
appBarTheme -
对不起@dev-aentgs,你的第一个建议是对的。我试图更改
display2,但我需要更改title。我将textTheme: TextTheme(title: TextStyle( color: Colors.white, fontSize: 18,),),添加到 'appBarTheme并且它起作用了。谢谢!。我想写一个答案,我可以接受:D
标签: flutter dart colors flutter-layout textcolor