How to change status bar color in Flutter?

Mohamed Hassan picture Mohamed Hassan · Sep 25, 2018 · Viewed 88.7k times · Source

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.

Answer

Andrey Turkovsky picture Andrey Turkovsky · Sep 25, 2018

Works totally fine in my app

import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    FlutterStatusbarcolor.setStatusBarColor(Colors.white);
    return MaterialApp(
      title: app_title,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomePage(title: home_title),
    );
  }
}

(this package)

UPD: Another solution

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
  statusBarColor: Colors.white
));