ksetStatusBarColor function

void ksetStatusBarColor({
  1. Brightness brightness = Brightness.light,
  2. Color statusBarColor = Colors.transparent,
})

设置状态栏文字颜色

Implementation

void ksetStatusBarColor({
  Brightness brightness = Brightness.light,
  Color statusBarColor = Colors.transparent,
}) {
  // 使用原生Platform 判断,web 会报错
  if (Platform.isIOS) {
    SystemChrome.setSystemUIOverlayStyle(
      SystemUiOverlayStyle(
        statusBarColor: statusBarColor,
        statusBarIconBrightness: brightness,
        statusBarBrightness: brightness,
      ),
    );
  } else if (Platform.isAndroid) {
    SystemChrome.setSystemUIOverlayStyle(
      SystemUiOverlayStyle(
        statusBarColor: statusBarColor,
        statusBarIconBrightness: brightness,
        statusBarBrightness: brightness,
      ),
    );
  }
}