BuildableComponentInstance class Components Core

The runtime instance of a BuildableComponent.

A BuildableComponentInstance is created when a stateless BuildableComponent is inserted into the layout. It holds the concrete ComponentInstances for all children built by the BuildableComponent's build method.

The instance:

  • Measures and reports its total size based on its children.
  • Stacks children vertically, separated by childGap spaces.
  • Renders each child in its assigned bounds.

Example:

final menuInstance = Menu(['Home', 'About', 'Exit']).createInstance();
final size = menuInstance.measure(Size(width: 80, height: 24));
menuInstance.render(buffer, someBounds);

See also:

Inheritance

Constructors

BuildableComponentInstance(BuildableComponent component)
Creates an instance from the given component, immediately building and instantiating its children.

Properties

bounds ↔ Rect
The current layout bounds for this component instance.
getter/setter pairinherited
childGap → int
Vertical spacing between stacked children.
final
childrenInstance → List<ComponentInstance>
The direct child component instances managed by this parent.
no setteroverride
component → BuildableComponent
The stateless BuildableComponent configuration for this instance.
final
direction → Axis
The primary axis along which children are laid out. Defaults to vertical stacking.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
padding → EdgeInsets
The padding inside the component’s allocated space.
finalinherited
position → Position
The position of this component relative to its parent or container.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

fitHeight() → int
Returns the height this component should occupy based on its content or layout rules.
override
fitWidth() → int
Returns the width this component should occupy based on its content or layout rules.
override
measure(Size maxSize) → Size
Measures the size this component would like to occupy, given a maximum available size.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(CanvasBuffer buffer, Rect bounds) → void
Renders the component into the provided CanvasBuffer using the given bounds as the drawing area.
override
shouldRenderChild(ComponentInstance child) → bool
Determines whether a given child should be rendered. Defaults to false, meaning the decision is left to layout/rendering code.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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