Flutter – How to change status bar color in Flutter

dartflutterflutter-dependenciesflutter-layout

I am trying to change the status bar color to white. I found this pub on flutter. I tried to use the example code on my dart files.

Best Answer

Update Flutter 2.0 (Recommended):

On latest Flutter version, you should use:

AppBar(
  backwardsCompatibility: false,
  systemOverlayStyle: SystemUiOverlayStyle(statusBarColor: Colors.orange),
)

Only Android (more flexibility):

import 'package:flutter/services.dart';

void main() {
  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
    systemNavigationBarColor: Colors.blue, // navigation bar color
    statusBarColor: Colors.pink, // status bar color
  ));
}

Both iOS and Android:

appBar: AppBar(
  backgroundColor: Colors.red, // status bar color
  brightness: Brightness.light, // status bar brightness
)