首页 > 解决方案 > 如何在颤动中更改 SearchDelegate StatusBarIcons 颜色或 buildSuggestions 正文颜色?

问题描述

在我的 AppBar 中,我的 StatusBarIcons 的颜色是白色的,只是因为 auf "Brightness.dark" 如果我​​在我的 SearchDelegate 窗口中使用它,那么主体颜色也很暗。如果我只是将 primaryColor 更改为灰色,那么 StatusBarIcons 仍然是黑色的。有没有人有解决这些案例的想法?

加:如何更改光标下方的蓝色图标/气泡以及白色和绿色的两个下划线,图4?

文本

文本

文本

文本

标签: flutter

解决方案


仍然打开:光标下方的蓝色图标/气泡

但对于我当前的解决方案,请参阅代码注释:

  @override
  ThemeData appBarTheme(BuildContext context) {
    return ThemeData(
      accentColor: Color(0xFF323232), // for the green line
      scaffoldBackgroundColor: Colors.white, // for the body color
      brightness: Brightness.dark, // to get white statusbar icons
      primaryColor: Color(0xFF323232), // set background color of SearchBar
      textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.white), // cursor color
      textTheme: TextTheme(
        headline6: TextStyle(
          decorationColor: Color(0xFF323232), // color of text underline
        ),
      ),
    );
  }

如果有人想测试所有 ThemeData 颜色:

      backgroundColor: Colors.red,
      bottomAppBarColor: Colors.red,
      canvasColor: Colors.red,
      cardColor: Colors.red,
      buttonColor: Colors.red,
      dialogBackgroundColor: Colors.red,
      disabledColor: Colors.red,
      dividerColor: Colors.red,
      errorColor: Colors.red,
      focusColor: Colors.red,
      highlightColor: Colors.red,
      hintColor: Colors.red,
      hoverColor: Colors.red,
      indicatorColor: Colors.red,
      primaryColorDark: Colors.red,
      primaryColorLight: Colors.red,
      secondaryHeaderColor: Colors.red,
      selectedRowColor: Colors.red,
      shadowColor: Colors.red,
      splashColor: Colors.red,
      toggleableActiveColor: Colors.red,
      unselectedWidgetColor: Colors.red,
      accentColor: Colors.red,
      scaffoldBackgroundColor: Colors.white,
      primaryColor: Colors.red,

推荐阅读