【发布时间】:2018-03-07 01:28:50
【问题描述】:
我有一个 Expanded 小部件包裹在卡片的 Listview.builder 周围。我怎样才能让我的卡不仅能检测到onTap,还能将变量传递给我在导航上的新.dart 文件。我目前遇到尺寸错误?
已更新代码
这是我的代码:
new Expanded(
child: new ListView.builder(
itemCount: id == null ? 0 : id.length,
itemBuilder: (BuildContext context, int index) {
return new Card(
child: new Column(
children: <Widget>[
new Image.network(video[index]),
new Padding(padding: new EdgeInsets.all(3.0)),
new Text(title[index],
style: new TextStyle(fontWeight: FontWeight.bold,
color: Colors.black),
),
new GestureDetector(onTap: (){
print(id[index]);
},)
],
),
);
}))
这里是抛出的异常:
The following assertion was thrown during performLayout():
RenderPointerListener object was given an infinite size during layout.
This probably means that it is a render object that tries to be as big as possible, but it was put
inside another render object that allows its children to pick their own size.
我想在 iOS Swift 中传递 title[index] 和 video[index] 类似于 didSelectRowAtIndexPath。
【问题讨论】:
-
您能否澄清这部分请“将变量传递给我的新 .dart”,如果您添加代码以便能够看到您想要实现的目标会更好。
-
@aziza 我已经添加了我的代码并抛出了错误异常。
标签: navigation widget flutter gesturedetector