xxxxxxxxxx
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.blue, // Set the status bar color here
));
return MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.blue, // Same color as statusBarColor
title: Text('Flutter Status Bar Color'),
),
body: Center(
child: Text('Status Bar Color Change Example'),
),
),
);
}
}
xxxxxxxxxx
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white
));
xxxxxxxxxx
return AnnotatedRegion<SystemUiOverlayStyle>(
value: const SystemUiOverlayStyle(
// For Android.
// Use [light] for white status bar and [dark] for black status bar.
statusBarIconBrightness: Brightness.light,
// For iOS.
// Use [dark] for white status bar and [light] for black status bar.
statusBarBrightness: Brightness.dark,
),
child: Scaffold( ),
);
xxxxxxxxxx
AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: Colors.white,
),
child: Scaffold(
),
)
xxxxxxxxxx
import 'package:flutter/services.dart';
//inside build method
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.black,
));