Tapping the overflow menu in a Flutter test

会有一股神秘感。 提交于 2020-02-06 08:19:40

问题


How do I tap on the overflow menu in a Flutter test, doing so in a way that works for both Material apps and Cupertino apps? The icon differs between iOS and Android, so I can't just find the icon type.

From the PopupMenuButton docs:

If both [child and icon] are null, then a standard overflow icon is created (depending on the platform).

This is analogous to pressing the platform-dependent icon for going back to the previous screen. The WidgetTester class includes the pageBack() method for this purpose, so I would have expected the class to also include a method for selecting the overflow menu, but I see no such method.

UPDATE: I've figured out the icon for Material Design apps. I don't know what it is for iOS yet, and if Flutter is going to select the icon for me, I'd rather delegate the selection to Flutter.

await tester.tap(find.byIcon(Icons.more_vert))

来源:https://stackoverflow.com/questions/58464657/tapping-the-overflow-menu-in-a-flutter-test

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!