Reputation: 391
How to change status bar color whithout AppBar ?
my snippet code :
@override
Widget build(BuildContext context) {
return Scaffold(
body: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light,
child: BodyWidget(),
),//
);
}
Upvotes: 3
Views: 10168
Reputation: 391
this work for me
@override
Widget build(BuildContext context) {
return Scaffold(
body: AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light,
child: BodyWidget(),
),
);
}
Upvotes: 9
Reputation: 171
Another effective way this can be done:
class MyWidget extends StatelessWidget {
const MyWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: Colors.red,
systemNavigationBarColor: Colors.red,
statusBarIconBrightness: Brightness.dark,
systemNavigationBarIconBrightness: Brightness.dark,
),
child: Scaffold(),
);
}
}
Upvotes: 2
Reputation: 275
Hope this will help you
void main() {
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
statusBarColor: Colors.red,
),
);
runApp(MyApp());
}
Upvotes: 9