mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: slash menu responds to multiple key events
This commit is contained in:
parent
dc09d67d7c
commit
5c099297a4
@ -324,7 +324,7 @@ class _SelectionMenuWidgetState extends State<SelectionMenuWidget> {
|
||||
_deleteLastCharacters();
|
||||
return KeyEventResult.handled;
|
||||
} else if (event.character != null &&
|
||||
!arrowKeys.contains(event.logicalKey)) {
|
||||
!arrowKeys.contains(event.logicalKey) && event.logicalKey != LogicalKeyboardKey.tab) {
|
||||
keyword += event.character!;
|
||||
_insertText(event.character!);
|
||||
return KeyEventResult.handled;
|
||||
@ -339,7 +339,18 @@ class _SelectionMenuWidgetState extends State<SelectionMenuWidget> {
|
||||
newSelectedIndex -= 1;
|
||||
} else if (event.logicalKey == LogicalKeyboardKey.arrowDown) {
|
||||
newSelectedIndex += 1;
|
||||
}else if (event.logicalKey == LogicalKeyboardKey.tab) {
|
||||
newSelectedIndex += widget.maxItemInRow;
|
||||
var currRow = (newSelectedIndex) % widget.maxItemInRow;
|
||||
if (newSelectedIndex >= _showingItems.length) {
|
||||
if (currRow + 1 >= widget.maxItemInRow) {
|
||||
newSelectedIndex = 0;
|
||||
} else {
|
||||
newSelectedIndex = (currRow + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newSelectedIndex != _selectedIndex) {
|
||||
setState(() {
|
||||
_selectedIndex = newSelectedIndex.clamp(0, _showingItems.length - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user