【发布时间】:2020-07-21 16:24:23
【问题描述】:
我正在使用 DataCell 显示从我的 sql 数据库中获取的数据列表,但我不太喜欢它的外观并希望将其切换为使用 ListTile 显示它,这就是我的代码using 使用DataCell 显示它:
return SingleChildScrollView(
scrollDirection: Axis.vertical,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
columns: [
DataColumn(
label: Text(''),
)
],
rows: _chatUsers
.map(
(user) => DataRow(cells: [
DataCell(
Text(user.firstNameUser),
// Add tap in the row and populate the
// textfields with the corresponding values to update
onTap: () {
// Set the Selected employee to Update
_selectedUser = user;
setState(() {
});
},
),
]),
)
.toList(),
),
),
);
【问题讨论】: