Flutter 如何在 GridView.count 中获取 onTap() 命令

Flutter how do i get onTap() command in GridView.count

我是 flutter 的新手,如何在 gridview.count

中获取 onTap 命令

我试图使图像可点击,但我无法在 gridview.count

中获得 onTap 命令
 Widget buildBody() {
    return SafeArea(
        child: Container(
      padding: EdgeInsets.all(20.0),
      child: Column(
        children: <Widget>[
          Expanded(
              child: GridView.count(
            crossAxisCount: 2,
            padding: EdgeInsets.all(20),
            crossAxisSpacing: 20,
            mainAxisSpacing: 20,
            children: _products
                .map(((item) => Card(
                      child: Container(
                        decoration: BoxDecoration(
                            image: DecorationImage(
                                image: Image.asset(item.imageUrl),
                                fit: BoxFit.fill)),
                      ),
                    )))
                .toList(),
          )),
        ],
      ),
    ));
  }

这是我得到的图片列表

List<Product> _products = <Product>[
  Product("Özel Kesim Magnet", "Özel Kesim Magnet", "assets/icons/ökm.png"),
  Product("Kuşe Etiketler", "kş", "assets/icons/ke.png"),
  Product("Opak Etiketler", "oe", "assets/icons/oe.png"),
  Product("Şeffaf Etiketler", "şe", "assets/icons/şe.png"),
  Product("Kutu Kesim", "ks", "assets/icons/kk.png"),
  Product("Tam Kesim", "tk", "assets/icons/tk.png"),
  Product("Özel Kesim", "ÖK", "assets/icons/ök.png"),
  Product("Folyo Kesim", "fk", "assets/icons/fk.png")
];

GestureDetector or InkWell包裹你的卡片。

GestureDetector(
  onTap: () {},
  child: Card(...),
);