flutter状态栏的颜色设置
一:整体设置状态栏颜色:(亲测暂时无效)
void main() {
runApp(MyApp());
//黑色
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark);
白色
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
}
二:单个页面状态栏颜色改变(亲测有效)
1:使用AppBar
brightness:关键代码
appBar: AppBar(
title: Text('appbar',style: TextStyle(color: Colors.black),),
brightness: Brightness.light,
backgroundColor: Colors.white,
),
2:未使用AppBar
单页设置更改状态栏颜色
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.dark,
child: Scaffold(
resizeToAvoidBottomInset: false,
body: Column(),
));