Skip to content

Commit

Permalink
Fixed locale
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgiest05 committed Jan 24, 2025
1 parent 86512b2 commit 0da881d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/components/home/sort_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import 'package:saber/pages/editor/editor.dart';
class SortNotes {
SortNotes._();

static final Map<String, void Function(List<String>, bool)> _sortFunctions = {
t.home.sortNames.alphabetical: _sortNotesAlpha,
t.home.sortNames.lastModified: _sortNotesLastModified,
t.home.sortNames.sizeOnDisk: _sortNotesSize,
};
static final List<void Function(List<String>, bool)> _sortFunctions = [
_sortNotesAlpha,
_sortNotesLastModified,
_sortNotesSize,
];
static final PlainPref<int> _sortFunctionIdx = Prefs.sortFunctionIdx;
static final PlainPref<bool> _isIncreasingOrder = Prefs.isSortIncreasing;

Expand Down Expand Up @@ -43,8 +43,7 @@ class SortNotes {

static void sortNotes(List<String> filePaths, {bool forced = false}) {
if (_isNeeded || forced) {
_sortFunctions[_sortFunctions.keys.elementAt(sortFunctionIdx)]!
.call(filePaths, isIncreasingOrder);
_sortFunctions[sortFunctionIdx].call(filePaths, isIncreasingOrder);
_isNeeded = false;
}
}
Expand Down Expand Up @@ -144,7 +143,12 @@ class _SortButtonDialog extends StatefulWidget {
class _SortButtonDialogState extends State<_SortButtonDialog> {
@override
Widget build(BuildContext context) {
final List<String> sortNames = SortNotes._sortFunctions.keys.toList();
// Needs to match the order of _sortFunctions
final List<String> sortNames = [
t.home.sortNames.alphabetical,
t.home.sortNames.lastModified,
t.home.sortNames.sizeOnDisk,
];

return Align(
alignment: Alignment.topRight,
Expand Down

0 comments on commit 0da881d

Please sign in to comment.