我无法添加ontap功能。我非常想添加墨水池,但相同的结果卡不按下,我也试图在自定义小部件内打印,但相同的结果..此外,我还尝试了 Package 墨水池与材料和 Package 容器与IgnorePointer
Wrap(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap:onPressed,
child: Container(
width: 200,
child: Card(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: SizedBox(
width: 200,
height: MediaQuery.of(context).size.width < 600?150:250,
child: ClipRRect(
child: Image.memory(
base64Decode(Url),
fit: BoxFit.cover,
),
),
),
),
],
),
),
),
)
)],
),
return Container(
child: detail_blog(
title:title,
Url: image_url,
onPressed: (){
print("preesed");
Navigator.push(context, MaterialPageRoute(builder: (builder)=>
blog_detail(
image_url: image_url3,
title: title,
code: code,
desc3: desc3,
catagorie: catagorie,
code1: code1,
code2: code2,
Date_time: Date_time,
desc: desc,
desc1: desc1, desc2: desc2,
image_url1: image_url,
image_url2: image_url1,
image_url3: image_url2,
)
));
},
),
);
1条答案
按热度按时间yacmzcpb1#
你应该在Flutter的任何点击监听器中使用()=〉或(){}。虽然你可以直接使用函数回调,比如'onTap:functionCallback ',仍然建议将回调定义为'Function()functionCallback '。