我有一个完全可点击的卡有点问题,情况是只有当点击测试时程序才会识别为点击,卡的其他部分没有。
这是代码的一部分:
GridView.builder(
padding: const EdgeInsets.fromLTRB(15, 90, 15, 0),
itemCount: services.lenght,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
childAspectRatio: MediaQuery.of(context).size.width/(MediaQuery.of(context).size.height/6),
),
itemBuilder: (BuildContext context, int index){
return Card(
child: Column(children: <Widget> [
SizedBox(
height: 2,
width: 10,
),
Image.asset(images[index],height:55,width: 750,
),
Padding(
padding: EdgeInsets.all(7),
child: GestureDetector(
onTap: (){
switch(index){
case 0:
Navigator.of(context).pushReplacementNamed(SearchGoods.routeName);
break;
case 1:
Navigator.of(context).pushReplacementNamed(Vehicles.routeName);
break;
}
},
child: Text(services[index],
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
)
)
),
],
),
);