SizedBox class

A box with a specified size.

When given a child, uses .apply() to merge width/height directly onto the child — no wrapper div. Without a child, renders an empty <div> for spacer usage.

Column(children: [
  h1([text('Title')]),
  SizedBox(height: 2.rem),
  p([text('Description')]),
])
Inheritance
Available extensions

Constructors

SizedBox({Unit? width, Unit? height, Component? child, Key? key})
const
SizedBox.expand({Component? child, Key? key})
Creates a box that will become as large as its parent allows.
const
SizedBox.shrink({Component? child, Key? key})
Creates a box that will become as small as possible.
const

Properties

child → Component?
final
hashCode → int
The hash code for this object.
no setterinherited
height → Unit?
final
key → Key?
Controls how one component replaces another component in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
width → Unit?
final

Methods

apply({String? id, String? classes, Styles? styles, Map<String, String>? attributes, Map<String, EventCallback>? events}) → Component

Available on Component, provided by the ComponentApplyExtension extension

build(BuildContext context) → Component
Describes the part of the user interface represented by this component.
override
createElement() → Element
Creates a StatelessElement to manage this component's location in the tree.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldRebuild(covariant Component newComponent) → bool
Implement this method to determine whether a rebuild can be skipped.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited