Skip to content

Commit

Permalink
Ensure keys are sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
amake committed Jan 28, 2024
1 parent 8cb3f62 commit 02a746d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/src/actions/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ class _SearchResultsNavigationState extends State<SearchResultsNavigation> {
if (!mounted) return;
final keys = _controller.searchResultKeys.value;
if (_count != keys.length) {
final i = keys.indexWhere((key) => key.currentState?.selected == true);
final sortedKeys = List.of(keys)..sort((a, b) => a.compareByTopBound(b));
final i =
sortedKeys.indexWhere((key) => key.currentState?.selected == true);
setState(() {
_i = i;
_count = keys.length;
_count = sortedKeys.length;
});
}
}
Expand Down

0 comments on commit 02a746d

Please sign in to comment.