fix: Use sortName instead of name for searches/library views (#359)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2025-06-01 15:29:38 +02:00 committed by GitHub
parent c589b9e8fc
commit a8795cf0c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 7 additions and 8 deletions

View file

@ -93,7 +93,7 @@ const _$FladderItemTypeEnumMap = {
};
const _$SortingOptionsEnumMap = {
SortingOptions.name: 'name',
SortingOptions.sortName: 'sortName',
SortingOptions.communityRating: 'communityRating',
SortingOptions.parentalRating: 'parentalRating',
SortingOptions.dateAdded: 'dateAdded',

View file

@ -77,7 +77,7 @@ class LibrarySearchModel with LibrarySearchModelMappable {
FladderItemType.video: true,
},
this.favourites = false,
this.sortingOption = SortingOptions.name,
this.sortingOption = SortingOptions.sortName,
this.sortOrder = SortingOrder.ascending,
this.hideEmptyShows = true,
this.recursive = false,

View file

@ -94,7 +94,7 @@ class LibrarySearchModelMapper extends ClassMapperBase<LibrarySearchModel> {
v.sortingOption;
static const Field<LibrarySearchModel, SortingOptions> _f$sortingOption =
Field('sortingOption', _$sortingOption,
opt: true, def: SortingOptions.name);
opt: true, def: SortingOptions.sortName);
static SortingOrder _$sortOrder(LibrarySearchModel v) => v.sortOrder;
static const Field<LibrarySearchModel, SortingOrder> _f$sortOrder =
Field('sortOrder', _$sortOrder, opt: true, def: SortingOrder.ascending);

View file

@ -6,9 +6,8 @@ import 'package:fladder/models/item_base_model.dart';
import 'package:fladder/util/localization_helper.dart';
enum SortingOptions {
name([ItemSortBy.name]),
sortName([ItemSortBy.sortname]),
communityRating([ItemSortBy.communityrating]),
// criticsRating([ItemSortBy.criticrating]),
parentalRating([ItemSortBy.officialrating]),
dateAdded([ItemSortBy.datecreated]),
dateLastContentAdded([ItemSortBy.datelastcontentadded]),
@ -23,10 +22,10 @@ enum SortingOptions {
const SortingOptions(this.value);
final List<ItemSortBy> value;
List<ItemSortBy> get toSortBy => [...value, ItemSortBy.name];
List<ItemSortBy> get toSortBy => [...value, ItemSortBy.sortname];
String label(BuildContext context) => switch (this) {
name => context.localized.name,
sortName => context.localized.name,
communityRating => context.localized.communityRating,
parentalRating => context.localized.parentalRating,
dateAdded => context.localized.dateAdded,

View file

@ -117,7 +117,7 @@ class BookDetailsProviderNotifier extends StateNotifier<BookProviderModel> {
siblingsResponse = await api.itemsGet(
parentId: parentModel.id,
recursive: true,
sortBy: SortingOptions.name.toSortBy,
sortBy: SortingOptions.sortName.toSortBy,
fields: [
ItemFields.genres,
ItemFields.parentid,