-2

In my flutter app, I used a bottom navigation bar with 6 options. The sixth option is a menu hamburger icon, which I'm using to open a side drawer.

What I'm struggling to do is:

When the drawer opens or closes, I expect the colour of the hamburger icon to change.
As a result, when the user clicks on the icon, I am able to correctly update the icon colour and the drawer opens. However, after the drawer closes, I am unable to change the colour of the icon.
Ajay Sharma
  • 108
  • 1
  • 3

1 Answers1

0

Try something like this, if the drawer is open then the color should be green else it should be red:

color: Scaffold.of(context).isDrawerOpen ? Colors.green : Colors.red
Siddharth Mehra
  • 1,691
  • 1
  • 9
  • 32