在 Flutter 中,如何在点击其他小部件时打开 DropdownButton? [英] How to open DropdownButton when other widget is tapped, in Flutter?

查看:26
本文介绍了在 Flutter 中,如何在点击其他小部件时打开 DropdownButton?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在点击其他小部件时以编程方式打开/显示 DropdownButton 的选项列表.我知道这可能不是 UI 最佳实践,但我需要这种行为:

I need to have a DropdownButton's list of options open/show programmatically when some other widget is tapped. I know that this may not be UI-best-practice and all, but I need this behavior:

举个例子,在像下面这样的结构中,我可能需要点击 Text("every") 来打开相邻的 DropdownButton 的下拉列表, 行为类似于在 HTML 中单击

发送“验证码”获取 | 15天全站免登陆