Flutter 狀態欄顏色

使用AppBar

修改 AppBar中的 brightness屬性 是個 枚舉 有 Dark, 和 Brightness 兩個屬性bash

/// Describes the contrast of a theme or color palette.
enum Brightness {
  /// The color is dark and will require a light text color to achieve readable
  /// contrast.
  ///
  /// For example, the color might be dark grey, requiring white text.
  dark,

  /// The color is light and will require a dark text color to achieve readable
  /// contrast.
  ///
  /// For example, the color might be bright white, requiring black text.
  light,
}
複製代碼

未使用AppBar的狀況

未使用AppBar 可使用 SystemUiOverlayStyle 更改狀態欄顏色ui

return AnnotatedRegion<SystemUiOverlayStyle>(
      value: SystemUiOverlayStyle.dark,
      child: Material(child: Scaffold(body: loginMain(),),),
    );
複製代碼

記得導入 下面這個頭文件spa

import 'package:flutter/services.dart';
複製代碼
相關文章
相關標籤/搜索