在我的 Flutter 小部件测试中,我想点击列表或网格视图中的所有(或前 n 个)项目。
我已经想出了一个解决方案,虽然它似乎有效,但再次按键找到点击目标看起来过于复杂:
for (final element in find.byType(ListTile).evaluate()) {
await tester.tap(find.byKey(element.widget.key!));
}
有没有更优雅的方法来做到这一点?
在我的 Flutter 小部件测试中,我想点击列表或网格视图中的所有(或前 n 个)项目。
我已经想出了一个解决方案,虽然它似乎有效,但再次按键找到点击目标看起来过于复杂:
for (final element in find.byType(ListTile).evaluate()) {
await tester.tap(find.byKey(element.widget.key!));
}
有没有更优雅的方法来做到这一点?