title: How to make ListView clickable in flutter?
body: <p>I'm loading data from api into my class UserProductType <code>List&lt;UserProductType&gt; _visibleUserProductTypes = api();</code>. Then I'm using ListView.builder to create cards that have child GestureDetector so I can register clicks. (Then I would like to change card background and once button is pressed, sent the one chosen id to other function...)</p>
  
  <p>The problem is that this code is not calling the function <code>onTap: () =&gt; selectItem(product),</code></p>
  
  <p>Relevant part of the code:</p>
  
  <pre><code>  void selectItem(UserProductType product) {
        print(product.name);
    }
  
    Container listSection() {
      return Container(
          child: Expanded(
            child: ListView.builder(
              itemCount: _visibleUserProductTypes.length,
              itemBuilder: (context, index) {
                var product = _visibleUserProductTypes[index];
                return new Card(
                  elevation: 2,
                  child: GestureDetector (
                    onTap: () =&gt; selectItem(product),
                    child: Container(
                      padding: EdgeInsets.all(15.0),
                      child: Row(
                        children: &lt;Widget&gt;[
                          Icon(_icons[index], color: Colors.grey,),
                          SizedBox(width: 10.0,),
                          Text(_visibleUserProductTypes[index].name,
                            style: TextStyle(color: _colors[index]),
                          ),
                        ],
                      ),
                    ),
                  ),
                );
              },
            ),
          )
      );
    }
  </code></pre>
  
  <p>Where is the problem?</p>