feat: Added option to use library posters instead of icons

This commit is contained in:
PartyDonut 2025-07-30 19:49:35 +02:00
parent a9cdd5c506
commit f0216fa799
10 changed files with 160 additions and 39 deletions

View file

@ -36,6 +36,7 @@ class ClientSettingsModel with _$ClientSettingsModel {
@Default(DynamicSchemeVariant.rainbow) DynamicSchemeVariant schemeVariant,
@Default(true) bool backgroundPosters,
@Default(true) bool checkForUpdates,
@Default(false) bool usePosterForLibrary,
String? lastViewedUpdate,
int? libraryPageSize,
}) = _ClientSettingsModel;

View file

@ -42,6 +42,7 @@ mixin _$ClientSettingsModel {
DynamicSchemeVariant get schemeVariant => throw _privateConstructorUsedError;
bool get backgroundPosters => throw _privateConstructorUsedError;
bool get checkForUpdates => throw _privateConstructorUsedError;
bool get usePosterForLibrary => throw _privateConstructorUsedError;
String? get lastViewedUpdate => throw _privateConstructorUsedError;
int? get libraryPageSize => throw _privateConstructorUsedError;
@ -83,6 +84,7 @@ abstract class $ClientSettingsModelCopyWith<$Res> {
DynamicSchemeVariant schemeVariant,
bool backgroundPosters,
bool checkForUpdates,
bool usePosterForLibrary,
String? lastViewedUpdate,
int? libraryPageSize});
}
@ -123,6 +125,7 @@ class _$ClientSettingsModelCopyWithImpl<$Res, $Val extends ClientSettingsModel>
Object? schemeVariant = null,
Object? backgroundPosters = null,
Object? checkForUpdates = null,
Object? usePosterForLibrary = null,
Object? lastViewedUpdate = freezed,
Object? libraryPageSize = freezed,
}) {
@ -211,6 +214,10 @@ class _$ClientSettingsModelCopyWithImpl<$Res, $Val extends ClientSettingsModel>
? _value.checkForUpdates
: checkForUpdates // ignore: cast_nullable_to_non_nullable
as bool,
usePosterForLibrary: null == usePosterForLibrary
? _value.usePosterForLibrary
: usePosterForLibrary // ignore: cast_nullable_to_non_nullable
as bool,
lastViewedUpdate: freezed == lastViewedUpdate
? _value.lastViewedUpdate
: lastViewedUpdate // ignore: cast_nullable_to_non_nullable
@ -253,6 +260,7 @@ abstract class _$$ClientSettingsModelImplCopyWith<$Res>
DynamicSchemeVariant schemeVariant,
bool backgroundPosters,
bool checkForUpdates,
bool usePosterForLibrary,
String? lastViewedUpdate,
int? libraryPageSize});
}
@ -291,6 +299,7 @@ class __$$ClientSettingsModelImplCopyWithImpl<$Res>
Object? schemeVariant = null,
Object? backgroundPosters = null,
Object? checkForUpdates = null,
Object? usePosterForLibrary = null,
Object? lastViewedUpdate = freezed,
Object? libraryPageSize = freezed,
}) {
@ -379,6 +388,10 @@ class __$$ClientSettingsModelImplCopyWithImpl<$Res>
? _value.checkForUpdates
: checkForUpdates // ignore: cast_nullable_to_non_nullable
as bool,
usePosterForLibrary: null == usePosterForLibrary
? _value.usePosterForLibrary
: usePosterForLibrary // ignore: cast_nullable_to_non_nullable
as bool,
lastViewedUpdate: freezed == lastViewedUpdate
? _value.lastViewedUpdate
: lastViewedUpdate // ignore: cast_nullable_to_non_nullable
@ -417,6 +430,7 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
this.schemeVariant = DynamicSchemeVariant.rainbow,
this.backgroundPosters = true,
this.checkForUpdates = true,
this.usePosterForLibrary = false,
this.lastViewedUpdate,
this.libraryPageSize})
: super._();
@ -485,13 +499,16 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
@JsonKey()
final bool checkForUpdates;
@override
@JsonKey()
final bool usePosterForLibrary;
@override
final String? lastViewedUpdate;
@override
final int? libraryPageSize;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return 'ClientSettingsModel(syncPath: $syncPath, position: $position, size: $size, timeOut: $timeOut, nextUpDateCutoff: $nextUpDateCutoff, themeMode: $themeMode, themeColor: $themeColor, amoledBlack: $amoledBlack, blurPlaceHolders: $blurPlaceHolders, blurUpcomingEpisodes: $blurUpcomingEpisodes, selectedLocale: $selectedLocale, enableMediaKeys: $enableMediaKeys, posterSize: $posterSize, pinchPosterZoom: $pinchPosterZoom, mouseDragSupport: $mouseDragSupport, requireWifi: $requireWifi, showAllCollectionTypes: $showAllCollectionTypes, maxConcurrentDownloads: $maxConcurrentDownloads, schemeVariant: $schemeVariant, backgroundPosters: $backgroundPosters, checkForUpdates: $checkForUpdates, lastViewedUpdate: $lastViewedUpdate, libraryPageSize: $libraryPageSize)';
return 'ClientSettingsModel(syncPath: $syncPath, position: $position, size: $size, timeOut: $timeOut, nextUpDateCutoff: $nextUpDateCutoff, themeMode: $themeMode, themeColor: $themeColor, amoledBlack: $amoledBlack, blurPlaceHolders: $blurPlaceHolders, blurUpcomingEpisodes: $blurUpcomingEpisodes, selectedLocale: $selectedLocale, enableMediaKeys: $enableMediaKeys, posterSize: $posterSize, pinchPosterZoom: $pinchPosterZoom, mouseDragSupport: $mouseDragSupport, requireWifi: $requireWifi, showAllCollectionTypes: $showAllCollectionTypes, maxConcurrentDownloads: $maxConcurrentDownloads, schemeVariant: $schemeVariant, backgroundPosters: $backgroundPosters, checkForUpdates: $checkForUpdates, usePosterForLibrary: $usePosterForLibrary, lastViewedUpdate: $lastViewedUpdate, libraryPageSize: $libraryPageSize)';
}
@override
@ -522,6 +539,7 @@ class _$ClientSettingsModelImpl extends _ClientSettingsModel
..add(DiagnosticsProperty('schemeVariant', schemeVariant))
..add(DiagnosticsProperty('backgroundPosters', backgroundPosters))
..add(DiagnosticsProperty('checkForUpdates', checkForUpdates))
..add(DiagnosticsProperty('usePosterForLibrary', usePosterForLibrary))
..add(DiagnosticsProperty('lastViewedUpdate', lastViewedUpdate))
..add(DiagnosticsProperty('libraryPageSize', libraryPageSize));
}
@ -566,6 +584,7 @@ abstract class _ClientSettingsModel extends ClientSettingsModel {
final DynamicSchemeVariant schemeVariant,
final bool backgroundPosters,
final bool checkForUpdates,
final bool usePosterForLibrary,
final String? lastViewedUpdate,
final int? libraryPageSize}) = _$ClientSettingsModelImpl;
_ClientSettingsModel._() : super._();
@ -617,6 +636,8 @@ abstract class _ClientSettingsModel extends ClientSettingsModel {
@override
bool get checkForUpdates;
@override
bool get usePosterForLibrary;
@override
String? get lastViewedUpdate;
@override
int? get libraryPageSize;

View file

@ -43,6 +43,7 @@ _$ClientSettingsModelImpl _$$ClientSettingsModelImplFromJson(
DynamicSchemeVariant.rainbow,
backgroundPosters: json['backgroundPosters'] as bool? ?? true,
checkForUpdates: json['checkForUpdates'] as bool? ?? true,
usePosterForLibrary: json['usePosterForLibrary'] as bool? ?? false,
lastViewedUpdate: json['lastViewedUpdate'] as String?,
libraryPageSize: (json['libraryPageSize'] as num?)?.toInt(),
);
@ -71,6 +72,7 @@ Map<String, dynamic> _$$ClientSettingsModelImplToJson(
'schemeVariant': _$DynamicSchemeVariantEnumMap[instance.schemeVariant]!,
'backgroundPosters': instance.backgroundPosters,
'checkForUpdates': instance.checkForUpdates,
'usePosterForLibrary': instance.usePosterForLibrary,
'lastViewedUpdate': instance.lastViewedUpdate,
'libraryPageSize': instance.libraryPageSize,
};

View file

@ -113,6 +113,7 @@ class ViewModel {
FutureOr Function() action, {
FutureOr Function()? onLongPress,
List<ItemAction>? trailing,
Widget? customIcon,
}) {
return NavigationButton(
label: name,
@ -121,6 +122,7 @@ class ViewModel {
onLongPress: onLongPress,
horizontal: horizontal,
expanded: expanded,
customIcon: customIcon,
trailing: trailing ?? [],
selectedIcon: Icon(collectionType.icon),
icon: Icon(collectionType.iconOutlined),