SizedBox
A widget that imposes specific dimensions on its child.
Learn more: Layout
Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.
SizedBox( width: 20, height: 3, child: Text('fixed area'),)Details
Section titled “Details”A null width or height adds no constraint on that axis beyond the bounds supplied by the parent, so the child chooses its size there. With no child, a null axis resolves to the parent’s minimum (often zero).
Constructors
Section titled “Constructors”SizedBox()
Section titled “SizedBox()”| Parameter | Type | Default | Description |
|---|---|---|---|
width: | int? | — | Requested width in cells, or null to add no width constraint. |
height: | int? | — | Requested height in rows, or null to add no height constraint. |
child: | Widget? | — | Content constrained to the requested size, or null for an empty box. |
SizedBox.fromSize()
Section titled “SizedBox.fromSize()”Convenience for a fixed width x height box with no child.
| Parameter | Type | Default | Description |
|---|---|---|---|
cols: | int | required | Fixed width in terminal cells. |
rows: | int | required | Fixed height in terminal rows. |
SizedBox.shrink()
Section titled “SizedBox.shrink()”Convenience for a zero-sized leaf.
This constructor has no public parameters.
SizedBox.expand()
Section titled “SizedBox.expand()”Forces the box to fill the parent’s bounded space on both axes.
An unbounded axis remains unconstrained, and the child chooses its size.
In a Row or Column, use Expanded or Flexible to claim remaining
main-axis space; inflexible children are unbounded on that axis.
| Parameter | Type | Default | Description |
|---|---|---|---|
child: | Widget? | — | Content forced to fill all bounded space supplied by the parent. |
SizedBox.square()
Section titled “SizedBox.square()”Forces the box to be dimension x dimension. Equivalent to
SizedBox(width: dimension, height: dimension, child: child).
| Parameter | Type | Default | Description |
|---|---|---|---|
dimension: | int? | — | Width and height in cells, or null to defer both axes to the parent. |
child: | Widget? | — | Content constrained to the square. |
Source
Section titled “Source”SizedBox is defined in packages/fleury/lib/src/widgets/basic.dart.
Category: Layout · All widgets