handleInput method

  1. @override
ResponseInput handleInput(
  1. InputEvent event
)
override

Processes a raw input event and returns a response.

This method is called when wantsInput is true and the component is focused. It allows for low-level input processing.

event: The input event to process (key press, mouse event, etc.) Returns a ResponseInput indicating how the event was handled and any resulting commands or rendering needs.

Implementation

@override
ResponseInput handleInput(InputEvent event) {
  if (event is KeyEvent) {
    switch (event.char) {
      case ' ':
      case '\n':
        checked = !checked;
      default:
      // Other keys are ignored
    }

    return ResponseInput(
      commands: ResponseCommands.none,
      handled: true,
      dirty: [this], // Mark self as needing re-render
    );
  }

  return ResponseInput.ignored();
}