簡體   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