how to use statusBarColor theme flutter code example
Example 1: color of status bar flutter
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white
));
Example 2: how to change background color in flutter theme
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
canvasColor: Colors.green,
),
home: Scaffold(
appBar: AppBar(
title: Text('Changing background color using theme'),
),
body: Container(
child: Center(
child: Text('Some widget goes here.')
)
),
),
);
}
}
Example 3: flutter status bar color
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(...),
);