1. 沉浸式状态栏
Scaffold( extendBodyBehindAppBar: true, appBar: AppBar( toolbarHeight: 0, ), body: Container(color:Colors.red))
2. 状态栏的背景颜色
Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, ), body: Container(color:Colors.red))
3. 状态栏的文字颜色
Brightness.light
文字黑色Brightness.dark
文字白色
Scaffold( appBar: AppBar( brightness: Brightness.light, ), body: Container(color:Colors.red))
4. 沉浸式状态栏下的安全区域
Scaffold( extendBodyBehindAppBar: true, appBar: AppBar( toolbarHeight: 0, ), body: SafeArea(child:Container(color:Colors.red)))
5. Android机器的状态栏颜色改为透明
默认是带个遮罩的,完全去除:
void main() async { runApp(MaterialApp()); SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor:Colors.transparent); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);}
来源地址:https://blog.csdn.net/NotBad_/article/details/132025899