【发布时间】:2020-02-16 17:52:35
【问题描述】:
我想实现一个功能,如果单击图像,它应该导航到新页面。下面的代码一直运行良好,直到最近它在函数onImageTap 下向我显示了一个波浪状的红色错误。
child: new Carousel(
boxFit: BoxFit.cover,
images: list,
onImageTap: (imageIndex) {
Navigator.of(context).push(
new MaterialPageRoute(
builder: (context) => new DishDetails(
detail_name:
snapshot.data[imageIndex].data["title"],
detail_picture: snapshot
.data[imageIndex].data["image"]),
),
);
},
autoplay: false,
dotSize: 4.0,
indicatorBgPadding: 4.0,
animationCurve: Curves.fastOutSlowIn,
animationDuration: Duration(milliseconds: 1000),
)));
当我将鼠标悬停在函数上时,我收到以下错误消息:
未定义命名参数 onImageTap。尝试更正名称 到现有的命名参数或使用此定义新参数 名字
谁能告诉我如何解决这个问题。
【问题讨论】: