Flutter TableRow 中的手柄点击

Nbn*_*Nbn 2 flutter flutter-table

我需要使 TableRow 可点击并导航到其他屏幕,但我无法使用 GestureDetector 或 Inkwell 包装 TableRow。如何使 TableRow 可点击。我已实施如下:

for (int i = 0; i < menuList.length; i++)
              TableRow(children: [
                SizedBox(
                  width: 5,
                ),
                Text((i + 1).toString()),
                Text(menuList[i].name),
                Text(menuList[i].price.toString()),
                Text(menuList[i].maxQty.toString()),
                menuList[i].status == 0
                    ? Text(
                        menuList[i].foodStatus,
                        style: TextStyle(color: Colors.red),
                      )
                    : YourListViewItem(
                        id: menuList[i].id,
                        index: menuList[i].status,
                      ),
              ]),
Run Code Online (Sandbox Code Playgroud)

far*_*ama 5

我不认为你能做到这一点

您可以使用DataTable代替Table小部件,它一定会满足您的需求。

DataRow中有一个名为onSelectChanged 的​​属性,这正是您想要的。