flutter_typeahead
flutter_typeahead copied to clipboard
Desktop - Arrow keys support
Is there any possible to select dropdown item by keyboard arrow down or up keys
This hasn't been -- well -- anything for Desktop support -- however, I would think arrow key support would be built into the main Desktop logic (i.e. Flutter) and not have to be dealt with in all I/O packages .. You sure there isn't something else you need to do for this in the main logic?
The built-in Autocomplete
supports arrow keys now: https://github.com/flutter/flutter/issues/82783
How about preventing keyboard up and down keys from having any effect to begin with ?
On the first touch of down key the textField below is highlighted, as a result users are confused into thinking this is a viable way to navigate through suggestions, but since next touch does nothing they try again, fail and open a bug report.
Removing up/down key events avoid misleading users who can live with scrolling or typing one extra letter.
I opened the PR https://github.com/AbdulRahmanAlHamali/flutter_typeahead/pull/435 with edits below,
KeyEventResult _onKeyEvent(FocusNode _, RawKeyEvent event) {
if (event.isKeyPressed(LogicalKeyboardKey.arrowUp) ||
event.isKeyPressed(LogicalKeyboardKey.arrowDown)) {
// do nothing to avoid puzzling users until keyboard arrow nav is implemented
} else {
_keyboardSuggestionSelectionNotifier.onKeyboardEvent(event);
}
return KeyEventResult.ignored;
}