简体   繁体   中英

Flutter - Set search hint style of SearchDelegate

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.

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
      ),
    );
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM