Component class abstract Components Core

The base class for all renderable UI components.

A Component defines the minimal contract for a terminal UI element, including its padding, optional position, and the ability to create a corresponding ComponentInstance for rendering.

Components are immutable configuration objects. They are not directly rendered; instead, they produce ComponentInstance objects that handle rendering and state management.

Example:

class MyButton extends Component {
  const MyButton({super.padding, super.position});

  @override
  ComponentInstance createInstance() {
    return MyButtonInstance();
  }
}

See also:

Implementers

Constructors

Component.new({EdgeInsets padding = const EdgeInsets.all(0), Position? position})
Creates a Component with optional padding and position.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
padding EdgeInsets
The padding inside the component’s layout bounds.
final
position Position?
The position of the component within its parent or layout.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createInstance() ComponentInstance
Creates a ComponentInstance that can be rendered.
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