title: Change Container widget background color on press
body: <p>I am trying to change the background color of my container widget inside the Expanded when a button is pressed in BottomNavigationBar.</p>
  <p>I am using a list of color and a variable index to traverse the list front and back.</p>
  <p>Even though I used setState(() {}), the color is not changing.</p>
  <p>h(double x) and w(double x) are the methods that return the height or width of the screen times x using MediaQuerry.</p>
  <p>Here are the codes -</p>
  <p>The list --</p>
  <pre><code> List&lt;Color&gt; col = [Colors.grey, Colors.red, Colors.pink];
   int index = 0;
  
  </code></pre>
  <p>BottomNavigationBar --</p>
  <pre><code>bottomNavigationBar: BottomAppBar(
            child: Container(
              color: Colors.orange,
              height: h(0.07),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  IconButton(
                    icon: Icon(Icons.arrow_back_ios),
                    color: Colors.white,
                    onPressed: () {
                      if (index == 0) {
                      } else {
                        setState(() {
                          index--;
                        });
                      }
                    },
                  ),
                  Icon(
                    Icons.color_lens_rounded,
                    color: Colors.white,
                  ),
                  IconButton(
                    icon: Icon(Icons.arrow_forward_ios),
                    color: Colors.white,
                    onPressed: () {
                      if (index == col.length - 1) {
                      } else {
                        setState(() {
                          index++;
                        });
                      }
                    },
                  ),
                ],
              ),
            ),
          ),
  </code></pre>
  <p>Widget whose color has to be changed</p>
  <pre><code>Expanded(
     child: Container(
      color: col[index],
       child: Column(
          children: [],
        ),
     ),
  )
  </code></pre>