0

If yes, how or is there any other way to achieve the same. I want to change status bar colors dynamically.

Maz341
  • 2,232
  • 15
  • 20
  • Does this answer your question? [How to change status bar color in Flutter?](https://stackoverflow.com/questions/52489458/how-to-change-status-bar-color-in-flutter) – Sanoop Surendran Nov 21 '20 at 05:25
  • Provider can provide you the method you made to change the status bar color – Yadu Nov 21 '20 at 05:32
  • @Sanoop no, I know how to change the status bar color when the app restarts, i want to change color while the app is running. i.e. change color instantly on click of a button. – Susan Pandit Nov 22 '20 at 05:41
  • Have you tried runtime state change, since the color can be changed using the answer on the link, you can assign it to variable and update the state of that variable on any fire of event you want. – Sanoop Surendran Nov 22 '20 at 07:07

1 Answers1

1
import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart';

changeColor() {
  setState(() {
  FlutterStatusbarcolor.setStatusBarColor(Colors.white); //any color u want
  });
}

RaisedButton(
  Child: ...
  onPressed: () => changeColor();
)

Or you can use this:

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
  statusBarColor: Colors.white
));
Jagadish
  • 1,005
  • 11
  • 30