title: How to color selected ListItem onTap
body: <p>I want to color select value from a ListView like this : </p>
  
  <p><a href="https://i.stack.imgur.com/nmVse.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nmVse.jpg" alt="enter image description here"></a></p>
  
  <p>The problem is I print all when I try it , code : </p>
  
  <pre><code>class _ProcedureList extends State&lt;ProcedureList&gt; {
  
  bool isSelected  = true;
  
     _isSelected() {
      setState(() {
        if (isSelected) {
          isSelected = false;
        } else {
          isSelected = true;
        }
      });
    }
  
  
  
    @override
    Widget build(BuildContext context) {
      var procedureList = widget.filteredkits
          .where((kit) =&gt; kit.brand == widget.brand)
          .map((kit) =&gt; kit.procedure)
          .toSet()
          .toList();
  
      return Expanded(
        flex: 2,
        child: Container(
          padding: EdgeInsets.only(left: 35.0),
          child: new ListView.builder(
            itemCount: procedureList.length,
            itemBuilder: (BuildContext context, int index) {
              return Padding(
                padding: EdgeInsets.all(6.0),
                child: Column(
                  children: &lt;Widget&gt;[
                    new Container(
                      width: 300.0,
                      height: 30.0,
                      color: Colors.grey[700],
                      padding: EdgeInsets.all(6.0),
                      child: new Text(widget.brand),
                    ),
                    GestureDetector(
                      onTap: () =&gt; widget.getProcedureSelectedandList(procedureList[index].toString()) &amp; _isSelected(),
                      child: Container(
                        width: 300.0,
                        padding: EdgeInsets.all(3.0),
                        color: !isSelected ? Colors.white : Colors.orange,
                        child: 
                        new Text(procedureList[index])
                      ),
                    ),
                  ],
                ),
              );
            },
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>And this is what I achieve , all colored  : </p>
  
  <p><a href="https://i.stack.imgur.com/v9ZAG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v9ZAG.png" alt="enter image description here"></a></p>
  
  <p>I don't know how to only color one item when the event happens and if we can change the text color with the same event better .</p>