CheckboxInstance class Components InteractableComponents

The runtime instance of a Checkbox component.

This class:

  • Tracks whether the checkbox is checked.
  • Handles user interactions (keyboard and mouse).
  • Renders the checkbox and its label.
  • Applies different styles based on hover/focus/checked state.

Checkbox display logic:

  • Normal checked: [X] Label
  • Normal unchecked: [ ] Label
  • Hovered/focused checked: [-] Label
  • Hovered/focused unchecked: [.] Label

This instance is created internally by Checkbox.createInstance.

See also:

Inheritance

Constructors

CheckboxInstance(Checkbox component)
Creates a CheckboxInstance bound to the given component.

Properties

bounds ↔ Rect
The current layout bounds for this component instance.
getter/setter pairinherited
checked ↔ bool
Whether the checkbox is currently checked.
getter/setter pair
component → Checkbox
The configuration source for this instance.
final
contentWidth → int
The total width of the checkbox content (prefix + label).
no setter
focusable ↔ bool
Whether this checkbox can receive focus.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
isFocusable → bool
Whether this component can receive focus.
no setteroverride
isFocused ↔ bool
Indicates whether this component instance currently has input focus.
getter/setter pairinherited
isHoverable → bool
Whether this component can detect hover events.
no setteroverride
isHovered ↔ bool
Indicates whether the cursor is currently hovering over this component.
getter/setter pairinherited
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 pairinherited
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 setterinherited

Methods

blur() → void
Removes focus from this component.
inherited
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
focus() → void
Gives focus to this component.
inherited
handleInput(InputEvent event) → ResponseInput
Processes a raw input event and returns a response.
override
hover() → void
Sets the hover state for this component.
inherited
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
onBlur() → void
Called when this component loses focus.
override
onClick() → void
Called when the user clicks or taps on this component.
override
onFocus() → void
Called when this component gains focus.
override
onHover() → void
Called when the cursor begins hovering over this component.
override
render(CanvasBuffer buffer, Rect bounds) → void
Renders the component into the provided CanvasBuffer using the given bounds as the drawing area.
override
toString() → String
A string representation of this object.
inherited
unhover() → void
Removes the hover state from this component.
inherited

Operators

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

Constants

prefixCheckboxLength → const int
Length of the visual checkbox prefix (e.g., [X] ).