设置状态栏颜色:
runApp(MyApp());
SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
也可以使用第三库实现更多效果 flutter_statusbarcolor_ns: ^0.5.0 :
await FlutterStatusbarcolor.setStatusBarColor(Colors.transparent);
FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
改变状态栏中文字图标颜色:
SystemUiOverlayStyle.light 黑色,SystemUiOverlayStyle.dart 白色
builder: (context, child) => AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light,
child: MaterialApp(...),
),