WSelectComponent constructor

WSelectComponent(
  1. WInputDecorService _decorSvc
)

the constructor

Implementation

WSelectComponent(this._decorSvc) {
  /// listen to decor svc
  /// show options on focus
  /// nullify value on clear
  _decorSvc.onClear.listen((ev) => _valueChange.add(null));

  // bind keys
  KeyboardEventListener('keydown', [KeyCode.ESC], (ev) => _onBlur(true),
      where: (ev) => showOptions);
  KeyboardEventListener('keydown', [KeyCode.ENTER, KeyCode.MAC_ENTER],
      (ev) => selectOption(_higlightedOption),
      where: (ev) => showOptions);
  KeyboardEventListener('keydown', [KeyCode.UP, KeyCode.DOWN], (ev) {
    ev.preventDefault();
    _changeHighlight(ev.keyCode == KeyCode.UP ? -1 : 1);
    _scrollToActive();
  }, where: (ev) => showOptions);
}