Column class Components Layout

A Column arranges its child Component widgets vertically in sequence.

The Column is a layout component that stacks its children vertically, respecting their intrinsic sizes and any vertical gaps specified via childGap. It does not scroll; if content overflows the available space, it will be clipped by the parent.

Layout Behavior

  • Each child is measured based on the maximum available size.
  • The overall width is the maximum width of its children.
  • The overall height is the sum of its children's heights, plus the childGap between each.

Example

final column = Column(
  children: [
    TextComponent("Hello"),
    TextComponent("World"),
  ],
  childGap: 2,
);

See Also

Inheritance

Constructors

Column.new({required List<Component> children, int childGap = 1})
Creates a new Column layout.
const

Properties

childGap int
The number of rows (in terminal cells) to leave between each child.
final
children List<Component>
The list of child Components to be displayed vertically.
final
hashCode int
The hash code for this object.
no setterinherited
padding EdgeInsets
The padding inside the component’s layout bounds.
finalinherited
position Position?
The position of the component within its parent or layout.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createInstance() ComponentInstance
Creates a ComponentInstance that can be rendered.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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