简体   繁体   English

如何获得 flutter 小部件的高度?

[英]How can I get the height of a flutter widget?

How can I get the height of a flutter widget?如何获得 flutter 小部件的高度? I think it's using key, but I don't know how.我认为它正在使用密钥,但我不知道如何。 For example I want to get the height of a container, which will be in a stack to be able to put the padding of a list view and that at the initial moment it is under the container.例如,我想获取容器的高度,该容器将位于堆栈中,以便能够放置列表视图的填充,并且在初始时刻它位于容器下方。

If you're wanting to get the height before the children widget are built, use a LayoutBuilder widget to wrap the descendants.如果您想在构建子小部件之前获取高度,请使用 LayoutBuilder 小部件来包装后代。

Otherwise you can also check the dev tools by using the Select Wifget tool and looking at the widget”s properties否则,您还可以使用 Select Wifiget 工具并查看小部件的属性来检查开发工具

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

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