refactor: suggested changes

This commit is contained in:
squidrye 2023-03-21 17:38:22 +05:30
parent 5c099297a4
commit 10b6b9e5ad

View File

@ -339,15 +339,11 @@ class _SelectionMenuWidgetState extends State<SelectionMenuWidget> {
newSelectedIndex -= 1; newSelectedIndex -= 1;
} else if (event.logicalKey == LogicalKeyboardKey.arrowDown) { } else if (event.logicalKey == LogicalKeyboardKey.arrowDown) {
newSelectedIndex += 1; newSelectedIndex += 1;
}else if (event.logicalKey == LogicalKeyboardKey.tab) { } else if (event.logicalKey == LogicalKeyboardKey.tab) {
newSelectedIndex += widget.maxItemInRow; newSelectedIndex += widget.maxItemInRow;
var currRow = (newSelectedIndex) % widget.maxItemInRow; var currRow = (newSelectedIndex) % widget.maxItemInRow;
if (newSelectedIndex >= _showingItems.length) { if (newSelectedIndex >= _showingItems.length) {
if (currRow + 1 >= widget.maxItemInRow) { newSelectedIndex = (currRow + 1) % widget.maxItemInRow;
newSelectedIndex = 0;
} else {
newSelectedIndex = (currRow + 1);
}
} }
} }