大家好,正如标题所示,我正在尝试从具有6个元素的最终列表中读取元素,以呈现具有表示列表中元素的文本的卡片
itemBuilder: (BuildContext context, int index) => Card(child: Center(child: Text('Random Text')),
下面是我正在尝试阅读的列表
final listOfClusters = ['HEART', 'VOICE', 'MOVE', 'MIND', 'FORCE', 'STRIKE'];
在ListView
:
itemCount: listOfClusters.length,
itemBuilder: (BuildContext context, int index) =>
Card(child: Center(child: Text(listOfClusters[index])),
在儿童名单中:
children: [
for(var cluster in listOfClusters)
Card(child: Center(child: Text(cluster)),
]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句