问题
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?
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.
回答1:
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
),
);
}
来源:https://stackoverflow.com/questions/61194153/flutter-set-search-hint-style-of-searchdelegate