【发布时间】:2021-11-14 21:37:13
【问题描述】:
我有这个代码,它给了我一个项目列表。
我想:
1 - 使项目可点击(可能通过手势检测)
2 - 允许文本 + 图标可以更改并且每个项目都不同。现在,我可以为所有项目显示相同的文本(因为这一行:child: new Text("$index"),),但它们需要不同,这样我才能真正实现以下目标:
Container(
height: 80.0,
child: new ListView(
scrollDirection: Axis.horizontal,
children: new List.generate(10, (int index) {
return new Card(
color: Colors.blue[index * 100],
child: new Container(
width: 50.0,
height: 50.0,
child: new Text("$index"),
),
);
}),
),
),
我将整理手势和点击,但我如何创建它,以便我可以为每个生成的项目以不同的方式命名我的项目?
【问题讨论】:
-
不同如何?您要实现的逻辑是什么?您缺少数据。
-
如手动(类别等)。
标签: flutter dart filter flutter-layout