Flutter - Set search hint style of SearchDelegate

醉酒当歌 提交于 2020-04-30 07:11:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!