简体   繁体   English

Flutter:这些布局有什么区别吗?

[英]Flutter: Is there any difference between these layouts?

In flutter, Is there any difference between these layouts?在颤振中,这些布局有什么区别吗? - -

  • Expanded展开
  • SizedBox.expand大小盒.expand
  • BoxConstraints.expand() BoxConstraints.expand()

If all are same, why there are multiple layout classes/functions for same functionality?如果都相同,为什么相同功能有多个布局类/功能?

As far as I know.我所知道的。

Expanded widget can only used inside of Row , Column and Flex .扩展小部件只能在RowColumnFlex内部使用。 It helps to expand the children based on the flex value.它有助于根据 flex 值扩展子项。 By default - it's 1.默认情况下 - 它是 1。

SizedBox.expand - It will expand the child as large as it's parent allows. SizedBox.expand - 它将子项扩展到父项允许的大小。 You can put anywhere unlike Expanded.您可以放置​​与扩展不同的任何位置。

BoxConstraints.expand - Usually takes as object of ConstrainedBox constraints property. BoxConstraints.expand - 通常作为 ConstrainedBox 约束属性的对象。

From the documentation -从文档 -

Creates box constraints that expand to fill another box constraints.创建扩展以填充另一个框约束的框约束。

If width or height is given, the constraints will require exactly the given value in the given dimension.如果给定宽度或高度,则约束将需要给定尺寸中的给定值。

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

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