Sre*_*nth 5 datatable dart flutter flutter-layout
我能够设置一个 DataTable 来显示一堆数据。但是想要在点击一行时导航到另一个屏幕。
不幸的是,DataRow 没有 onTap 回调。
我最终为每个 DataCell 添加了 onTap,这看起来像是一个笨拙的解决方案。有没有其他方法可以处理这个问题?
小智 2
DataRow中的onTap调用的是onSelectChanged函数
DataRow(
cells: [
DataCell(Text("ID"))
,DataCell(Text("NAME"))
],
onSelectChanged: (value) {
// insert your navigation function here and use the selected value returned by the function
Navigator.of(context).pop(value);
}
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2384 次 |
| 最近记录: |