简体   繁体   English

如何在 flutter 中创建下拉小部件

[英]How to create dropdown widget in flutter

I am trying to make a dropdown widget that appears from the location of the clicked widget.我正在尝试制作一个从单击的小部件的位置出现的下拉小部件。 I know there are a lot of solutions on the inte.net already regarding this, however, none of the ones I found serve my specific needs.我知道 inte.net 上已经有很多关于此的解决方案,但是,我发现没有一个能满足我的特定需求。

  1. Using dropdown packages: This does not work, as these widgets do not provide any way of customization.使用下拉包:这不起作用,因为这些小部件不提供任何自定义方式。 They are always just lists of items.它们总是只是项目列表。 What I want is a dropdown Container that I can fully customize.我想要的是一个我可以完全自定义的下拉容器。

  2. Using dialogs: It is tough to customize the location of these dialogs.使用对话框:很难自定义这些对话框的位置。 I want it to appear right at the location of the clicked button/widget.我希望它出现在点击按钮/小部件的位置。

The white circle here is the widget that is supposed to be clicked on这里的白色圆圈是应该被点击的小部件

This is what is supposed to appear after clicking the circle.这是单击圆圈后应该出现的内容。 As you can see here it is not placed correctly.如您所见,它没有正确放置。 The circle in the widget and the circle we click should be on top of each other.小部件中的圆圈和我们点击的圆圈应该在彼此的顶部。 And the dropdown itself should be a container not a list of widgets like here as opposed to a dropdown list.下拉列表本身应该是一个容器,而不是像这里这样的小部件列表,而不是下拉列表。

I believe this question should provide you with an answer.我相信这个问题应该可以为您提供答案。
If not, feel free to say so.如果没有,请随时说出来。
(The answer points to this package: flutter_portal ) (答案指向这个 package: flutter_portal

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM