I do not like crap first on the map (all real test)
Andrews
ios's (with ipad demo)
Method to realize
We only need ### initState () or call the following method to other hooks in the life cycle
/// 状态栏样式 沉浸式状态栏
_statusBar([String color]) {
// 白色沉浸式状态栏颜色 白色文字
SystemUiOverlayStyle light = SystemUiOverlayStyle(
systemNavigationBarColor: Color(0xFF000000),
systemNavigationBarDividerColor: null,
/// 注意安卓要想实现沉浸式的状态栏 需要底部设置透明色
statusBarColor: Colors.transparent,
systemNavigationBarIconBrightness: Brightness.light,
statusBarIconBrightness: Brightness.light,
statusBarBrightness: Brightness.dark,
);
// 黑色沉浸式状态栏颜色 黑色文字
SystemUiOverlayStyle dark = SystemUiOverlayStyle(
systemNavigationBarColor: Color(0xFF000000),
systemNavigationBarDividerColor: null,
/// 注意安卓要想实现沉浸式的状态栏 需要底部设置透明色
statusBarColor: Colors.transparent,
systemNavigationBarIconBrightness: Brightness.light,
statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.light,
);
// 这个地方你可以去掉三目运算符 直接调用你想要的 效果即可
"while" == color?.trim()
? SystemChrome.setSystemUIOverlayStyle(light)
: SystemChrome.setSystemUIOverlayStyle(dark);
}
ps: In fact, this is dependent on an implementation class import more than Flutter give me the 'package: flutter / services.dart';