title: setState not changing value in gridview in flutter
body: <p>basically i m updating list value that used in gridview, when i click on gridview card, i m changing color of that card. when i print color value it did changing but in gridview has no effect. Plz suggest me what to do? is my logic approach is wrong ?</p>
  
  <pre><code>class FilterDialog extends ModalRoute&lt;void&gt; {
  
     List&lt;Grades&gt; mGradeList = [];
     List&lt;Styles&gt; mStyleList = [];
     List&lt;Types&gt; mTypeList = [];
     List&lt;Specials&gt; mSpecialList = [];
  
     FilterDialog(this.mGradeList, this.mStyleList, this.mTypeList, this.mSpecialList);
  
  
        @override
        Widget buildPage(
          BuildContext context,
          Animation&lt;double&gt; animation,
          Animation&lt;double&gt; secondaryAnimation,
        ) {
          // This makes sure that text and other content follows the material style
          return Material(
            type: MaterialType.transparency,
            // make sure that the overlay content is not cut off
            child: SafeArea(
              child: _buildOverlayContent(context),
            ),
          );
        }
  
        Widget _buildOverlayContent(BuildContext context) {
          return new Container(
              padding: EdgeInsets.only(left: 15, right: 15),
              child: Column(
                  children: &lt;Widget&gt;[
                      titleWidget("Grade"),  
                      gridViewWidget(mGradeList, 3, 2.2),
  
                      spaceWidget(),
                      titleWidget("Style"),  
                      gridViewWidget(mStyleList, 2, 3.5),
  
                      spaceWidget(),
                      titleWidget("Type"),  
                      gridViewWidget(mTypeList, 2, 3.5),
  
                      spaceWidget(),
                      titleWidget("Special"),  
                      gridViewWidget(mSpecialList, 2, 3.5),
                  ],
                )
            );
        }
  
        Widget gridViewWidget(list, int count, double ratio) {
          return GridView.count(
            shrinkWrap: true,
            crossAxisCount: count,
            mainAxisSpacing: 2.0,
            crossAxisSpacing: 1.0,
            childAspectRatio: ratio,
            physics: new NeverScrollableScrollPhysics(),
            children: _getTiles(list)
          );
        }
  
        void _onTileClicked(int index, value, list){
          assert(index != null);
          assert(value != null);
          setState(() {
              list[index].setSelected(!value);
          });
          debugPrint("You tapped on item $index with $value");
        }
  
        // Get grid tiles
      List&lt;Widget&gt; _getTiles(list) {
        final List&lt;Widget&gt; tiles = &lt;Widget&gt;[];
        for (int i = 0; i &lt; list.length; i++) {
          tiles.add(new GridTile(
                child: new Center(
                  child: Container(
                    height: 35.0,
                    child: new RaisedButton(
                      onPressed: () =&gt; _onTileClicked(i, list[i]["selected"], list),
                      color: list[i]["selected"] ? backgroundColor : white, //here value not changing
                      shape: new RoundedRectangleBorder(
                          borderRadius:
                              new BorderRadius.circular(30.0)),
                      child: new Text(
                        list[i]["label"],
                        textAlign: TextAlign.center,
                        style: new TextStyle(
                          fontSize: 14.0,
                          color: Colors.grey,
                        ),
                      ),
                    ),
                  ),
                ),
              ));
        }
        return tiles;
      }
  </code></pre>
  
  <p>class model:</p>
  
  <pre><code>class Grades {
      String label;
      bool selected;
  
      Grades(this.label, this.selected);
  
      void setSelected(bool val) {
          this.selected = val;
      }
  }
  </code></pre>
  
  <p>some data:  </p>
  
  <pre><code>var typeList = [{"label": "Crack", "selected": false}, {"label": "Face", "selected": false},
     {"label": "Slab", "selected": false}, {"label": "Multi-pitch", "selected": false} ];  
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/3qc2X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3qc2X.png" alt="enter image description here"></a></p>