getStatusBarStyle static method
SystemUiOverlayStyle
getStatusBarStyle({
- bool isDark = false,
- Brightness brightness = Brightness.light,
获取状态栏样式配置(安卓iOS通用),在baseAppBar中使用 brightness:light:白色字体+白色图标 dark:黑色字体+黑色图标 (已在内部对iOS的取反进行处理)
Implementation
static SystemUiOverlayStyle getStatusBarStyle({bool isDark = false, Brightness brightness = Brightness.light}) {
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
// 设置顶部状态栏亮度 (Android SDK >= M), light:白色字体+白色图标 dark:黑色字体+黑色图标
// 暗黑模式优先级高于设置的brightness
statusBarIconBrightness: isDark ? Brightness.light : brightness,
// 设置顶部状态栏亮度 (仅用于iOS)
// iOS和安卓相反,dark:白色字体+白色图标 light:黑色字体+黑色图标
statusBarBrightness: isDark ? Brightness.dark : (brightness == Brightness.light ? Brightness.dark : Brightness.light),
);
return systemUiOverlayStyle;
}