繁体   English   中英

如何更改 flutter 中的 SearchDelegate StatusBarIcons 颜色或 buildSuggestions 正文颜色?

[英]How to change SearchDelegate StatusBarIcons Color or buildSuggestions body Color in flutter?

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

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

文本

文本

文本

文本

要更改状态栏颜色,只需使用:

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: Colors.white));

要更改 cursor 的蓝色气泡的颜色,请在 ThemeData 中使用:

textSelectionHandleColor: Colors.green,

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

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

  @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 Colors:

      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,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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