onKeyPress method

void onKeyPress(
  1. KeyboardEvent event
)

Keypress callback used to handle enter and space keys.

Implementation

void onKeyPress(KeyboardEvent event) {
  if (event.keyCode == KeyCode.ENTER) {
    handleEnterKey(event);
  } else if (isSpaceKey(event)) {
    handleSpaceKey(event);
  } else if (event.charCode != 0) {
    handleCharCodeKey(event);
  }
}