Flutter-设置SearchDelegate的搜索提示样式 [英] Flutter - Set search hint style of SearchDelegate
本文介绍了Flutter-设置SearchDelegate的搜索提示样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
看看Flutter的源代码,我可以看到只能使用 theme.inputDecorationTheme.hintStyle 进行推断,有什么方法可以简单地将其传递给构造函数吗?
Looking at Flutter's source code I can see that this can only be inferred using theme.inputDecorationTheme.hintStyle, is there any way to simply pass it to the constructor?
编辑:目前无法执行此操作,只能覆盖 appBarTheme 方法.我关闭线程,因为这似乎是实现它的唯一方法.
EDIT: currently there's no way to do it but only to override the appBarTheme method. I close the thread since this seems to be the only way to achieve it.
推荐答案
有一种方法可以对此进行覆盖
There's a method that you can override for that
@override
ThemeData appBarTheme(BuildContext context) {
assert(context != null);
final ThemeData theme = Theme.of(context);
assert(theme != null);
return theme.copyWith(
inputDecorationTheme: theme.inputDecorationTheme.copyWith(
hintStyle: ..., // <=() here
),
);
}
这篇关于Flutter-设置SearchDelegate的搜索提示样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文