【发布时间】:2018-04-15 13:17:45
【问题描述】:
我正在使用ListTile 创建列表中的每个项目。每个项目都是从数据数组动态创建的。 ListTile 提供了onTap,但这对我来说是不够的,因为我需要通过获取键或索引来找出点击了哪个项目。
ListTile:
new ListTile(
//leading: const Icon(Icons.flight_land),
title: const Text('Trix\'s airplane'),
subtitle: const Text('The airplane is only in Act II.'),
enabled: true,
onTap: () { //TODO: get the identifier for this item },
trailing: new Container(
child: new Row(
children: [
new Text("70%"),
const Icon(Icons.flight_land)
]
)
),
)
【问题讨论】: