InteractableComponentInstance class abstract Components Core Interaction

Base class for a ComponentInstance that can respond to user interaction.

An InteractableComponentInstance adds focus, hover, and input-handling capabilities to a component instance. Subclasses can override interaction flags and event handlers to define custom behavior.

Interaction flags:

  • isFocusable — whether the component can gain focus.
  • isHoverable — whether the component can be hovered.
  • wantsInput — whether the component requests input events when focused.

State:

  • isFocused — whether the component is currently focused.
  • isHovered — whether the component is currently hovered.

Event lifecycle:

Rendering:

May optionally hold a RenderManager reference for rendering coordination.

See also:

  • ComponentInstance — the base type for all renderable component instances.
  • ResponseInput — standard return type for processing user input.
  • InputEvent — encapsulates raw user interaction events.
Inheritance
Implementers

Constructors

InteractableComponentInstance({EdgeInsets padding = const EdgeInsets.all(0), Position position = const Position(x: 0, y: 0, positionType: PositionType.relative)})
Creates an interactable component instance with optional layout properties.

Properties

bounds ↔ Rect
The current layout bounds for this component instance.
getter/setter pairinherited
hashCode → int
The hash code for this object.
no setterinherited
isFocusable → bool
Whether this component can receive focus.
no setter
isFocused ↔ bool
Indicates whether this component instance currently has input focus.
getter/setter pair
isHoverable → bool
Whether this component can detect hover events.
no setter
isHovered ↔ bool
Indicates whether the cursor is currently hovering over this component.
getter/setter pair
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
renderManager ↔ RenderManager?
Optional reference to the render manager for coordinating rendering operations.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
wantsInput → bool
Whether this component wants to receive raw input events when focused.
no setter

Methods

blur() → void
Removes focus from this component.
fitHeight() → int
Returns the height this component should occupy based on its content or layout rules.
inherited
fitWidth() → int
Returns the width this component should occupy based on its content or layout rules.
inherited
focus() → void
Gives focus to this component.
handleInput(InputEvent event) → ResponseInput
Processes a raw input event and returns a response.
hover() → void
Sets the hover state for this component.
measure(Size maxSize) → Size
Measures the size this component would like to occupy, given a maximum available size.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onBlur() → void
Called when this component loses focus.
onClick() → void
Called when the user clicks or taps on this component.
onFocus() → void
Called when this component gains focus.
onHover() → void
Called when the cursor begins hovering over this component.
render(CanvasBuffer buffer, Rect bounds) → void
Renders the component into the provided CanvasBuffer using the given bounds as the drawing area.
inherited
toString() → String
A string representation of this object.
inherited
unhover() → void
Removes the hover state from this component.

Operators

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