Flutter-如何在搜索委托类中更改文本颜色? [英] Flutter - how to change textcolor in search delegate class?
本文介绍了Flutter-如何在搜索委托类中更改文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设法更改了 hintStyle
-color
I managed to change the 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),
),
);
}
但是,如果我在应用栏搜索栏中输入了一些内容,则颜色仍然是黑色...
But if i type something into the appbar searchfield, the color is still black...
如何在 SearchDelegate
类中正确更改 textcolor
?
How can I properly change the textcolor
in the SearchDelegate
class?
推荐答案
参考问题注释中的讨论, appBarTheme
的 textTheme
属性允许更改颜色.示例代码积分 @Matthias
With reference to the discussion in the comments of the question, appBarTheme
's textTheme
property allows changing the color.
example code credit @Matthias
代码:
textTheme:TextTheme(标题:TextStyle(color:Colors.white,fontSize:18,),),
这篇关于Flutter-如何在搜索委托类中更改文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文