mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
feat: Improve library search screen (#477)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
571b682b80
commit
d22d340181
41 changed files with 2881 additions and 2026 deletions
|
|
@ -31,7 +31,7 @@ abstract class AccountModel with _$AccountModel {
|
|||
@Default([]) List<String> latestItemsExcludes,
|
||||
@Default([]) List<String> searchQueryHistory,
|
||||
@Default(false) bool quickConnectState,
|
||||
@Default([]) List<LibraryFiltersModel> savedFilters,
|
||||
@Default([]) List<LibraryFiltersModel> libraryFilters,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false) UserPolicy? policy,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false) ServerConfiguration? serverConfiguration,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false) UserConfiguration? userConfiguration,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ mixin _$AccountModel implements DiagnosticableTreeMixin {
|
|||
List<String> get latestItemsExcludes;
|
||||
List<String> get searchQueryHistory;
|
||||
bool get quickConnectState;
|
||||
List<LibraryFiltersModel> get savedFilters;
|
||||
List<LibraryFiltersModel> get libraryFilters;
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
UserPolicy? get policy;
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
|
|
@ -58,7 +58,7 @@ mixin _$AccountModel implements DiagnosticableTreeMixin {
|
|||
..add(DiagnosticsProperty('latestItemsExcludes', latestItemsExcludes))
|
||||
..add(DiagnosticsProperty('searchQueryHistory', searchQueryHistory))
|
||||
..add(DiagnosticsProperty('quickConnectState', quickConnectState))
|
||||
..add(DiagnosticsProperty('savedFilters', savedFilters))
|
||||
..add(DiagnosticsProperty('libraryFilters', libraryFilters))
|
||||
..add(DiagnosticsProperty('policy', policy))
|
||||
..add(DiagnosticsProperty('serverConfiguration', serverConfiguration))
|
||||
..add(DiagnosticsProperty('userConfiguration', userConfiguration))
|
||||
|
|
@ -67,7 +67,7 @@ mixin _$AccountModel implements DiagnosticableTreeMixin {
|
|||
|
||||
@override
|
||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
||||
return 'AccountModel(name: $name, id: $id, avatar: $avatar, lastUsed: $lastUsed, authMethod: $authMethod, localPin: $localPin, credentials: $credentials, latestItemsExcludes: $latestItemsExcludes, searchQueryHistory: $searchQueryHistory, quickConnectState: $quickConnectState, savedFilters: $savedFilters, policy: $policy, serverConfiguration: $serverConfiguration, userConfiguration: $userConfiguration, userSettings: $userSettings)';
|
||||
return 'AccountModel(name: $name, id: $id, avatar: $avatar, lastUsed: $lastUsed, authMethod: $authMethod, localPin: $localPin, credentials: $credentials, latestItemsExcludes: $latestItemsExcludes, searchQueryHistory: $searchQueryHistory, quickConnectState: $quickConnectState, libraryFilters: $libraryFilters, policy: $policy, serverConfiguration: $serverConfiguration, userConfiguration: $userConfiguration, userSettings: $userSettings)';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ abstract mixin class $AccountModelCopyWith<$Res> {
|
|||
List<String> latestItemsExcludes,
|
||||
List<String> searchQueryHistory,
|
||||
bool quickConnectState,
|
||||
List<LibraryFiltersModel> savedFilters,
|
||||
List<LibraryFiltersModel> libraryFilters,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false) UserPolicy? policy,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
ServerConfiguration? serverConfiguration,
|
||||
|
|
@ -121,7 +121,7 @@ class _$AccountModelCopyWithImpl<$Res> implements $AccountModelCopyWith<$Res> {
|
|||
Object? latestItemsExcludes = null,
|
||||
Object? searchQueryHistory = null,
|
||||
Object? quickConnectState = null,
|
||||
Object? savedFilters = null,
|
||||
Object? libraryFilters = null,
|
||||
Object? policy = freezed,
|
||||
Object? serverConfiguration = freezed,
|
||||
Object? userConfiguration = freezed,
|
||||
|
|
@ -168,9 +168,9 @@ class _$AccountModelCopyWithImpl<$Res> implements $AccountModelCopyWith<$Res> {
|
|||
? _self.quickConnectState
|
||||
: quickConnectState // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
savedFilters: null == savedFilters
|
||||
? _self.savedFilters
|
||||
: savedFilters // ignore: cast_nullable_to_non_nullable
|
||||
libraryFilters: null == libraryFilters
|
||||
? _self.libraryFilters
|
||||
: libraryFilters // ignore: cast_nullable_to_non_nullable
|
||||
as List<LibraryFiltersModel>,
|
||||
policy: freezed == policy
|
||||
? _self.policy
|
||||
|
|
@ -310,7 +310,7 @@ extension AccountModelPatterns on AccountModel {
|
|||
List<String> latestItemsExcludes,
|
||||
List<String> searchQueryHistory,
|
||||
bool quickConnectState,
|
||||
List<LibraryFiltersModel> savedFilters,
|
||||
List<LibraryFiltersModel> libraryFilters,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
UserPolicy? policy,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
|
|
@ -335,7 +335,7 @@ extension AccountModelPatterns on AccountModel {
|
|||
_that.latestItemsExcludes,
|
||||
_that.searchQueryHistory,
|
||||
_that.quickConnectState,
|
||||
_that.savedFilters,
|
||||
_that.libraryFilters,
|
||||
_that.policy,
|
||||
_that.serverConfiguration,
|
||||
_that.userConfiguration,
|
||||
|
|
@ -371,7 +371,7 @@ extension AccountModelPatterns on AccountModel {
|
|||
List<String> latestItemsExcludes,
|
||||
List<String> searchQueryHistory,
|
||||
bool quickConnectState,
|
||||
List<LibraryFiltersModel> savedFilters,
|
||||
List<LibraryFiltersModel> libraryFilters,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
UserPolicy? policy,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
|
|
@ -395,7 +395,7 @@ extension AccountModelPatterns on AccountModel {
|
|||
_that.latestItemsExcludes,
|
||||
_that.searchQueryHistory,
|
||||
_that.quickConnectState,
|
||||
_that.savedFilters,
|
||||
_that.libraryFilters,
|
||||
_that.policy,
|
||||
_that.serverConfiguration,
|
||||
_that.userConfiguration,
|
||||
|
|
@ -430,7 +430,7 @@ extension AccountModelPatterns on AccountModel {
|
|||
List<String> latestItemsExcludes,
|
||||
List<String> searchQueryHistory,
|
||||
bool quickConnectState,
|
||||
List<LibraryFiltersModel> savedFilters,
|
||||
List<LibraryFiltersModel> libraryFilters,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
UserPolicy? policy,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
|
|
@ -454,7 +454,7 @@ extension AccountModelPatterns on AccountModel {
|
|||
_that.latestItemsExcludes,
|
||||
_that.searchQueryHistory,
|
||||
_that.quickConnectState,
|
||||
_that.savedFilters,
|
||||
_that.libraryFilters,
|
||||
_that.policy,
|
||||
_that.serverConfiguration,
|
||||
_that.userConfiguration,
|
||||
|
|
@ -479,7 +479,7 @@ class _AccountModel extends AccountModel with DiagnosticableTreeMixin {
|
|||
final List<String> latestItemsExcludes = const [],
|
||||
final List<String> searchQueryHistory = const [],
|
||||
this.quickConnectState = false,
|
||||
final List<LibraryFiltersModel> savedFilters = const [],
|
||||
final List<LibraryFiltersModel> libraryFilters = const [],
|
||||
@JsonKey(includeFromJson: false, includeToJson: false) this.policy,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
this.serverConfiguration,
|
||||
|
|
@ -488,7 +488,7 @@ class _AccountModel extends AccountModel with DiagnosticableTreeMixin {
|
|||
this.userSettings})
|
||||
: _latestItemsExcludes = latestItemsExcludes,
|
||||
_searchQueryHistory = searchQueryHistory,
|
||||
_savedFilters = savedFilters,
|
||||
_libraryFilters = libraryFilters,
|
||||
super._();
|
||||
factory _AccountModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$AccountModelFromJson(json);
|
||||
|
|
@ -532,13 +532,13 @@ class _AccountModel extends AccountModel with DiagnosticableTreeMixin {
|
|||
@override
|
||||
@JsonKey()
|
||||
final bool quickConnectState;
|
||||
final List<LibraryFiltersModel> _savedFilters;
|
||||
final List<LibraryFiltersModel> _libraryFilters;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<LibraryFiltersModel> get savedFilters {
|
||||
if (_savedFilters is EqualUnmodifiableListView) return _savedFilters;
|
||||
List<LibraryFiltersModel> get libraryFilters {
|
||||
if (_libraryFilters is EqualUnmodifiableListView) return _libraryFilters;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_savedFilters);
|
||||
return EqualUnmodifiableListView(_libraryFilters);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -582,7 +582,7 @@ class _AccountModel extends AccountModel with DiagnosticableTreeMixin {
|
|||
..add(DiagnosticsProperty('latestItemsExcludes', latestItemsExcludes))
|
||||
..add(DiagnosticsProperty('searchQueryHistory', searchQueryHistory))
|
||||
..add(DiagnosticsProperty('quickConnectState', quickConnectState))
|
||||
..add(DiagnosticsProperty('savedFilters', savedFilters))
|
||||
..add(DiagnosticsProperty('libraryFilters', libraryFilters))
|
||||
..add(DiagnosticsProperty('policy', policy))
|
||||
..add(DiagnosticsProperty('serverConfiguration', serverConfiguration))
|
||||
..add(DiagnosticsProperty('userConfiguration', userConfiguration))
|
||||
|
|
@ -591,7 +591,7 @@ class _AccountModel extends AccountModel with DiagnosticableTreeMixin {
|
|||
|
||||
@override
|
||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
||||
return 'AccountModel(name: $name, id: $id, avatar: $avatar, lastUsed: $lastUsed, authMethod: $authMethod, localPin: $localPin, credentials: $credentials, latestItemsExcludes: $latestItemsExcludes, searchQueryHistory: $searchQueryHistory, quickConnectState: $quickConnectState, savedFilters: $savedFilters, policy: $policy, serverConfiguration: $serverConfiguration, userConfiguration: $userConfiguration, userSettings: $userSettings)';
|
||||
return 'AccountModel(name: $name, id: $id, avatar: $avatar, lastUsed: $lastUsed, authMethod: $authMethod, localPin: $localPin, credentials: $credentials, latestItemsExcludes: $latestItemsExcludes, searchQueryHistory: $searchQueryHistory, quickConnectState: $quickConnectState, libraryFilters: $libraryFilters, policy: $policy, serverConfiguration: $serverConfiguration, userConfiguration: $userConfiguration, userSettings: $userSettings)';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -614,7 +614,7 @@ abstract mixin class _$AccountModelCopyWith<$Res>
|
|||
List<String> latestItemsExcludes,
|
||||
List<String> searchQueryHistory,
|
||||
bool quickConnectState,
|
||||
List<LibraryFiltersModel> savedFilters,
|
||||
List<LibraryFiltersModel> libraryFilters,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false) UserPolicy? policy,
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
ServerConfiguration? serverConfiguration,
|
||||
|
|
@ -649,7 +649,7 @@ class __$AccountModelCopyWithImpl<$Res>
|
|||
Object? latestItemsExcludes = null,
|
||||
Object? searchQueryHistory = null,
|
||||
Object? quickConnectState = null,
|
||||
Object? savedFilters = null,
|
||||
Object? libraryFilters = null,
|
||||
Object? policy = freezed,
|
||||
Object? serverConfiguration = freezed,
|
||||
Object? userConfiguration = freezed,
|
||||
|
|
@ -696,9 +696,9 @@ class __$AccountModelCopyWithImpl<$Res>
|
|||
? _self.quickConnectState
|
||||
: quickConnectState // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
savedFilters: null == savedFilters
|
||||
? _self._savedFilters
|
||||
: savedFilters // ignore: cast_nullable_to_non_nullable
|
||||
libraryFilters: null == libraryFilters
|
||||
? _self._libraryFilters
|
||||
: libraryFilters // ignore: cast_nullable_to_non_nullable
|
||||
as List<LibraryFiltersModel>,
|
||||
policy: freezed == policy
|
||||
? _self.policy
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ _AccountModel _$AccountModelFromJson(Map<String, dynamic> json) =>
|
|||
.toList() ??
|
||||
const [],
|
||||
quickConnectState: json['quickConnectState'] as bool? ?? false,
|
||||
savedFilters: (json['savedFilters'] as List<dynamic>?)
|
||||
libraryFilters: (json['libraryFilters'] as List<dynamic>?)
|
||||
?.map((e) =>
|
||||
LibraryFiltersModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList() ??
|
||||
|
|
@ -48,7 +48,7 @@ Map<String, dynamic> _$AccountModelToJson(_AccountModel instance) =>
|
|||
'latestItemsExcludes': instance.latestItemsExcludes,
|
||||
'searchQueryHistory': instance.searchQueryHistory,
|
||||
'quickConnectState': instance.quickConnectState,
|
||||
'savedFilters': instance.savedFilters,
|
||||
'libraryFilters': instance.libraryFilters,
|
||||
'userSettings': instance.userSettings,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ extension CollectionTypeExtension on CollectionType {
|
|||
}
|
||||
}
|
||||
|
||||
bool get searchRecursive => switch (this) {
|
||||
CollectionType.homevideos || CollectionType.photos => false,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
IconData getIconType(bool outlined) {
|
||||
switch (this) {
|
||||
case CollectionType.music:
|
||||
|
|
|
|||
163
lib/models/library_filter_model.dart
Normal file
163
lib/models/library_filter_model.dart
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.enums.swagger.dart';
|
||||
import 'package:fladder/models/item_base_model.dart';
|
||||
import 'package:fladder/models/items/item_shared_models.dart';
|
||||
import 'package:fladder/models/library_search/library_search_options.dart';
|
||||
import 'package:fladder/routes/auto_router.gr.dart';
|
||||
import 'package:fladder/util/map_bool_helper.dart';
|
||||
|
||||
part 'library_filter_model.freezed.dart';
|
||||
part 'library_filter_model.g.dart';
|
||||
|
||||
@Freezed(copyWith: true)
|
||||
abstract class LibraryFilterModel with _$LibraryFilterModel {
|
||||
const LibraryFilterModel._();
|
||||
|
||||
const factory LibraryFilterModel({
|
||||
@Default({}) Map<String, bool> genres,
|
||||
@Default({
|
||||
ItemFilter.isplayed: false,
|
||||
ItemFilter.isunplayed: false,
|
||||
ItemFilter.isresumable: false,
|
||||
})
|
||||
@Default({})
|
||||
Map<ItemFilter, bool> itemFilters,
|
||||
@StudioEncoder() @Default({}) Map<Studio, bool> studios,
|
||||
@Default({}) Map<String, bool> tags,
|
||||
@Default({}) Map<int, bool> years,
|
||||
@Default({}) Map<String, bool> officialRatings,
|
||||
@Default({
|
||||
FladderItemType.audio: false,
|
||||
FladderItemType.boxset: false,
|
||||
FladderItemType.book: false,
|
||||
FladderItemType.collectionFolder: false,
|
||||
FladderItemType.episode: false,
|
||||
FladderItemType.folder: false,
|
||||
FladderItemType.movie: false,
|
||||
FladderItemType.musicAlbum: false,
|
||||
FladderItemType.musicVideo: false,
|
||||
FladderItemType.photo: false,
|
||||
FladderItemType.person: false,
|
||||
FladderItemType.photoAlbum: false,
|
||||
FladderItemType.series: false,
|
||||
FladderItemType.video: false,
|
||||
})
|
||||
Map<FladderItemType, bool> types,
|
||||
@Default(SortingOptions.sortName) SortingOptions sortingOption,
|
||||
@Default(SortingOrder.ascending) SortingOrder sortOrder,
|
||||
@Default(false) bool favourites,
|
||||
@Default(true) bool hideEmptyShows,
|
||||
@Default(true) bool recursive,
|
||||
@Default(GroupBy.none) GroupBy groupBy,
|
||||
}) = _LibraryFilterModel;
|
||||
|
||||
bool get hasActiveFilters {
|
||||
return genres.hasEnabled ||
|
||||
studios.hasEnabled ||
|
||||
tags.hasEnabled ||
|
||||
years.hasEnabled ||
|
||||
officialRatings.hasEnabled ||
|
||||
hideEmptyShows ||
|
||||
itemFilters.hasEnabled ||
|
||||
!recursive ||
|
||||
favourites;
|
||||
}
|
||||
|
||||
LibraryFilterModel loadModel(LibraryFilterModel model) {
|
||||
return copyWith(
|
||||
genres: genres.replaceMap(model.genres),
|
||||
itemFilters: itemFilters.replaceMap(model.itemFilters),
|
||||
studios: studios.replaceMap(model.studios),
|
||||
tags: tags.replaceMap(model.tags),
|
||||
years: years.replaceMap(model.years),
|
||||
officialRatings: officialRatings.replaceMap(model.officialRatings),
|
||||
types: types.replaceMap(model.types),
|
||||
sortingOption: model.sortingOption,
|
||||
sortOrder: model.sortOrder,
|
||||
favourites: model.favourites,
|
||||
hideEmptyShows: model.hideEmptyShows,
|
||||
recursive: model.recursive,
|
||||
groupBy: model.groupBy,
|
||||
);
|
||||
}
|
||||
|
||||
factory LibraryFilterModel.fromJson(Map<String, dynamic> json) => _$LibraryFilterModelFromJson(json);
|
||||
|
||||
@override
|
||||
bool operator ==(covariant LibraryFilterModel other) {
|
||||
if (identical(this, other)) return true;
|
||||
return mapEquals(other.genres, genres) &&
|
||||
mapEquals(other.studios, studios) &&
|
||||
mapEquals(other.tags, tags) &&
|
||||
mapEquals(other.years, years) &&
|
||||
mapEquals(other.officialRatings, officialRatings) &&
|
||||
mapEquals(other.types, types) &&
|
||||
other.sortingOption == sortingOption &&
|
||||
other.sortOrder == sortOrder &&
|
||||
other.favourites == favourites &&
|
||||
other.recursive == recursive;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return itemFilters.hashCode ^
|
||||
genres.hashCode ^
|
||||
studios.hashCode ^
|
||||
tags.hashCode ^
|
||||
years.hashCode ^
|
||||
officialRatings.hashCode ^
|
||||
types.hashCode ^
|
||||
sortingOption.hashCode ^
|
||||
sortOrder.hashCode ^
|
||||
favourites.hashCode ^
|
||||
recursive.hashCode;
|
||||
}
|
||||
|
||||
LibraryFilterModel clear() {
|
||||
return copyWith(
|
||||
genres: genres.setAll(false),
|
||||
tags: tags.setAll(false),
|
||||
officialRatings: officialRatings.setAll(false),
|
||||
years: years.setAll(false),
|
||||
favourites: false,
|
||||
recursive: true,
|
||||
studios: studios.setAll(false),
|
||||
itemFilters: itemFilters.setAll(false),
|
||||
hideEmptyShows: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StudioEncoder implements JsonConverter<Map<Studio, bool>, String> {
|
||||
const StudioEncoder();
|
||||
|
||||
@override
|
||||
Map<Studio, bool> fromJson(String json) {
|
||||
final decodedMap = jsonDecode(json) as Map<dynamic, dynamic>;
|
||||
final studios = decodedMap.map((key, value) => MapEntry(Studio.fromJson(key), value as bool));
|
||||
return studios;
|
||||
}
|
||||
|
||||
@override
|
||||
String toJson(Map<Studio, bool> studios) => jsonEncode(studios.map((key, value) => MapEntry(key.toJson(), value)));
|
||||
}
|
||||
|
||||
extension LibrarySearchRouteExtension on LibrarySearchRoute {
|
||||
LibrarySearchRoute withFilter(LibraryFilterModel model) {
|
||||
return LibrarySearchRoute(
|
||||
viewModelId: args?.viewModelId,
|
||||
folderId: args?.folderId,
|
||||
favourites: model.favourites,
|
||||
sortOrder: model.sortOrder,
|
||||
sortingOptions: model.sortingOption,
|
||||
types: model.types,
|
||||
genres: model.genres,
|
||||
recursive: model.recursive,
|
||||
);
|
||||
}
|
||||
}
|
||||
691
lib/models/library_filter_model.freezed.dart
Normal file
691
lib/models/library_filter_model.freezed.dart
Normal file
|
|
@ -0,0 +1,691 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'library_filter_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LibraryFilterModel implements DiagnosticableTreeMixin {
|
||||
Map<String, bool> get genres;
|
||||
Map<ItemFilter, bool> get itemFilters;
|
||||
@StudioEncoder()
|
||||
Map<Studio, bool> get studios;
|
||||
Map<String, bool> get tags;
|
||||
Map<int, bool> get years;
|
||||
Map<String, bool> get officialRatings;
|
||||
Map<FladderItemType, bool> get types;
|
||||
SortingOptions get sortingOption;
|
||||
SortingOrder get sortOrder;
|
||||
bool get favourites;
|
||||
bool get hideEmptyShows;
|
||||
bool get recursive;
|
||||
GroupBy get groupBy;
|
||||
|
||||
/// Create a copy of LibraryFilterModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$LibraryFilterModelCopyWith<LibraryFilterModel> get copyWith =>
|
||||
_$LibraryFilterModelCopyWithImpl<LibraryFilterModel>(
|
||||
this as LibraryFilterModel, _$identity);
|
||||
|
||||
/// Serializes this LibraryFilterModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'LibraryFilterModel'))
|
||||
..add(DiagnosticsProperty('genres', genres))
|
||||
..add(DiagnosticsProperty('itemFilters', itemFilters))
|
||||
..add(DiagnosticsProperty('studios', studios))
|
||||
..add(DiagnosticsProperty('tags', tags))
|
||||
..add(DiagnosticsProperty('years', years))
|
||||
..add(DiagnosticsProperty('officialRatings', officialRatings))
|
||||
..add(DiagnosticsProperty('types', types))
|
||||
..add(DiagnosticsProperty('sortingOption', sortingOption))
|
||||
..add(DiagnosticsProperty('sortOrder', sortOrder))
|
||||
..add(DiagnosticsProperty('favourites', favourites))
|
||||
..add(DiagnosticsProperty('hideEmptyShows', hideEmptyShows))
|
||||
..add(DiagnosticsProperty('recursive', recursive))
|
||||
..add(DiagnosticsProperty('groupBy', groupBy));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
||||
return 'LibraryFilterModel(genres: $genres, itemFilters: $itemFilters, studios: $studios, tags: $tags, years: $years, officialRatings: $officialRatings, types: $types, sortingOption: $sortingOption, sortOrder: $sortOrder, favourites: $favourites, hideEmptyShows: $hideEmptyShows, recursive: $recursive, groupBy: $groupBy)';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $LibraryFilterModelCopyWith<$Res> {
|
||||
factory $LibraryFilterModelCopyWith(
|
||||
LibraryFilterModel value, $Res Function(LibraryFilterModel) _then) =
|
||||
_$LibraryFilterModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call(
|
||||
{Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> itemFilters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LibraryFilterModelCopyWithImpl<$Res>
|
||||
implements $LibraryFilterModelCopyWith<$Res> {
|
||||
_$LibraryFilterModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final LibraryFilterModel _self;
|
||||
final $Res Function(LibraryFilterModel) _then;
|
||||
|
||||
/// Create a copy of LibraryFilterModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? genres = null,
|
||||
Object? itemFilters = null,
|
||||
Object? studios = null,
|
||||
Object? tags = null,
|
||||
Object? years = null,
|
||||
Object? officialRatings = null,
|
||||
Object? types = null,
|
||||
Object? sortingOption = null,
|
||||
Object? sortOrder = null,
|
||||
Object? favourites = null,
|
||||
Object? hideEmptyShows = null,
|
||||
Object? recursive = null,
|
||||
Object? groupBy = null,
|
||||
}) {
|
||||
return _then(_self.copyWith(
|
||||
genres: null == genres
|
||||
? _self.genres
|
||||
: genres // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
itemFilters: null == itemFilters
|
||||
? _self.itemFilters
|
||||
: itemFilters // ignore: cast_nullable_to_non_nullable
|
||||
as Map<ItemFilter, bool>,
|
||||
studios: null == studios
|
||||
? _self.studios
|
||||
: studios // ignore: cast_nullable_to_non_nullable
|
||||
as Map<Studio, bool>,
|
||||
tags: null == tags
|
||||
? _self.tags
|
||||
: tags // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
years: null == years
|
||||
? _self.years
|
||||
: years // ignore: cast_nullable_to_non_nullable
|
||||
as Map<int, bool>,
|
||||
officialRatings: null == officialRatings
|
||||
? _self.officialRatings
|
||||
: officialRatings // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
types: null == types
|
||||
? _self.types
|
||||
: types // ignore: cast_nullable_to_non_nullable
|
||||
as Map<FladderItemType, bool>,
|
||||
sortingOption: null == sortingOption
|
||||
? _self.sortingOption
|
||||
: sortingOption // ignore: cast_nullable_to_non_nullable
|
||||
as SortingOptions,
|
||||
sortOrder: null == sortOrder
|
||||
? _self.sortOrder
|
||||
: sortOrder // ignore: cast_nullable_to_non_nullable
|
||||
as SortingOrder,
|
||||
favourites: null == favourites
|
||||
? _self.favourites
|
||||
: favourites // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
hideEmptyShows: null == hideEmptyShows
|
||||
? _self.hideEmptyShows
|
||||
: hideEmptyShows // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
recursive: null == recursive
|
||||
? _self.recursive
|
||||
: recursive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
groupBy: null == groupBy
|
||||
? _self.groupBy
|
||||
: groupBy // ignore: cast_nullable_to_non_nullable
|
||||
as GroupBy,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [LibraryFilterModel].
|
||||
extension LibraryFilterModelPatterns on LibraryFilterModel {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_LibraryFilterModel value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibraryFilterModel() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_LibraryFilterModel value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibraryFilterModel():
|
||||
return $default(_that);
|
||||
case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_LibraryFilterModel value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibraryFilterModel() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(
|
||||
Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> itemFilters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy)?
|
||||
$default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibraryFilterModel() when $default != null:
|
||||
return $default(
|
||||
_that.genres,
|
||||
_that.itemFilters,
|
||||
_that.studios,
|
||||
_that.tags,
|
||||
_that.years,
|
||||
_that.officialRatings,
|
||||
_that.types,
|
||||
_that.sortingOption,
|
||||
_that.sortOrder,
|
||||
_that.favourites,
|
||||
_that.hideEmptyShows,
|
||||
_that.recursive,
|
||||
_that.groupBy);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(
|
||||
Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> itemFilters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy)
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibraryFilterModel():
|
||||
return $default(
|
||||
_that.genres,
|
||||
_that.itemFilters,
|
||||
_that.studios,
|
||||
_that.tags,
|
||||
_that.years,
|
||||
_that.officialRatings,
|
||||
_that.types,
|
||||
_that.sortingOption,
|
||||
_that.sortOrder,
|
||||
_that.favourites,
|
||||
_that.hideEmptyShows,
|
||||
_that.recursive,
|
||||
_that.groupBy);
|
||||
case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(
|
||||
Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> itemFilters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy)?
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibraryFilterModel() when $default != null:
|
||||
return $default(
|
||||
_that.genres,
|
||||
_that.itemFilters,
|
||||
_that.studios,
|
||||
_that.tags,
|
||||
_that.years,
|
||||
_that.officialRatings,
|
||||
_that.types,
|
||||
_that.sortingOption,
|
||||
_that.sortOrder,
|
||||
_that.favourites,
|
||||
_that.hideEmptyShows,
|
||||
_that.recursive,
|
||||
_that.groupBy);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _LibraryFilterModel extends LibraryFilterModel
|
||||
with DiagnosticableTreeMixin {
|
||||
const _LibraryFilterModel(
|
||||
{final Map<String, bool> genres = const {},
|
||||
final Map<ItemFilter, bool> itemFilters = const {
|
||||
ItemFilter.isplayed: false,
|
||||
ItemFilter.isunplayed: false,
|
||||
ItemFilter.isresumable: false
|
||||
},
|
||||
@StudioEncoder() final Map<Studio, bool> studios = const {},
|
||||
final Map<String, bool> tags = const {},
|
||||
final Map<int, bool> years = const {},
|
||||
final Map<String, bool> officialRatings = const {},
|
||||
final Map<FladderItemType, bool> types = const {
|
||||
FladderItemType.audio: false,
|
||||
FladderItemType.boxset: false,
|
||||
FladderItemType.book: false,
|
||||
FladderItemType.collectionFolder: false,
|
||||
FladderItemType.episode: false,
|
||||
FladderItemType.folder: false,
|
||||
FladderItemType.movie: false,
|
||||
FladderItemType.musicAlbum: false,
|
||||
FladderItemType.musicVideo: false,
|
||||
FladderItemType.photo: false,
|
||||
FladderItemType.person: false,
|
||||
FladderItemType.photoAlbum: false,
|
||||
FladderItemType.series: false,
|
||||
FladderItemType.video: false
|
||||
},
|
||||
this.sortingOption = SortingOptions.sortName,
|
||||
this.sortOrder = SortingOrder.ascending,
|
||||
this.favourites = false,
|
||||
this.hideEmptyShows = true,
|
||||
this.recursive = true,
|
||||
this.groupBy = GroupBy.none})
|
||||
: _genres = genres,
|
||||
_itemFilters = itemFilters,
|
||||
_studios = studios,
|
||||
_tags = tags,
|
||||
_years = years,
|
||||
_officialRatings = officialRatings,
|
||||
_types = types,
|
||||
super._();
|
||||
factory _LibraryFilterModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$LibraryFilterModelFromJson(json);
|
||||
|
||||
final Map<String, bool> _genres;
|
||||
@override
|
||||
@JsonKey()
|
||||
Map<String, bool> get genres {
|
||||
if (_genres is EqualUnmodifiableMapView) return _genres;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_genres);
|
||||
}
|
||||
|
||||
final Map<ItemFilter, bool> _itemFilters;
|
||||
@override
|
||||
@JsonKey()
|
||||
Map<ItemFilter, bool> get itemFilters {
|
||||
if (_itemFilters is EqualUnmodifiableMapView) return _itemFilters;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_itemFilters);
|
||||
}
|
||||
|
||||
final Map<Studio, bool> _studios;
|
||||
@override
|
||||
@JsonKey()
|
||||
@StudioEncoder()
|
||||
Map<Studio, bool> get studios {
|
||||
if (_studios is EqualUnmodifiableMapView) return _studios;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_studios);
|
||||
}
|
||||
|
||||
final Map<String, bool> _tags;
|
||||
@override
|
||||
@JsonKey()
|
||||
Map<String, bool> get tags {
|
||||
if (_tags is EqualUnmodifiableMapView) return _tags;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_tags);
|
||||
}
|
||||
|
||||
final Map<int, bool> _years;
|
||||
@override
|
||||
@JsonKey()
|
||||
Map<int, bool> get years {
|
||||
if (_years is EqualUnmodifiableMapView) return _years;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_years);
|
||||
}
|
||||
|
||||
final Map<String, bool> _officialRatings;
|
||||
@override
|
||||
@JsonKey()
|
||||
Map<String, bool> get officialRatings {
|
||||
if (_officialRatings is EqualUnmodifiableMapView) return _officialRatings;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_officialRatings);
|
||||
}
|
||||
|
||||
final Map<FladderItemType, bool> _types;
|
||||
@override
|
||||
@JsonKey()
|
||||
Map<FladderItemType, bool> get types {
|
||||
if (_types is EqualUnmodifiableMapView) return _types;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_types);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final SortingOptions sortingOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final SortingOrder sortOrder;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool favourites;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool hideEmptyShows;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool recursive;
|
||||
@override
|
||||
@JsonKey()
|
||||
final GroupBy groupBy;
|
||||
|
||||
/// Create a copy of LibraryFilterModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LibraryFilterModelCopyWith<_LibraryFilterModel> get copyWith =>
|
||||
__$LibraryFilterModelCopyWithImpl<_LibraryFilterModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$LibraryFilterModelToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'LibraryFilterModel'))
|
||||
..add(DiagnosticsProperty('genres', genres))
|
||||
..add(DiagnosticsProperty('itemFilters', itemFilters))
|
||||
..add(DiagnosticsProperty('studios', studios))
|
||||
..add(DiagnosticsProperty('tags', tags))
|
||||
..add(DiagnosticsProperty('years', years))
|
||||
..add(DiagnosticsProperty('officialRatings', officialRatings))
|
||||
..add(DiagnosticsProperty('types', types))
|
||||
..add(DiagnosticsProperty('sortingOption', sortingOption))
|
||||
..add(DiagnosticsProperty('sortOrder', sortOrder))
|
||||
..add(DiagnosticsProperty('favourites', favourites))
|
||||
..add(DiagnosticsProperty('hideEmptyShows', hideEmptyShows))
|
||||
..add(DiagnosticsProperty('recursive', recursive))
|
||||
..add(DiagnosticsProperty('groupBy', groupBy));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
||||
return 'LibraryFilterModel(genres: $genres, itemFilters: $itemFilters, studios: $studios, tags: $tags, years: $years, officialRatings: $officialRatings, types: $types, sortingOption: $sortingOption, sortOrder: $sortOrder, favourites: $favourites, hideEmptyShows: $hideEmptyShows, recursive: $recursive, groupBy: $groupBy)';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LibraryFilterModelCopyWith<$Res>
|
||||
implements $LibraryFilterModelCopyWith<$Res> {
|
||||
factory _$LibraryFilterModelCopyWith(
|
||||
_LibraryFilterModel value, $Res Function(_LibraryFilterModel) _then) =
|
||||
__$LibraryFilterModelCopyWithImpl;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> itemFilters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$LibraryFilterModelCopyWithImpl<$Res>
|
||||
implements _$LibraryFilterModelCopyWith<$Res> {
|
||||
__$LibraryFilterModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _LibraryFilterModel _self;
|
||||
final $Res Function(_LibraryFilterModel) _then;
|
||||
|
||||
/// Create a copy of LibraryFilterModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$Res call({
|
||||
Object? genres = null,
|
||||
Object? itemFilters = null,
|
||||
Object? studios = null,
|
||||
Object? tags = null,
|
||||
Object? years = null,
|
||||
Object? officialRatings = null,
|
||||
Object? types = null,
|
||||
Object? sortingOption = null,
|
||||
Object? sortOrder = null,
|
||||
Object? favourites = null,
|
||||
Object? hideEmptyShows = null,
|
||||
Object? recursive = null,
|
||||
Object? groupBy = null,
|
||||
}) {
|
||||
return _then(_LibraryFilterModel(
|
||||
genres: null == genres
|
||||
? _self._genres
|
||||
: genres // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
itemFilters: null == itemFilters
|
||||
? _self._itemFilters
|
||||
: itemFilters // ignore: cast_nullable_to_non_nullable
|
||||
as Map<ItemFilter, bool>,
|
||||
studios: null == studios
|
||||
? _self._studios
|
||||
: studios // ignore: cast_nullable_to_non_nullable
|
||||
as Map<Studio, bool>,
|
||||
tags: null == tags
|
||||
? _self._tags
|
||||
: tags // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
years: null == years
|
||||
? _self._years
|
||||
: years // ignore: cast_nullable_to_non_nullable
|
||||
as Map<int, bool>,
|
||||
officialRatings: null == officialRatings
|
||||
? _self._officialRatings
|
||||
: officialRatings // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
types: null == types
|
||||
? _self._types
|
||||
: types // ignore: cast_nullable_to_non_nullable
|
||||
as Map<FladderItemType, bool>,
|
||||
sortingOption: null == sortingOption
|
||||
? _self.sortingOption
|
||||
: sortingOption // ignore: cast_nullable_to_non_nullable
|
||||
as SortingOptions,
|
||||
sortOrder: null == sortOrder
|
||||
? _self.sortOrder
|
||||
: sortOrder // ignore: cast_nullable_to_non_nullable
|
||||
as SortingOrder,
|
||||
favourites: null == favourites
|
||||
? _self.favourites
|
||||
: favourites // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
hideEmptyShows: null == hideEmptyShows
|
||||
? _self.hideEmptyShows
|
||||
: hideEmptyShows // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
recursive: null == recursive
|
||||
? _self.recursive
|
||||
: recursive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
groupBy: null == groupBy
|
||||
? _self.groupBy
|
||||
: groupBy // ignore: cast_nullable_to_non_nullable
|
||||
as GroupBy,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
152
lib/models/library_filter_model.g.dart
Normal file
152
lib/models/library_filter_model.g.dart
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'library_filter_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_LibraryFilterModel _$LibraryFilterModelFromJson(Map<String, dynamic> json) =>
|
||||
_LibraryFilterModel(
|
||||
genres: (json['genres'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as bool),
|
||||
) ??
|
||||
const {},
|
||||
itemFilters: (json['itemFilters'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry($enumDecode(_$ItemFilterEnumMap, k), e as bool),
|
||||
) ??
|
||||
const {
|
||||
ItemFilter.isplayed: false,
|
||||
ItemFilter.isunplayed: false,
|
||||
ItemFilter.isresumable: false
|
||||
},
|
||||
studios: json['studios'] == null
|
||||
? const {}
|
||||
: const StudioEncoder().fromJson(json['studios'] as String),
|
||||
tags: (json['tags'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as bool),
|
||||
) ??
|
||||
const {},
|
||||
years: (json['years'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(int.parse(k), e as bool),
|
||||
) ??
|
||||
const {},
|
||||
officialRatings: (json['officialRatings'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) => MapEntry(k, e as bool),
|
||||
) ??
|
||||
const {},
|
||||
types: (json['types'] as Map<String, dynamic>?)?.map(
|
||||
(k, e) =>
|
||||
MapEntry($enumDecode(_$FladderItemTypeEnumMap, k), e as bool),
|
||||
) ??
|
||||
const {
|
||||
FladderItemType.audio: false,
|
||||
FladderItemType.boxset: false,
|
||||
FladderItemType.book: false,
|
||||
FladderItemType.collectionFolder: false,
|
||||
FladderItemType.episode: false,
|
||||
FladderItemType.folder: false,
|
||||
FladderItemType.movie: false,
|
||||
FladderItemType.musicAlbum: false,
|
||||
FladderItemType.musicVideo: false,
|
||||
FladderItemType.photo: false,
|
||||
FladderItemType.person: false,
|
||||
FladderItemType.photoAlbum: false,
|
||||
FladderItemType.series: false,
|
||||
FladderItemType.video: false
|
||||
},
|
||||
sortingOption:
|
||||
$enumDecodeNullable(_$SortingOptionsEnumMap, json['sortingOption']) ??
|
||||
SortingOptions.sortName,
|
||||
sortOrder:
|
||||
$enumDecodeNullable(_$SortingOrderEnumMap, json['sortOrder']) ??
|
||||
SortingOrder.ascending,
|
||||
favourites: json['favourites'] as bool? ?? false,
|
||||
hideEmptyShows: json['hideEmptyShows'] as bool? ?? true,
|
||||
recursive: json['recursive'] as bool? ?? true,
|
||||
groupBy: $enumDecodeNullable(_$GroupByEnumMap, json['groupBy']) ??
|
||||
GroupBy.none,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LibraryFilterModelToJson(_LibraryFilterModel instance) =>
|
||||
<String, dynamic>{
|
||||
'genres': instance.genres,
|
||||
'itemFilters': instance.itemFilters
|
||||
.map((k, e) => MapEntry(_$ItemFilterEnumMap[k], e)),
|
||||
'studios': const StudioEncoder().toJson(instance.studios),
|
||||
'tags': instance.tags,
|
||||
'years': instance.years.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'officialRatings': instance.officialRatings,
|
||||
'types': instance.types
|
||||
.map((k, e) => MapEntry(_$FladderItemTypeEnumMap[k]!, e)),
|
||||
'sortingOption': _$SortingOptionsEnumMap[instance.sortingOption]!,
|
||||
'sortOrder': _$SortingOrderEnumMap[instance.sortOrder]!,
|
||||
'favourites': instance.favourites,
|
||||
'hideEmptyShows': instance.hideEmptyShows,
|
||||
'recursive': instance.recursive,
|
||||
'groupBy': _$GroupByEnumMap[instance.groupBy]!,
|
||||
};
|
||||
|
||||
const _$ItemFilterEnumMap = {
|
||||
ItemFilter.swaggerGeneratedUnknown: null,
|
||||
ItemFilter.isfolder: 'IsFolder',
|
||||
ItemFilter.isnotfolder: 'IsNotFolder',
|
||||
ItemFilter.isunplayed: 'IsUnplayed',
|
||||
ItemFilter.isplayed: 'IsPlayed',
|
||||
ItemFilter.isfavorite: 'IsFavorite',
|
||||
ItemFilter.isresumable: 'IsResumable',
|
||||
ItemFilter.likes: 'Likes',
|
||||
ItemFilter.dislikes: 'Dislikes',
|
||||
ItemFilter.isfavoriteorlikes: 'IsFavoriteOrLikes',
|
||||
};
|
||||
|
||||
const _$FladderItemTypeEnumMap = {
|
||||
FladderItemType.baseType: 'baseType',
|
||||
FladderItemType.audio: 'audio',
|
||||
FladderItemType.musicAlbum: 'musicAlbum',
|
||||
FladderItemType.musicVideo: 'musicVideo',
|
||||
FladderItemType.collectionFolder: 'collectionFolder',
|
||||
FladderItemType.video: 'video',
|
||||
FladderItemType.movie: 'movie',
|
||||
FladderItemType.series: 'series',
|
||||
FladderItemType.season: 'season',
|
||||
FladderItemType.episode: 'episode',
|
||||
FladderItemType.photo: 'photo',
|
||||
FladderItemType.person: 'person',
|
||||
FladderItemType.photoAlbum: 'photoAlbum',
|
||||
FladderItemType.folder: 'folder',
|
||||
FladderItemType.boxset: 'boxset',
|
||||
FladderItemType.playlist: 'playlist',
|
||||
FladderItemType.book: 'book',
|
||||
};
|
||||
|
||||
const _$SortingOptionsEnumMap = {
|
||||
SortingOptions.sortName: 'sortName',
|
||||
SortingOptions.communityRating: 'communityRating',
|
||||
SortingOptions.parentalRating: 'parentalRating',
|
||||
SortingOptions.dateAdded: 'dateAdded',
|
||||
SortingOptions.dateLastContentAdded: 'dateLastContentAdded',
|
||||
SortingOptions.favorite: 'favorite',
|
||||
SortingOptions.datePlayed: 'datePlayed',
|
||||
SortingOptions.folders: 'folders',
|
||||
SortingOptions.playCount: 'playCount',
|
||||
SortingOptions.releaseDate: 'releaseDate',
|
||||
SortingOptions.runTime: 'runTime',
|
||||
SortingOptions.random: 'random',
|
||||
};
|
||||
|
||||
const _$SortingOrderEnumMap = {
|
||||
SortingOrder.ascending: 'ascending',
|
||||
SortingOrder.descending: 'descending',
|
||||
};
|
||||
|
||||
const _$GroupByEnumMap = {
|
||||
GroupBy.none: 'none',
|
||||
GroupBy.name: 'name',
|
||||
GroupBy.genres: 'genres',
|
||||
GroupBy.dateAdded: 'dateAdded',
|
||||
GroupBy.tags: 'tags',
|
||||
GroupBy.releaseDate: 'releaseDate',
|
||||
GroupBy.rating: 'rating',
|
||||
GroupBy.type: 'type',
|
||||
};
|
||||
|
|
@ -1,14 +1,8 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:xid/xid.dart';
|
||||
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.enums.swagger.dart';
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.swagger.dart';
|
||||
import 'package:fladder/models/item_base_model.dart';
|
||||
import 'package:fladder/models/items/item_shared_models.dart';
|
||||
import 'package:fladder/models/library_filter_model.dart';
|
||||
import 'package:fladder/models/library_search/library_search_model.dart';
|
||||
import 'package:fladder/models/library_search/library_search_options.dart';
|
||||
import 'package:fladder/util/map_bool_helper.dart';
|
||||
|
||||
part 'library_filters_model.freezed.dart';
|
||||
|
|
@ -22,20 +16,8 @@ abstract class LibraryFiltersModel with _$LibraryFiltersModel {
|
|||
required String id,
|
||||
required String name,
|
||||
required bool isFavourite,
|
||||
required List<String> ids,
|
||||
required Map<String, bool> genres,
|
||||
required Map<ItemFilter, bool> filters,
|
||||
@StudioEncoder() required Map<Studio, bool> studios,
|
||||
required Map<String, bool> tags,
|
||||
required Map<int, bool> years,
|
||||
required Map<String, bool> officialRatings,
|
||||
required Map<FladderItemType, bool> types,
|
||||
required SortingOptions sortingOption,
|
||||
required SortingOrder sortOrder,
|
||||
required bool favourites,
|
||||
required bool hideEmptyShows,
|
||||
required bool recursive,
|
||||
required GroupBy groupBy,
|
||||
@Default([]) List<String> ids,
|
||||
@Default(LibraryFilterModel()) LibraryFilterModel filter,
|
||||
}) = _LibraryFiltersModel;
|
||||
|
||||
factory LibraryFiltersModel.fromJson(Map<String, dynamic> json) => _$LibraryFiltersModelFromJson(json);
|
||||
|
|
@ -51,35 +33,9 @@ abstract class LibraryFiltersModel with _$LibraryFiltersModel {
|
|||
name: name,
|
||||
isFavourite: isFavourite ?? false,
|
||||
ids: searchModel.views.included.map((e) => e.id).toList(),
|
||||
genres: searchModel.genres,
|
||||
filters: searchModel.filters,
|
||||
studios: searchModel.studios,
|
||||
tags: searchModel.tags,
|
||||
years: searchModel.years,
|
||||
officialRatings: searchModel.officialRatings,
|
||||
types: searchModel.types,
|
||||
sortingOption: searchModel.sortingOption,
|
||||
sortOrder: searchModel.sortOrder,
|
||||
favourites: searchModel.favourites,
|
||||
hideEmptyShows: searchModel.hideEmptyShows,
|
||||
recursive: searchModel.recursive,
|
||||
groupBy: searchModel.groupBy,
|
||||
filter: searchModel.filters,
|
||||
);
|
||||
}
|
||||
|
||||
bool containsSameIds(List<String> otherIds) => ids.length == otherIds.length && Set.from(ids).containsAll(otherIds);
|
||||
}
|
||||
|
||||
class StudioEncoder implements JsonConverter<Map<Studio, bool>, String> {
|
||||
const StudioEncoder();
|
||||
|
||||
@override
|
||||
Map<Studio, bool> fromJson(String json) {
|
||||
final decodedMap = jsonDecode(json) as Map<dynamic, dynamic>;
|
||||
final studios = decodedMap.map((key, value) => MapEntry(Studio.fromJson(key), value as bool));
|
||||
return studios;
|
||||
}
|
||||
|
||||
@override
|
||||
String toJson(Map<Studio, bool> studios) => jsonEncode(studios.map((key, value) => MapEntry(key.toJson(), value)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,20 +18,7 @@ mixin _$LibraryFiltersModel {
|
|||
String get name;
|
||||
bool get isFavourite;
|
||||
List<String> get ids;
|
||||
Map<String, bool> get genres;
|
||||
Map<ItemFilter, bool> get filters;
|
||||
@StudioEncoder()
|
||||
Map<Studio, bool> get studios;
|
||||
Map<String, bool> get tags;
|
||||
Map<int, bool> get years;
|
||||
Map<String, bool> get officialRatings;
|
||||
Map<FladderItemType, bool> get types;
|
||||
SortingOptions get sortingOption;
|
||||
SortingOrder get sortOrder;
|
||||
bool get favourites;
|
||||
bool get hideEmptyShows;
|
||||
bool get recursive;
|
||||
GroupBy get groupBy;
|
||||
LibraryFilterModel get filter;
|
||||
|
||||
/// Create a copy of LibraryFiltersModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
|
@ -46,7 +33,7 @@ mixin _$LibraryFiltersModel {
|
|||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LibraryFiltersModel(id: $id, name: $name, isFavourite: $isFavourite, ids: $ids, genres: $genres, filters: $filters, studios: $studios, tags: $tags, years: $years, officialRatings: $officialRatings, types: $types, sortingOption: $sortingOption, sortOrder: $sortOrder, favourites: $favourites, hideEmptyShows: $hideEmptyShows, recursive: $recursive, groupBy: $groupBy)';
|
||||
return 'LibraryFiltersModel(id: $id, name: $name, isFavourite: $isFavourite, ids: $ids, filter: $filter)';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,19 +48,9 @@ abstract mixin class $LibraryFiltersModelCopyWith<$Res> {
|
|||
String name,
|
||||
bool isFavourite,
|
||||
List<String> ids,
|
||||
Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> filters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy});
|
||||
LibraryFilterModel filter});
|
||||
|
||||
$LibraryFilterModelCopyWith<$Res> get filter;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
|
@ -93,19 +70,7 @@ class _$LibraryFiltersModelCopyWithImpl<$Res>
|
|||
Object? name = null,
|
||||
Object? isFavourite = null,
|
||||
Object? ids = null,
|
||||
Object? genres = null,
|
||||
Object? filters = null,
|
||||
Object? studios = null,
|
||||
Object? tags = null,
|
||||
Object? years = null,
|
||||
Object? officialRatings = null,
|
||||
Object? types = null,
|
||||
Object? sortingOption = null,
|
||||
Object? sortOrder = null,
|
||||
Object? favourites = null,
|
||||
Object? hideEmptyShows = null,
|
||||
Object? recursive = null,
|
||||
Object? groupBy = null,
|
||||
Object? filter = null,
|
||||
}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id
|
||||
|
|
@ -124,60 +89,22 @@ class _$LibraryFiltersModelCopyWithImpl<$Res>
|
|||
? _self.ids
|
||||
: ids // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
genres: null == genres
|
||||
? _self.genres
|
||||
: genres // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
filters: null == filters
|
||||
? _self.filters
|
||||
: filters // ignore: cast_nullable_to_non_nullable
|
||||
as Map<ItemFilter, bool>,
|
||||
studios: null == studios
|
||||
? _self.studios
|
||||
: studios // ignore: cast_nullable_to_non_nullable
|
||||
as Map<Studio, bool>,
|
||||
tags: null == tags
|
||||
? _self.tags
|
||||
: tags // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
years: null == years
|
||||
? _self.years
|
||||
: years // ignore: cast_nullable_to_non_nullable
|
||||
as Map<int, bool>,
|
||||
officialRatings: null == officialRatings
|
||||
? _self.officialRatings
|
||||
: officialRatings // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
types: null == types
|
||||
? _self.types
|
||||
: types // ignore: cast_nullable_to_non_nullable
|
||||
as Map<FladderItemType, bool>,
|
||||
sortingOption: null == sortingOption
|
||||
? _self.sortingOption
|
||||
: sortingOption // ignore: cast_nullable_to_non_nullable
|
||||
as SortingOptions,
|
||||
sortOrder: null == sortOrder
|
||||
? _self.sortOrder
|
||||
: sortOrder // ignore: cast_nullable_to_non_nullable
|
||||
as SortingOrder,
|
||||
favourites: null == favourites
|
||||
? _self.favourites
|
||||
: favourites // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
hideEmptyShows: null == hideEmptyShows
|
||||
? _self.hideEmptyShows
|
||||
: hideEmptyShows // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
recursive: null == recursive
|
||||
? _self.recursive
|
||||
: recursive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
groupBy: null == groupBy
|
||||
? _self.groupBy
|
||||
: groupBy // ignore: cast_nullable_to_non_nullable
|
||||
as GroupBy,
|
||||
filter: null == filter
|
||||
? _self.filter
|
||||
: filter // ignore: cast_nullable_to_non_nullable
|
||||
as LibraryFilterModel,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of LibraryFiltersModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LibraryFilterModelCopyWith<$Res> get filter {
|
||||
return $LibraryFilterModelCopyWith<$Res>(_self.filter, (value) {
|
||||
return _then(_self.copyWith(filter: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [LibraryFiltersModel].
|
||||
|
|
@ -273,24 +200,8 @@ extension LibraryFiltersModelPatterns on LibraryFiltersModel {
|
|||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(
|
||||
String id,
|
||||
String name,
|
||||
bool isFavourite,
|
||||
List<String> ids,
|
||||
Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> filters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy)?
|
||||
TResult Function(String id, String name, bool isFavourite, List<String> ids,
|
||||
LibraryFilterModel filter)?
|
||||
$default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
|
|
@ -298,23 +209,7 @@ extension LibraryFiltersModelPatterns on LibraryFiltersModel {
|
|||
switch (_that) {
|
||||
case _LibraryFiltersModel() when $default != null:
|
||||
return $default(
|
||||
_that.id,
|
||||
_that.name,
|
||||
_that.isFavourite,
|
||||
_that.ids,
|
||||
_that.genres,
|
||||
_that.filters,
|
||||
_that.studios,
|
||||
_that.tags,
|
||||
_that.years,
|
||||
_that.officialRatings,
|
||||
_that.types,
|
||||
_that.sortingOption,
|
||||
_that.sortOrder,
|
||||
_that.favourites,
|
||||
_that.hideEmptyShows,
|
||||
_that.recursive,
|
||||
_that.groupBy);
|
||||
_that.id, _that.name, _that.isFavourite, _that.ids, _that.filter);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
|
|
@ -335,47 +230,15 @@ extension LibraryFiltersModelPatterns on LibraryFiltersModel {
|
|||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(
|
||||
String id,
|
||||
String name,
|
||||
bool isFavourite,
|
||||
List<String> ids,
|
||||
Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> filters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy)
|
||||
TResult Function(String id, String name, bool isFavourite, List<String> ids,
|
||||
LibraryFilterModel filter)
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibraryFiltersModel():
|
||||
return $default(
|
||||
_that.id,
|
||||
_that.name,
|
||||
_that.isFavourite,
|
||||
_that.ids,
|
||||
_that.genres,
|
||||
_that.filters,
|
||||
_that.studios,
|
||||
_that.tags,
|
||||
_that.years,
|
||||
_that.officialRatings,
|
||||
_that.types,
|
||||
_that.sortingOption,
|
||||
_that.sortOrder,
|
||||
_that.favourites,
|
||||
_that.hideEmptyShows,
|
||||
_that.recursive,
|
||||
_that.groupBy);
|
||||
_that.id, _that.name, _that.isFavourite, _that.ids, _that.filter);
|
||||
case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
}
|
||||
|
|
@ -395,47 +258,15 @@ extension LibraryFiltersModelPatterns on LibraryFiltersModel {
|
|||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(
|
||||
String id,
|
||||
String name,
|
||||
bool isFavourite,
|
||||
List<String> ids,
|
||||
Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> filters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy)?
|
||||
TResult? Function(String id, String name, bool isFavourite,
|
||||
List<String> ids, LibraryFilterModel filter)?
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibraryFiltersModel() when $default != null:
|
||||
return $default(
|
||||
_that.id,
|
||||
_that.name,
|
||||
_that.isFavourite,
|
||||
_that.ids,
|
||||
_that.genres,
|
||||
_that.filters,
|
||||
_that.studios,
|
||||
_that.tags,
|
||||
_that.years,
|
||||
_that.officialRatings,
|
||||
_that.types,
|
||||
_that.sortingOption,
|
||||
_that.sortOrder,
|
||||
_that.favourites,
|
||||
_that.hideEmptyShows,
|
||||
_that.recursive,
|
||||
_that.groupBy);
|
||||
_that.id, _that.name, _that.isFavourite, _that.ids, _that.filter);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
|
|
@ -449,28 +280,9 @@ class _LibraryFiltersModel extends LibraryFiltersModel {
|
|||
{required this.id,
|
||||
required this.name,
|
||||
required this.isFavourite,
|
||||
required final List<String> ids,
|
||||
required final Map<String, bool> genres,
|
||||
required final Map<ItemFilter, bool> filters,
|
||||
@StudioEncoder() required final Map<Studio, bool> studios,
|
||||
required final Map<String, bool> tags,
|
||||
required final Map<int, bool> years,
|
||||
required final Map<String, bool> officialRatings,
|
||||
required final Map<FladderItemType, bool> types,
|
||||
required this.sortingOption,
|
||||
required this.sortOrder,
|
||||
required this.favourites,
|
||||
required this.hideEmptyShows,
|
||||
required this.recursive,
|
||||
required this.groupBy})
|
||||
final List<String> ids = const [],
|
||||
this.filter = const LibraryFilterModel()})
|
||||
: _ids = ids,
|
||||
_genres = genres,
|
||||
_filters = filters,
|
||||
_studios = studios,
|
||||
_tags = tags,
|
||||
_years = years,
|
||||
_officialRatings = officialRatings,
|
||||
_types = types,
|
||||
super._();
|
||||
factory _LibraryFiltersModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$LibraryFiltersModelFromJson(json);
|
||||
|
|
@ -483,81 +295,16 @@ class _LibraryFiltersModel extends LibraryFiltersModel {
|
|||
final bool isFavourite;
|
||||
final List<String> _ids;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<String> get ids {
|
||||
if (_ids is EqualUnmodifiableListView) return _ids;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_ids);
|
||||
}
|
||||
|
||||
final Map<String, bool> _genres;
|
||||
@override
|
||||
Map<String, bool> get genres {
|
||||
if (_genres is EqualUnmodifiableMapView) return _genres;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_genres);
|
||||
}
|
||||
|
||||
final Map<ItemFilter, bool> _filters;
|
||||
@override
|
||||
Map<ItemFilter, bool> get filters {
|
||||
if (_filters is EqualUnmodifiableMapView) return _filters;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_filters);
|
||||
}
|
||||
|
||||
final Map<Studio, bool> _studios;
|
||||
@override
|
||||
@StudioEncoder()
|
||||
Map<Studio, bool> get studios {
|
||||
if (_studios is EqualUnmodifiableMapView) return _studios;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_studios);
|
||||
}
|
||||
|
||||
final Map<String, bool> _tags;
|
||||
@override
|
||||
Map<String, bool> get tags {
|
||||
if (_tags is EqualUnmodifiableMapView) return _tags;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_tags);
|
||||
}
|
||||
|
||||
final Map<int, bool> _years;
|
||||
@override
|
||||
Map<int, bool> get years {
|
||||
if (_years is EqualUnmodifiableMapView) return _years;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_years);
|
||||
}
|
||||
|
||||
final Map<String, bool> _officialRatings;
|
||||
@override
|
||||
Map<String, bool> get officialRatings {
|
||||
if (_officialRatings is EqualUnmodifiableMapView) return _officialRatings;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_officialRatings);
|
||||
}
|
||||
|
||||
final Map<FladderItemType, bool> _types;
|
||||
@override
|
||||
Map<FladderItemType, bool> get types {
|
||||
if (_types is EqualUnmodifiableMapView) return _types;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_types);
|
||||
}
|
||||
|
||||
@override
|
||||
final SortingOptions sortingOption;
|
||||
@override
|
||||
final SortingOrder sortOrder;
|
||||
@override
|
||||
final bool favourites;
|
||||
@override
|
||||
final bool hideEmptyShows;
|
||||
@override
|
||||
final bool recursive;
|
||||
@override
|
||||
final GroupBy groupBy;
|
||||
@JsonKey()
|
||||
final LibraryFilterModel filter;
|
||||
|
||||
/// Create a copy of LibraryFiltersModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
|
@ -577,7 +324,7 @@ class _LibraryFiltersModel extends LibraryFiltersModel {
|
|||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LibraryFiltersModel(id: $id, name: $name, isFavourite: $isFavourite, ids: $ids, genres: $genres, filters: $filters, studios: $studios, tags: $tags, years: $years, officialRatings: $officialRatings, types: $types, sortingOption: $sortingOption, sortOrder: $sortOrder, favourites: $favourites, hideEmptyShows: $hideEmptyShows, recursive: $recursive, groupBy: $groupBy)';
|
||||
return 'LibraryFiltersModel(id: $id, name: $name, isFavourite: $isFavourite, ids: $ids, filter: $filter)';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -594,19 +341,10 @@ abstract mixin class _$LibraryFiltersModelCopyWith<$Res>
|
|||
String name,
|
||||
bool isFavourite,
|
||||
List<String> ids,
|
||||
Map<String, bool> genres,
|
||||
Map<ItemFilter, bool> filters,
|
||||
@StudioEncoder() Map<Studio, bool> studios,
|
||||
Map<String, bool> tags,
|
||||
Map<int, bool> years,
|
||||
Map<String, bool> officialRatings,
|
||||
Map<FladderItemType, bool> types,
|
||||
SortingOptions sortingOption,
|
||||
SortingOrder sortOrder,
|
||||
bool favourites,
|
||||
bool hideEmptyShows,
|
||||
bool recursive,
|
||||
GroupBy groupBy});
|
||||
LibraryFilterModel filter});
|
||||
|
||||
@override
|
||||
$LibraryFilterModelCopyWith<$Res> get filter;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
|
@ -626,19 +364,7 @@ class __$LibraryFiltersModelCopyWithImpl<$Res>
|
|||
Object? name = null,
|
||||
Object? isFavourite = null,
|
||||
Object? ids = null,
|
||||
Object? genres = null,
|
||||
Object? filters = null,
|
||||
Object? studios = null,
|
||||
Object? tags = null,
|
||||
Object? years = null,
|
||||
Object? officialRatings = null,
|
||||
Object? types = null,
|
||||
Object? sortingOption = null,
|
||||
Object? sortOrder = null,
|
||||
Object? favourites = null,
|
||||
Object? hideEmptyShows = null,
|
||||
Object? recursive = null,
|
||||
Object? groupBy = null,
|
||||
Object? filter = null,
|
||||
}) {
|
||||
return _then(_LibraryFiltersModel(
|
||||
id: null == id
|
||||
|
|
@ -657,60 +383,22 @@ class __$LibraryFiltersModelCopyWithImpl<$Res>
|
|||
? _self._ids
|
||||
: ids // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
genres: null == genres
|
||||
? _self._genres
|
||||
: genres // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
filters: null == filters
|
||||
? _self._filters
|
||||
: filters // ignore: cast_nullable_to_non_nullable
|
||||
as Map<ItemFilter, bool>,
|
||||
studios: null == studios
|
||||
? _self._studios
|
||||
: studios // ignore: cast_nullable_to_non_nullable
|
||||
as Map<Studio, bool>,
|
||||
tags: null == tags
|
||||
? _self._tags
|
||||
: tags // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
years: null == years
|
||||
? _self._years
|
||||
: years // ignore: cast_nullable_to_non_nullable
|
||||
as Map<int, bool>,
|
||||
officialRatings: null == officialRatings
|
||||
? _self._officialRatings
|
||||
: officialRatings // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, bool>,
|
||||
types: null == types
|
||||
? _self._types
|
||||
: types // ignore: cast_nullable_to_non_nullable
|
||||
as Map<FladderItemType, bool>,
|
||||
sortingOption: null == sortingOption
|
||||
? _self.sortingOption
|
||||
: sortingOption // ignore: cast_nullable_to_non_nullable
|
||||
as SortingOptions,
|
||||
sortOrder: null == sortOrder
|
||||
? _self.sortOrder
|
||||
: sortOrder // ignore: cast_nullable_to_non_nullable
|
||||
as SortingOrder,
|
||||
favourites: null == favourites
|
||||
? _self.favourites
|
||||
: favourites // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
hideEmptyShows: null == hideEmptyShows
|
||||
? _self.hideEmptyShows
|
||||
: hideEmptyShows // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
recursive: null == recursive
|
||||
? _self.recursive
|
||||
: recursive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
groupBy: null == groupBy
|
||||
? _self.groupBy
|
||||
: groupBy // ignore: cast_nullable_to_non_nullable
|
||||
as GroupBy,
|
||||
filter: null == filter
|
||||
? _self.filter
|
||||
: filter // ignore: cast_nullable_to_non_nullable
|
||||
as LibraryFilterModel,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of LibraryFiltersModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LibraryFilterModelCopyWith<$Res> get filter {
|
||||
return $LibraryFilterModelCopyWith<$Res>(_self.filter, (value) {
|
||||
return _then(_self.copyWith(filter: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
|
|
|
|||
|
|
@ -11,27 +11,11 @@ _LibraryFiltersModel _$LibraryFiltersModelFromJson(Map<String, dynamic> json) =>
|
|||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
isFavourite: json['isFavourite'] as bool,
|
||||
ids: (json['ids'] as List<dynamic>).map((e) => e as String).toList(),
|
||||
genres: Map<String, bool>.from(json['genres'] as Map),
|
||||
filters: (json['filters'] as Map<String, dynamic>).map(
|
||||
(k, e) => MapEntry($enumDecode(_$ItemFilterEnumMap, k), e as bool),
|
||||
),
|
||||
studios: const StudioEncoder().fromJson(json['studios'] as String),
|
||||
tags: Map<String, bool>.from(json['tags'] as Map),
|
||||
years: (json['years'] as Map<String, dynamic>).map(
|
||||
(k, e) => MapEntry(int.parse(k), e as bool),
|
||||
),
|
||||
officialRatings: Map<String, bool>.from(json['officialRatings'] as Map),
|
||||
types: (json['types'] as Map<String, dynamic>).map(
|
||||
(k, e) => MapEntry($enumDecode(_$FladderItemTypeEnumMap, k), e as bool),
|
||||
),
|
||||
sortingOption:
|
||||
$enumDecode(_$SortingOptionsEnumMap, json['sortingOption']),
|
||||
sortOrder: $enumDecode(_$SortingOrderEnumMap, json['sortOrder']),
|
||||
favourites: json['favourites'] as bool,
|
||||
hideEmptyShows: json['hideEmptyShows'] as bool,
|
||||
recursive: json['recursive'] as bool,
|
||||
groupBy: $enumDecode(_$GroupByEnumMap, json['groupBy']),
|
||||
ids: (json['ids'] as List<dynamic>?)?.map((e) => e as String).toList() ??
|
||||
const [],
|
||||
filter: json['filter'] == null
|
||||
? const LibraryFilterModel()
|
||||
: LibraryFilterModel.fromJson(json['filter'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$LibraryFiltersModelToJson(
|
||||
|
|
@ -41,83 +25,5 @@ Map<String, dynamic> _$LibraryFiltersModelToJson(
|
|||
'name': instance.name,
|
||||
'isFavourite': instance.isFavourite,
|
||||
'ids': instance.ids,
|
||||
'genres': instance.genres,
|
||||
'filters':
|
||||
instance.filters.map((k, e) => MapEntry(_$ItemFilterEnumMap[k], e)),
|
||||
'studios': const StudioEncoder().toJson(instance.studios),
|
||||
'tags': instance.tags,
|
||||
'years': instance.years.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'officialRatings': instance.officialRatings,
|
||||
'types': instance.types
|
||||
.map((k, e) => MapEntry(_$FladderItemTypeEnumMap[k]!, e)),
|
||||
'sortingOption': _$SortingOptionsEnumMap[instance.sortingOption]!,
|
||||
'sortOrder': _$SortingOrderEnumMap[instance.sortOrder]!,
|
||||
'favourites': instance.favourites,
|
||||
'hideEmptyShows': instance.hideEmptyShows,
|
||||
'recursive': instance.recursive,
|
||||
'groupBy': _$GroupByEnumMap[instance.groupBy]!,
|
||||
'filter': instance.filter,
|
||||
};
|
||||
|
||||
const _$ItemFilterEnumMap = {
|
||||
ItemFilter.swaggerGeneratedUnknown: null,
|
||||
ItemFilter.isfolder: 'IsFolder',
|
||||
ItemFilter.isnotfolder: 'IsNotFolder',
|
||||
ItemFilter.isunplayed: 'IsUnplayed',
|
||||
ItemFilter.isplayed: 'IsPlayed',
|
||||
ItemFilter.isfavorite: 'IsFavorite',
|
||||
ItemFilter.isresumable: 'IsResumable',
|
||||
ItemFilter.likes: 'Likes',
|
||||
ItemFilter.dislikes: 'Dislikes',
|
||||
ItemFilter.isfavoriteorlikes: 'IsFavoriteOrLikes',
|
||||
};
|
||||
|
||||
const _$FladderItemTypeEnumMap = {
|
||||
FladderItemType.baseType: 'baseType',
|
||||
FladderItemType.audio: 'audio',
|
||||
FladderItemType.musicAlbum: 'musicAlbum',
|
||||
FladderItemType.musicVideo: 'musicVideo',
|
||||
FladderItemType.collectionFolder: 'collectionFolder',
|
||||
FladderItemType.video: 'video',
|
||||
FladderItemType.movie: 'movie',
|
||||
FladderItemType.series: 'series',
|
||||
FladderItemType.season: 'season',
|
||||
FladderItemType.episode: 'episode',
|
||||
FladderItemType.photo: 'photo',
|
||||
FladderItemType.person: 'person',
|
||||
FladderItemType.photoAlbum: 'photoAlbum',
|
||||
FladderItemType.folder: 'folder',
|
||||
FladderItemType.boxset: 'boxset',
|
||||
FladderItemType.playlist: 'playlist',
|
||||
FladderItemType.book: 'book',
|
||||
};
|
||||
|
||||
const _$SortingOptionsEnumMap = {
|
||||
SortingOptions.sortName: 'sortName',
|
||||
SortingOptions.communityRating: 'communityRating',
|
||||
SortingOptions.parentalRating: 'parentalRating',
|
||||
SortingOptions.dateAdded: 'dateAdded',
|
||||
SortingOptions.dateLastContentAdded: 'dateLastContentAdded',
|
||||
SortingOptions.favorite: 'favorite',
|
||||
SortingOptions.datePlayed: 'datePlayed',
|
||||
SortingOptions.folders: 'folders',
|
||||
SortingOptions.playCount: 'playCount',
|
||||
SortingOptions.releaseDate: 'releaseDate',
|
||||
SortingOptions.runTime: 'runTime',
|
||||
SortingOptions.random: 'random',
|
||||
};
|
||||
|
||||
const _$SortingOrderEnumMap = {
|
||||
SortingOrder.ascending: 'ascending',
|
||||
SortingOrder.descending: 'descending',
|
||||
};
|
||||
|
||||
const _$GroupByEnumMap = {
|
||||
GroupBy.none: 'none',
|
||||
GroupBy.name: 'name',
|
||||
GroupBy.genres: 'genres',
|
||||
GroupBy.dateAdded: 'dateAdded',
|
||||
GroupBy.tags: 'tags',
|
||||
GroupBy.releaseDate: 'releaseDate',
|
||||
GroupBy.rating: 'rating',
|
||||
GroupBy.type: 'type',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,102 +2,36 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:dart_mappable/dart_mappable.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.enums.swagger.dart';
|
||||
import 'package:fladder/jellyfin/jellyfin_open_api.swagger.dart';
|
||||
import 'package:fladder/models/item_base_model.dart';
|
||||
import 'package:fladder/models/items/item_shared_models.dart';
|
||||
import 'package:fladder/models/library_search/library_search_options.dart';
|
||||
import 'package:fladder/models/library_filter_model.dart';
|
||||
import 'package:fladder/models/view_model.dart';
|
||||
import 'package:fladder/util/list_extensions.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
import 'package:fladder/util/map_bool_helper.dart';
|
||||
|
||||
part 'library_search_model.mapper.dart';
|
||||
part 'library_search_model.freezed.dart';
|
||||
|
||||
@MappableClass()
|
||||
class LibrarySearchModel with LibrarySearchModelMappable {
|
||||
final bool loading;
|
||||
final bool selecteMode;
|
||||
final String searchQuery;
|
||||
final List<ItemBaseModel> folderOverwrite;
|
||||
final Map<ViewModel, bool> views;
|
||||
final List<ItemBaseModel> posters;
|
||||
final List<ItemBaseModel> selectedPosters;
|
||||
final Map<ItemFilter, bool> filters;
|
||||
final Map<String, bool> genres;
|
||||
final Map<Studio, bool> studios;
|
||||
final Map<String, bool> tags;
|
||||
final Map<int, bool> years;
|
||||
final Map<String, bool> officialRatings;
|
||||
final Map<FladderItemType, bool> types;
|
||||
final SortingOptions sortingOption;
|
||||
final SortingOrder sortOrder;
|
||||
final bool favourites;
|
||||
final bool hideEmptyShows;
|
||||
final bool recursive;
|
||||
final GroupBy groupBy;
|
||||
final Map<String, int> lastIndices;
|
||||
final Map<String, int> libraryItemCounts;
|
||||
final bool fetchingItems;
|
||||
@Freezed(copyWith: true)
|
||||
abstract class LibrarySearchModel with _$LibrarySearchModel {
|
||||
const factory LibrarySearchModel({
|
||||
@Default(false) bool loading,
|
||||
@Default(false) bool selecteMode,
|
||||
@Default(<ItemBaseModel>[]) List<ItemBaseModel> folderOverwrite,
|
||||
@Default("") String searchQuery,
|
||||
@Default(<ViewModel, bool>{}) Map<ViewModel, bool> views,
|
||||
@Default(<ItemBaseModel>[]) List<ItemBaseModel> posters,
|
||||
@Default(<ItemBaseModel>[]) List<ItemBaseModel> selectedPosters,
|
||||
@Default(LibraryFilterModel()) LibraryFilterModel filters,
|
||||
@Default(<String, int>{}) Map<String, int> lastIndices,
|
||||
@Default(<String, int>{}) Map<String, int> libraryItemCounts,
|
||||
@Default(false) bool fetchingItems,
|
||||
}) = _LibrarySearchModel;
|
||||
}
|
||||
|
||||
const LibrarySearchModel({
|
||||
this.loading = false,
|
||||
this.selecteMode = false,
|
||||
this.folderOverwrite = const [],
|
||||
this.searchQuery = "",
|
||||
this.views = const {},
|
||||
this.posters = const [],
|
||||
this.selectedPosters = const [],
|
||||
this.filters = const {
|
||||
ItemFilter.isplayed: false,
|
||||
ItemFilter.isunplayed: false,
|
||||
ItemFilter.isresumable: false,
|
||||
},
|
||||
this.genres = const {},
|
||||
this.studios = const {},
|
||||
this.tags = const {},
|
||||
this.years = const {},
|
||||
this.officialRatings = const {},
|
||||
this.types = const {
|
||||
FladderItemType.audio: false,
|
||||
FladderItemType.boxset: false,
|
||||
FladderItemType.book: false,
|
||||
FladderItemType.collectionFolder: false,
|
||||
FladderItemType.episode: false,
|
||||
FladderItemType.folder: false,
|
||||
FladderItemType.movie: true,
|
||||
FladderItemType.musicAlbum: false,
|
||||
FladderItemType.musicVideo: false,
|
||||
FladderItemType.photo: false,
|
||||
FladderItemType.person: false,
|
||||
FladderItemType.photoAlbum: false,
|
||||
FladderItemType.series: true,
|
||||
FladderItemType.video: true,
|
||||
},
|
||||
this.favourites = false,
|
||||
this.sortingOption = SortingOptions.sortName,
|
||||
this.sortOrder = SortingOrder.ascending,
|
||||
this.hideEmptyShows = true,
|
||||
this.recursive = false,
|
||||
this.groupBy = GroupBy.none,
|
||||
this.lastIndices = const {},
|
||||
this.libraryItemCounts = const {},
|
||||
this.fetchingItems = false,
|
||||
});
|
||||
|
||||
bool get hasActiveFilters {
|
||||
return genres.hasEnabled ||
|
||||
studios.hasEnabled ||
|
||||
tags.hasEnabled ||
|
||||
years.hasEnabled ||
|
||||
officialRatings.hasEnabled ||
|
||||
hideEmptyShows ||
|
||||
filters.hasEnabled ||
|
||||
favourites ||
|
||||
searchQuery.isNotEmpty;
|
||||
}
|
||||
extension LibrarySearchModelX on LibrarySearchModel {
|
||||
bool get hasActiveFilters => filters.hasActiveFilters || searchQuery.isNotEmpty;
|
||||
|
||||
int get totalItemCount {
|
||||
if (libraryItemCounts.isEmpty) return posters.length;
|
||||
|
|
@ -137,16 +71,16 @@ class LibrarySearchModel with LibrarySearchModelMappable {
|
|||
|
||||
bool get showPlayButtons {
|
||||
if (totalItemCount == 0) return false;
|
||||
return types.included.isEmpty ||
|
||||
types.included.containsAny(
|
||||
return filters.types.included.isEmpty ||
|
||||
filters.types.included.containsAny(
|
||||
{...FladderItemType.playable, FladderItemType.folder},
|
||||
);
|
||||
}
|
||||
|
||||
bool get showGalleryButtons {
|
||||
if (totalItemCount == 0) return false;
|
||||
return types.included.isEmpty ||
|
||||
types.included.containsAny(
|
||||
return filters.types.included.isEmpty ||
|
||||
filters.types.included.containsAny(
|
||||
{...FladderItemType.galleryItem, FladderItemType.photoAlbum, FladderItemType.folder},
|
||||
);
|
||||
}
|
||||
|
|
@ -170,55 +104,8 @@ class LibrarySearchModel with LibrarySearchModelMappable {
|
|||
|
||||
LibrarySearchModel setFiltersToDefault() {
|
||||
return copyWith(
|
||||
genres: const {},
|
||||
tags: const {},
|
||||
officialRatings: const {},
|
||||
years: const {},
|
||||
searchQuery: '',
|
||||
favourites: false,
|
||||
recursive: false,
|
||||
studios: const {},
|
||||
hideEmptyShows: true,
|
||||
filters: const LibraryFilterModel(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(covariant LibrarySearchModel other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other.searchQuery == searchQuery &&
|
||||
listEquals(other.folderOverwrite, folderOverwrite) &&
|
||||
mapEquals(other.views, views) &&
|
||||
mapEquals(other.filters, filters) &&
|
||||
mapEquals(other.genres, genres) &&
|
||||
mapEquals(other.studios, studios) &&
|
||||
mapEquals(other.tags, tags) &&
|
||||
mapEquals(other.years, years) &&
|
||||
mapEquals(other.officialRatings, officialRatings) &&
|
||||
mapEquals(other.types, types) &&
|
||||
other.sortingOption == sortingOption &&
|
||||
other.sortOrder == sortOrder &&
|
||||
other.favourites == favourites &&
|
||||
other.recursive == recursive;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return searchQuery.hashCode ^
|
||||
folderOverwrite.hashCode ^
|
||||
views.hashCode ^
|
||||
posters.hashCode ^
|
||||
selectedPosters.hashCode ^
|
||||
filters.hashCode ^
|
||||
genres.hashCode ^
|
||||
studios.hashCode ^
|
||||
tags.hashCode ^
|
||||
years.hashCode ^
|
||||
officialRatings.hashCode ^
|
||||
types.hashCode ^
|
||||
sortingOption.hashCode ^
|
||||
sortOrder.hashCode ^
|
||||
favourites.hashCode ^
|
||||
recursive.hashCode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
627
lib/models/library_search/library_search_model.freezed.dart
Normal file
627
lib/models/library_search/library_search_model.freezed.dart
Normal file
|
|
@ -0,0 +1,627 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'library_search_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LibrarySearchModel implements DiagnosticableTreeMixin {
|
||||
bool get loading;
|
||||
bool get selecteMode;
|
||||
List<ItemBaseModel> get folderOverwrite;
|
||||
String get searchQuery;
|
||||
Map<ViewModel, bool> get views;
|
||||
List<ItemBaseModel> get posters;
|
||||
List<ItemBaseModel> get selectedPosters;
|
||||
LibraryFilterModel get filters;
|
||||
Map<String, int> get lastIndices;
|
||||
Map<String, int> get libraryItemCounts;
|
||||
bool get fetchingItems;
|
||||
|
||||
/// Create a copy of LibrarySearchModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$LibrarySearchModelCopyWith<LibrarySearchModel> get copyWith =>
|
||||
_$LibrarySearchModelCopyWithImpl<LibrarySearchModel>(
|
||||
this as LibrarySearchModel, _$identity);
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'LibrarySearchModel'))
|
||||
..add(DiagnosticsProperty('loading', loading))
|
||||
..add(DiagnosticsProperty('selecteMode', selecteMode))
|
||||
..add(DiagnosticsProperty('folderOverwrite', folderOverwrite))
|
||||
..add(DiagnosticsProperty('searchQuery', searchQuery))
|
||||
..add(DiagnosticsProperty('views', views))
|
||||
..add(DiagnosticsProperty('posters', posters))
|
||||
..add(DiagnosticsProperty('selectedPosters', selectedPosters))
|
||||
..add(DiagnosticsProperty('filters', filters))
|
||||
..add(DiagnosticsProperty('lastIndices', lastIndices))
|
||||
..add(DiagnosticsProperty('libraryItemCounts', libraryItemCounts))
|
||||
..add(DiagnosticsProperty('fetchingItems', fetchingItems));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
||||
return 'LibrarySearchModel(loading: $loading, selecteMode: $selecteMode, folderOverwrite: $folderOverwrite, searchQuery: $searchQuery, views: $views, posters: $posters, selectedPosters: $selectedPosters, filters: $filters, lastIndices: $lastIndices, libraryItemCounts: $libraryItemCounts, fetchingItems: $fetchingItems)';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $LibrarySearchModelCopyWith<$Res> {
|
||||
factory $LibrarySearchModelCopyWith(
|
||||
LibrarySearchModel value, $Res Function(LibrarySearchModel) _then) =
|
||||
_$LibrarySearchModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool loading,
|
||||
bool selecteMode,
|
||||
List<ItemBaseModel> folderOverwrite,
|
||||
String searchQuery,
|
||||
Map<ViewModel, bool> views,
|
||||
List<ItemBaseModel> posters,
|
||||
List<ItemBaseModel> selectedPosters,
|
||||
LibraryFilterModel filters,
|
||||
Map<String, int> lastIndices,
|
||||
Map<String, int> libraryItemCounts,
|
||||
bool fetchingItems});
|
||||
|
||||
$LibraryFilterModelCopyWith<$Res> get filters;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LibrarySearchModelCopyWithImpl<$Res>
|
||||
implements $LibrarySearchModelCopyWith<$Res> {
|
||||
_$LibrarySearchModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final LibrarySearchModel _self;
|
||||
final $Res Function(LibrarySearchModel) _then;
|
||||
|
||||
/// Create a copy of LibrarySearchModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? loading = null,
|
||||
Object? selecteMode = null,
|
||||
Object? folderOverwrite = null,
|
||||
Object? searchQuery = null,
|
||||
Object? views = null,
|
||||
Object? posters = null,
|
||||
Object? selectedPosters = null,
|
||||
Object? filters = null,
|
||||
Object? lastIndices = null,
|
||||
Object? libraryItemCounts = null,
|
||||
Object? fetchingItems = null,
|
||||
}) {
|
||||
return _then(_self.copyWith(
|
||||
loading: null == loading
|
||||
? _self.loading
|
||||
: loading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
selecteMode: null == selecteMode
|
||||
? _self.selecteMode
|
||||
: selecteMode // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
folderOverwrite: null == folderOverwrite
|
||||
? _self.folderOverwrite
|
||||
: folderOverwrite // ignore: cast_nullable_to_non_nullable
|
||||
as List<ItemBaseModel>,
|
||||
searchQuery: null == searchQuery
|
||||
? _self.searchQuery
|
||||
: searchQuery // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
views: null == views
|
||||
? _self.views
|
||||
: views // ignore: cast_nullable_to_non_nullable
|
||||
as Map<ViewModel, bool>,
|
||||
posters: null == posters
|
||||
? _self.posters
|
||||
: posters // ignore: cast_nullable_to_non_nullable
|
||||
as List<ItemBaseModel>,
|
||||
selectedPosters: null == selectedPosters
|
||||
? _self.selectedPosters
|
||||
: selectedPosters // ignore: cast_nullable_to_non_nullable
|
||||
as List<ItemBaseModel>,
|
||||
filters: null == filters
|
||||
? _self.filters
|
||||
: filters // ignore: cast_nullable_to_non_nullable
|
||||
as LibraryFilterModel,
|
||||
lastIndices: null == lastIndices
|
||||
? _self.lastIndices
|
||||
: lastIndices // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, int>,
|
||||
libraryItemCounts: null == libraryItemCounts
|
||||
? _self.libraryItemCounts
|
||||
: libraryItemCounts // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, int>,
|
||||
fetchingItems: null == fetchingItems
|
||||
? _self.fetchingItems
|
||||
: fetchingItems // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of LibrarySearchModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LibraryFilterModelCopyWith<$Res> get filters {
|
||||
return $LibraryFilterModelCopyWith<$Res>(_self.filters, (value) {
|
||||
return _then(_self.copyWith(filters: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds pattern-matching-related methods to [LibrarySearchModel].
|
||||
extension LibrarySearchModelPatterns on LibrarySearchModel {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>(
|
||||
TResult Function(_LibrarySearchModel value)? $default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibrarySearchModel() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>(
|
||||
TResult Function(_LibrarySearchModel value) $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibrarySearchModel():
|
||||
return $default(_that);
|
||||
case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>(
|
||||
TResult? Function(_LibrarySearchModel value)? $default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibrarySearchModel() when $default != null:
|
||||
return $default(_that);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>(
|
||||
TResult Function(
|
||||
bool loading,
|
||||
bool selecteMode,
|
||||
List<ItemBaseModel> folderOverwrite,
|
||||
String searchQuery,
|
||||
Map<ViewModel, bool> views,
|
||||
List<ItemBaseModel> posters,
|
||||
List<ItemBaseModel> selectedPosters,
|
||||
LibraryFilterModel filters,
|
||||
Map<String, int> lastIndices,
|
||||
Map<String, int> libraryItemCounts,
|
||||
bool fetchingItems)?
|
||||
$default, {
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibrarySearchModel() when $default != null:
|
||||
return $default(
|
||||
_that.loading,
|
||||
_that.selecteMode,
|
||||
_that.folderOverwrite,
|
||||
_that.searchQuery,
|
||||
_that.views,
|
||||
_that.posters,
|
||||
_that.selectedPosters,
|
||||
_that.filters,
|
||||
_that.lastIndices,
|
||||
_that.libraryItemCounts,
|
||||
_that.fetchingItems);
|
||||
case _:
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>(
|
||||
TResult Function(
|
||||
bool loading,
|
||||
bool selecteMode,
|
||||
List<ItemBaseModel> folderOverwrite,
|
||||
String searchQuery,
|
||||
Map<ViewModel, bool> views,
|
||||
List<ItemBaseModel> posters,
|
||||
List<ItemBaseModel> selectedPosters,
|
||||
LibraryFilterModel filters,
|
||||
Map<String, int> lastIndices,
|
||||
Map<String, int> libraryItemCounts,
|
||||
bool fetchingItems)
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibrarySearchModel():
|
||||
return $default(
|
||||
_that.loading,
|
||||
_that.selecteMode,
|
||||
_that.folderOverwrite,
|
||||
_that.searchQuery,
|
||||
_that.views,
|
||||
_that.posters,
|
||||
_that.selectedPosters,
|
||||
_that.filters,
|
||||
_that.lastIndices,
|
||||
_that.libraryItemCounts,
|
||||
_that.fetchingItems);
|
||||
case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
}
|
||||
}
|
||||
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>(
|
||||
TResult? Function(
|
||||
bool loading,
|
||||
bool selecteMode,
|
||||
List<ItemBaseModel> folderOverwrite,
|
||||
String searchQuery,
|
||||
Map<ViewModel, bool> views,
|
||||
List<ItemBaseModel> posters,
|
||||
List<ItemBaseModel> selectedPosters,
|
||||
LibraryFilterModel filters,
|
||||
Map<String, int> lastIndices,
|
||||
Map<String, int> libraryItemCounts,
|
||||
bool fetchingItems)?
|
||||
$default,
|
||||
) {
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _LibrarySearchModel() when $default != null:
|
||||
return $default(
|
||||
_that.loading,
|
||||
_that.selecteMode,
|
||||
_that.folderOverwrite,
|
||||
_that.searchQuery,
|
||||
_that.views,
|
||||
_that.posters,
|
||||
_that.selectedPosters,
|
||||
_that.filters,
|
||||
_that.lastIndices,
|
||||
_that.libraryItemCounts,
|
||||
_that.fetchingItems);
|
||||
case _:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _LibrarySearchModel
|
||||
with DiagnosticableTreeMixin
|
||||
implements LibrarySearchModel {
|
||||
const _LibrarySearchModel(
|
||||
{this.loading = false,
|
||||
this.selecteMode = false,
|
||||
final List<ItemBaseModel> folderOverwrite = const <ItemBaseModel>[],
|
||||
this.searchQuery = "",
|
||||
final Map<ViewModel, bool> views = const <ViewModel, bool>{},
|
||||
final List<ItemBaseModel> posters = const <ItemBaseModel>[],
|
||||
final List<ItemBaseModel> selectedPosters = const <ItemBaseModel>[],
|
||||
this.filters = const LibraryFilterModel(),
|
||||
final Map<String, int> lastIndices = const <String, int>{},
|
||||
final Map<String, int> libraryItemCounts = const <String, int>{},
|
||||
this.fetchingItems = false})
|
||||
: _folderOverwrite = folderOverwrite,
|
||||
_views = views,
|
||||
_posters = posters,
|
||||
_selectedPosters = selectedPosters,
|
||||
_lastIndices = lastIndices,
|
||||
_libraryItemCounts = libraryItemCounts;
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool loading;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool selecteMode;
|
||||
final List<ItemBaseModel> _folderOverwrite;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<ItemBaseModel> get folderOverwrite {
|
||||
if (_folderOverwrite is EqualUnmodifiableListView) return _folderOverwrite;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_folderOverwrite);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final String searchQuery;
|
||||
final Map<ViewModel, bool> _views;
|
||||
@override
|
||||
@JsonKey()
|
||||
Map<ViewModel, bool> get views {
|
||||
if (_views is EqualUnmodifiableMapView) return _views;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_views);
|
||||
}
|
||||
|
||||
final List<ItemBaseModel> _posters;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<ItemBaseModel> get posters {
|
||||
if (_posters is EqualUnmodifiableListView) return _posters;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_posters);
|
||||
}
|
||||
|
||||
final List<ItemBaseModel> _selectedPosters;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<ItemBaseModel> get selectedPosters {
|
||||
if (_selectedPosters is EqualUnmodifiableListView) return _selectedPosters;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_selectedPosters);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final LibraryFilterModel filters;
|
||||
final Map<String, int> _lastIndices;
|
||||
@override
|
||||
@JsonKey()
|
||||
Map<String, int> get lastIndices {
|
||||
if (_lastIndices is EqualUnmodifiableMapView) return _lastIndices;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_lastIndices);
|
||||
}
|
||||
|
||||
final Map<String, int> _libraryItemCounts;
|
||||
@override
|
||||
@JsonKey()
|
||||
Map<String, int> get libraryItemCounts {
|
||||
if (_libraryItemCounts is EqualUnmodifiableMapView)
|
||||
return _libraryItemCounts;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableMapView(_libraryItemCounts);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool fetchingItems;
|
||||
|
||||
/// Create a copy of LibrarySearchModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$LibrarySearchModelCopyWith<_LibrarySearchModel> get copyWith =>
|
||||
__$LibrarySearchModelCopyWithImpl<_LibrarySearchModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'LibrarySearchModel'))
|
||||
..add(DiagnosticsProperty('loading', loading))
|
||||
..add(DiagnosticsProperty('selecteMode', selecteMode))
|
||||
..add(DiagnosticsProperty('folderOverwrite', folderOverwrite))
|
||||
..add(DiagnosticsProperty('searchQuery', searchQuery))
|
||||
..add(DiagnosticsProperty('views', views))
|
||||
..add(DiagnosticsProperty('posters', posters))
|
||||
..add(DiagnosticsProperty('selectedPosters', selectedPosters))
|
||||
..add(DiagnosticsProperty('filters', filters))
|
||||
..add(DiagnosticsProperty('lastIndices', lastIndices))
|
||||
..add(DiagnosticsProperty('libraryItemCounts', libraryItemCounts))
|
||||
..add(DiagnosticsProperty('fetchingItems', fetchingItems));
|
||||
}
|
||||
|
||||
@override
|
||||
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
|
||||
return 'LibrarySearchModel(loading: $loading, selecteMode: $selecteMode, folderOverwrite: $folderOverwrite, searchQuery: $searchQuery, views: $views, posters: $posters, selectedPosters: $selectedPosters, filters: $filters, lastIndices: $lastIndices, libraryItemCounts: $libraryItemCounts, fetchingItems: $fetchingItems)';
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$LibrarySearchModelCopyWith<$Res>
|
||||
implements $LibrarySearchModelCopyWith<$Res> {
|
||||
factory _$LibrarySearchModelCopyWith(
|
||||
_LibrarySearchModel value, $Res Function(_LibrarySearchModel) _then) =
|
||||
__$LibrarySearchModelCopyWithImpl;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool loading,
|
||||
bool selecteMode,
|
||||
List<ItemBaseModel> folderOverwrite,
|
||||
String searchQuery,
|
||||
Map<ViewModel, bool> views,
|
||||
List<ItemBaseModel> posters,
|
||||
List<ItemBaseModel> selectedPosters,
|
||||
LibraryFilterModel filters,
|
||||
Map<String, int> lastIndices,
|
||||
Map<String, int> libraryItemCounts,
|
||||
bool fetchingItems});
|
||||
|
||||
@override
|
||||
$LibraryFilterModelCopyWith<$Res> get filters;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$LibrarySearchModelCopyWithImpl<$Res>
|
||||
implements _$LibrarySearchModelCopyWith<$Res> {
|
||||
__$LibrarySearchModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _LibrarySearchModel _self;
|
||||
final $Res Function(_LibrarySearchModel) _then;
|
||||
|
||||
/// Create a copy of LibrarySearchModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$Res call({
|
||||
Object? loading = null,
|
||||
Object? selecteMode = null,
|
||||
Object? folderOverwrite = null,
|
||||
Object? searchQuery = null,
|
||||
Object? views = null,
|
||||
Object? posters = null,
|
||||
Object? selectedPosters = null,
|
||||
Object? filters = null,
|
||||
Object? lastIndices = null,
|
||||
Object? libraryItemCounts = null,
|
||||
Object? fetchingItems = null,
|
||||
}) {
|
||||
return _then(_LibrarySearchModel(
|
||||
loading: null == loading
|
||||
? _self.loading
|
||||
: loading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
selecteMode: null == selecteMode
|
||||
? _self.selecteMode
|
||||
: selecteMode // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
folderOverwrite: null == folderOverwrite
|
||||
? _self._folderOverwrite
|
||||
: folderOverwrite // ignore: cast_nullable_to_non_nullable
|
||||
as List<ItemBaseModel>,
|
||||
searchQuery: null == searchQuery
|
||||
? _self.searchQuery
|
||||
: searchQuery // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
views: null == views
|
||||
? _self._views
|
||||
: views // ignore: cast_nullable_to_non_nullable
|
||||
as Map<ViewModel, bool>,
|
||||
posters: null == posters
|
||||
? _self._posters
|
||||
: posters // ignore: cast_nullable_to_non_nullable
|
||||
as List<ItemBaseModel>,
|
||||
selectedPosters: null == selectedPosters
|
||||
? _self._selectedPosters
|
||||
: selectedPosters // ignore: cast_nullable_to_non_nullable
|
||||
as List<ItemBaseModel>,
|
||||
filters: null == filters
|
||||
? _self.filters
|
||||
: filters // ignore: cast_nullable_to_non_nullable
|
||||
as LibraryFilterModel,
|
||||
lastIndices: null == lastIndices
|
||||
? _self._lastIndices
|
||||
: lastIndices // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, int>,
|
||||
libraryItemCounts: null == libraryItemCounts
|
||||
? _self._libraryItemCounts
|
||||
: libraryItemCounts // ignore: cast_nullable_to_non_nullable
|
||||
as Map<String, int>,
|
||||
fetchingItems: null == fetchingItems
|
||||
? _self.fetchingItems
|
||||
: fetchingItems // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of LibrarySearchModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LibraryFilterModelCopyWith<$Res> get filters {
|
||||
return $LibraryFilterModelCopyWith<$Res>(_self.filters, (value) {
|
||||
return _then(_self.copyWith(filters: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
|
|
@ -1,395 +0,0 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, unnecessary_cast, override_on_non_overriding_member
|
||||
// ignore_for_file: strict_raw_type, inference_failure_on_untyped_parameter
|
||||
|
||||
part of 'library_search_model.dart';
|
||||
|
||||
class LibrarySearchModelMapper extends ClassMapperBase<LibrarySearchModel> {
|
||||
LibrarySearchModelMapper._();
|
||||
|
||||
static LibrarySearchModelMapper? _instance;
|
||||
static LibrarySearchModelMapper ensureInitialized() {
|
||||
if (_instance == null) {
|
||||
MapperContainer.globals.use(_instance = LibrarySearchModelMapper._());
|
||||
ItemBaseModelMapper.ensureInitialized();
|
||||
}
|
||||
return _instance!;
|
||||
}
|
||||
|
||||
@override
|
||||
final String id = 'LibrarySearchModel';
|
||||
|
||||
static bool _$loading(LibrarySearchModel v) => v.loading;
|
||||
static const Field<LibrarySearchModel, bool> _f$loading =
|
||||
Field('loading', _$loading, opt: true, def: false);
|
||||
static bool _$selecteMode(LibrarySearchModel v) => v.selecteMode;
|
||||
static const Field<LibrarySearchModel, bool> _f$selecteMode =
|
||||
Field('selecteMode', _$selecteMode, opt: true, def: false);
|
||||
static List<ItemBaseModel> _$folderOverwrite(LibrarySearchModel v) =>
|
||||
v.folderOverwrite;
|
||||
static const Field<LibrarySearchModel, List<ItemBaseModel>>
|
||||
_f$folderOverwrite =
|
||||
Field('folderOverwrite', _$folderOverwrite, opt: true, def: const []);
|
||||
static String _$searchQuery(LibrarySearchModel v) => v.searchQuery;
|
||||
static const Field<LibrarySearchModel, String> _f$searchQuery =
|
||||
Field('searchQuery', _$searchQuery, opt: true, def: "");
|
||||
static Map<ViewModel, bool> _$views(LibrarySearchModel v) => v.views;
|
||||
static const Field<LibrarySearchModel, Map<ViewModel, bool>> _f$views =
|
||||
Field('views', _$views, opt: true, def: const {});
|
||||
static List<ItemBaseModel> _$posters(LibrarySearchModel v) => v.posters;
|
||||
static const Field<LibrarySearchModel, List<ItemBaseModel>> _f$posters =
|
||||
Field('posters', _$posters, opt: true, def: const []);
|
||||
static List<ItemBaseModel> _$selectedPosters(LibrarySearchModel v) =>
|
||||
v.selectedPosters;
|
||||
static const Field<LibrarySearchModel, List<ItemBaseModel>>
|
||||
_f$selectedPosters =
|
||||
Field('selectedPosters', _$selectedPosters, opt: true, def: const []);
|
||||
static Map<ItemFilter, bool> _$filters(LibrarySearchModel v) => v.filters;
|
||||
static const Field<LibrarySearchModel, Map<ItemFilter, bool>> _f$filters =
|
||||
Field('filters', _$filters, opt: true, def: const {
|
||||
ItemFilter.isplayed: false,
|
||||
ItemFilter.isunplayed: false,
|
||||
ItemFilter.isresumable: false
|
||||
});
|
||||
static Map<String, bool> _$genres(LibrarySearchModel v) => v.genres;
|
||||
static const Field<LibrarySearchModel, Map<String, bool>> _f$genres =
|
||||
Field('genres', _$genres, opt: true, def: const {});
|
||||
static Map<Studio, bool> _$studios(LibrarySearchModel v) => v.studios;
|
||||
static const Field<LibrarySearchModel, Map<Studio, bool>> _f$studios =
|
||||
Field('studios', _$studios, opt: true, def: const {});
|
||||
static Map<String, bool> _$tags(LibrarySearchModel v) => v.tags;
|
||||
static const Field<LibrarySearchModel, Map<String, bool>> _f$tags =
|
||||
Field('tags', _$tags, opt: true, def: const {});
|
||||
static Map<int, bool> _$years(LibrarySearchModel v) => v.years;
|
||||
static const Field<LibrarySearchModel, Map<int, bool>> _f$years =
|
||||
Field('years', _$years, opt: true, def: const {});
|
||||
static Map<String, bool> _$officialRatings(LibrarySearchModel v) =>
|
||||
v.officialRatings;
|
||||
static const Field<LibrarySearchModel, Map<String, bool>> _f$officialRatings =
|
||||
Field('officialRatings', _$officialRatings, opt: true, def: const {});
|
||||
static Map<FladderItemType, bool> _$types(LibrarySearchModel v) => v.types;
|
||||
static const Field<LibrarySearchModel, Map<FladderItemType, bool>> _f$types =
|
||||
Field('types', _$types, opt: true, def: const {
|
||||
FladderItemType.audio: false,
|
||||
FladderItemType.boxset: false,
|
||||
FladderItemType.book: false,
|
||||
FladderItemType.collectionFolder: false,
|
||||
FladderItemType.episode: false,
|
||||
FladderItemType.folder: false,
|
||||
FladderItemType.movie: true,
|
||||
FladderItemType.musicAlbum: false,
|
||||
FladderItemType.musicVideo: false,
|
||||
FladderItemType.photo: false,
|
||||
FladderItemType.person: false,
|
||||
FladderItemType.photoAlbum: false,
|
||||
FladderItemType.series: true,
|
||||
FladderItemType.video: true
|
||||
});
|
||||
static bool _$favourites(LibrarySearchModel v) => v.favourites;
|
||||
static const Field<LibrarySearchModel, bool> _f$favourites =
|
||||
Field('favourites', _$favourites, opt: true, def: false);
|
||||
static SortingOptions _$sortingOption(LibrarySearchModel v) =>
|
||||
v.sortingOption;
|
||||
static const Field<LibrarySearchModel, SortingOptions> _f$sortingOption =
|
||||
Field('sortingOption', _$sortingOption,
|
||||
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);
|
||||
static bool _$hideEmptyShows(LibrarySearchModel v) => v.hideEmptyShows;
|
||||
static const Field<LibrarySearchModel, bool> _f$hideEmptyShows =
|
||||
Field('hideEmptyShows', _$hideEmptyShows, opt: true, def: true);
|
||||
static bool _$recursive(LibrarySearchModel v) => v.recursive;
|
||||
static const Field<LibrarySearchModel, bool> _f$recursive =
|
||||
Field('recursive', _$recursive, opt: true, def: false);
|
||||
static GroupBy _$groupBy(LibrarySearchModel v) => v.groupBy;
|
||||
static const Field<LibrarySearchModel, GroupBy> _f$groupBy =
|
||||
Field('groupBy', _$groupBy, opt: true, def: GroupBy.none);
|
||||
static Map<String, int> _$lastIndices(LibrarySearchModel v) => v.lastIndices;
|
||||
static const Field<LibrarySearchModel, Map<String, int>> _f$lastIndices =
|
||||
Field('lastIndices', _$lastIndices, opt: true, def: const {});
|
||||
static Map<String, int> _$libraryItemCounts(LibrarySearchModel v) =>
|
||||
v.libraryItemCounts;
|
||||
static const Field<LibrarySearchModel, Map<String, int>>
|
||||
_f$libraryItemCounts =
|
||||
Field('libraryItemCounts', _$libraryItemCounts, opt: true, def: const {});
|
||||
static bool _$fetchingItems(LibrarySearchModel v) => v.fetchingItems;
|
||||
static const Field<LibrarySearchModel, bool> _f$fetchingItems =
|
||||
Field('fetchingItems', _$fetchingItems, opt: true, def: false);
|
||||
|
||||
@override
|
||||
final MappableFields<LibrarySearchModel> fields = const {
|
||||
#loading: _f$loading,
|
||||
#selecteMode: _f$selecteMode,
|
||||
#folderOverwrite: _f$folderOverwrite,
|
||||
#searchQuery: _f$searchQuery,
|
||||
#views: _f$views,
|
||||
#posters: _f$posters,
|
||||
#selectedPosters: _f$selectedPosters,
|
||||
#filters: _f$filters,
|
||||
#genres: _f$genres,
|
||||
#studios: _f$studios,
|
||||
#tags: _f$tags,
|
||||
#years: _f$years,
|
||||
#officialRatings: _f$officialRatings,
|
||||
#types: _f$types,
|
||||
#favourites: _f$favourites,
|
||||
#sortingOption: _f$sortingOption,
|
||||
#sortOrder: _f$sortOrder,
|
||||
#hideEmptyShows: _f$hideEmptyShows,
|
||||
#recursive: _f$recursive,
|
||||
#groupBy: _f$groupBy,
|
||||
#lastIndices: _f$lastIndices,
|
||||
#libraryItemCounts: _f$libraryItemCounts,
|
||||
#fetchingItems: _f$fetchingItems,
|
||||
};
|
||||
@override
|
||||
final bool ignoreNull = true;
|
||||
|
||||
static LibrarySearchModel _instantiate(DecodingData data) {
|
||||
return LibrarySearchModel(
|
||||
loading: data.dec(_f$loading),
|
||||
selecteMode: data.dec(_f$selecteMode),
|
||||
folderOverwrite: data.dec(_f$folderOverwrite),
|
||||
searchQuery: data.dec(_f$searchQuery),
|
||||
views: data.dec(_f$views),
|
||||
posters: data.dec(_f$posters),
|
||||
selectedPosters: data.dec(_f$selectedPosters),
|
||||
filters: data.dec(_f$filters),
|
||||
genres: data.dec(_f$genres),
|
||||
studios: data.dec(_f$studios),
|
||||
tags: data.dec(_f$tags),
|
||||
years: data.dec(_f$years),
|
||||
officialRatings: data.dec(_f$officialRatings),
|
||||
types: data.dec(_f$types),
|
||||
favourites: data.dec(_f$favourites),
|
||||
sortingOption: data.dec(_f$sortingOption),
|
||||
sortOrder: data.dec(_f$sortOrder),
|
||||
hideEmptyShows: data.dec(_f$hideEmptyShows),
|
||||
recursive: data.dec(_f$recursive),
|
||||
groupBy: data.dec(_f$groupBy),
|
||||
lastIndices: data.dec(_f$lastIndices),
|
||||
libraryItemCounts: data.dec(_f$libraryItemCounts),
|
||||
fetchingItems: data.dec(_f$fetchingItems));
|
||||
}
|
||||
|
||||
@override
|
||||
final Function instantiate = _instantiate;
|
||||
}
|
||||
|
||||
mixin LibrarySearchModelMappable {
|
||||
LibrarySearchModelCopyWith<LibrarySearchModel, LibrarySearchModel,
|
||||
LibrarySearchModel>
|
||||
get copyWith => _LibrarySearchModelCopyWithImpl<LibrarySearchModel,
|
||||
LibrarySearchModel>(this as LibrarySearchModel, $identity, $identity);
|
||||
}
|
||||
|
||||
extension LibrarySearchModelValueCopy<$R, $Out>
|
||||
on ObjectCopyWith<$R, LibrarySearchModel, $Out> {
|
||||
LibrarySearchModelCopyWith<$R, LibrarySearchModel, $Out>
|
||||
get $asLibrarySearchModel => $base.as(
|
||||
(v, t, t2) => _LibrarySearchModelCopyWithImpl<$R, $Out>(v, t, t2));
|
||||
}
|
||||
|
||||
abstract class LibrarySearchModelCopyWith<$R, $In extends LibrarySearchModel,
|
||||
$Out> implements ClassCopyWith<$R, $In, $Out> {
|
||||
ListCopyWith<$R, ItemBaseModel,
|
||||
ItemBaseModelCopyWith<$R, ItemBaseModel, ItemBaseModel>>
|
||||
get folderOverwrite;
|
||||
MapCopyWith<$R, ViewModel, bool, ObjectCopyWith<$R, bool, bool>> get views;
|
||||
ListCopyWith<$R, ItemBaseModel,
|
||||
ItemBaseModelCopyWith<$R, ItemBaseModel, ItemBaseModel>> get posters;
|
||||
ListCopyWith<$R, ItemBaseModel,
|
||||
ItemBaseModelCopyWith<$R, ItemBaseModel, ItemBaseModel>>
|
||||
get selectedPosters;
|
||||
MapCopyWith<$R, ItemFilter, bool, ObjectCopyWith<$R, bool, bool>> get filters;
|
||||
MapCopyWith<$R, String, bool, ObjectCopyWith<$R, bool, bool>> get genres;
|
||||
MapCopyWith<$R, Studio, bool, ObjectCopyWith<$R, bool, bool>> get studios;
|
||||
MapCopyWith<$R, String, bool, ObjectCopyWith<$R, bool, bool>> get tags;
|
||||
MapCopyWith<$R, int, bool, ObjectCopyWith<$R, bool, bool>> get years;
|
||||
MapCopyWith<$R, String, bool, ObjectCopyWith<$R, bool, bool>>
|
||||
get officialRatings;
|
||||
MapCopyWith<$R, FladderItemType, bool, ObjectCopyWith<$R, bool, bool>>
|
||||
get types;
|
||||
MapCopyWith<$R, String, int, ObjectCopyWith<$R, int, int>> get lastIndices;
|
||||
MapCopyWith<$R, String, int, ObjectCopyWith<$R, int, int>>
|
||||
get libraryItemCounts;
|
||||
$R call(
|
||||
{bool? loading,
|
||||
bool? selecteMode,
|
||||
List<ItemBaseModel>? folderOverwrite,
|
||||
String? searchQuery,
|
||||
Map<ViewModel, bool>? views,
|
||||
List<ItemBaseModel>? posters,
|
||||
List<ItemBaseModel>? selectedPosters,
|
||||
Map<ItemFilter, bool>? filters,
|
||||
Map<String, bool>? genres,
|
||||
Map<Studio, bool>? studios,
|
||||
Map<String, bool>? tags,
|
||||
Map<int, bool>? years,
|
||||
Map<String, bool>? officialRatings,
|
||||
Map<FladderItemType, bool>? types,
|
||||
bool? favourites,
|
||||
SortingOptions? sortingOption,
|
||||
SortingOrder? sortOrder,
|
||||
bool? hideEmptyShows,
|
||||
bool? recursive,
|
||||
GroupBy? groupBy,
|
||||
Map<String, int>? lastIndices,
|
||||
Map<String, int>? libraryItemCounts,
|
||||
bool? fetchingItems});
|
||||
LibrarySearchModelCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(
|
||||
Then<$Out2, $R2> t);
|
||||
}
|
||||
|
||||
class _LibrarySearchModelCopyWithImpl<$R, $Out>
|
||||
extends ClassCopyWithBase<$R, LibrarySearchModel, $Out>
|
||||
implements LibrarySearchModelCopyWith<$R, LibrarySearchModel, $Out> {
|
||||
_LibrarySearchModelCopyWithImpl(super.value, super.then, super.then2);
|
||||
|
||||
@override
|
||||
late final ClassMapperBase<LibrarySearchModel> $mapper =
|
||||
LibrarySearchModelMapper.ensureInitialized();
|
||||
@override
|
||||
ListCopyWith<$R, ItemBaseModel,
|
||||
ItemBaseModelCopyWith<$R, ItemBaseModel, ItemBaseModel>>
|
||||
get folderOverwrite => ListCopyWith($value.folderOverwrite,
|
||||
(v, t) => v.copyWith.$chain(t), (v) => call(folderOverwrite: v));
|
||||
@override
|
||||
MapCopyWith<$R, ViewModel, bool, ObjectCopyWith<$R, bool, bool>> get views =>
|
||||
MapCopyWith($value.views, (v, t) => ObjectCopyWith(v, $identity, t),
|
||||
(v) => call(views: v));
|
||||
@override
|
||||
ListCopyWith<$R, ItemBaseModel,
|
||||
ItemBaseModelCopyWith<$R, ItemBaseModel, ItemBaseModel>>
|
||||
get posters => ListCopyWith($value.posters,
|
||||
(v, t) => v.copyWith.$chain(t), (v) => call(posters: v));
|
||||
@override
|
||||
ListCopyWith<$R, ItemBaseModel,
|
||||
ItemBaseModelCopyWith<$R, ItemBaseModel, ItemBaseModel>>
|
||||
get selectedPosters => ListCopyWith($value.selectedPosters,
|
||||
(v, t) => v.copyWith.$chain(t), (v) => call(selectedPosters: v));
|
||||
@override
|
||||
MapCopyWith<$R, ItemFilter, bool, ObjectCopyWith<$R, bool, bool>>
|
||||
get filters => MapCopyWith($value.filters,
|
||||
(v, t) => ObjectCopyWith(v, $identity, t), (v) => call(filters: v));
|
||||
@override
|
||||
MapCopyWith<$R, String, bool, ObjectCopyWith<$R, bool, bool>> get genres =>
|
||||
MapCopyWith($value.genres, (v, t) => ObjectCopyWith(v, $identity, t),
|
||||
(v) => call(genres: v));
|
||||
@override
|
||||
MapCopyWith<$R, Studio, bool, ObjectCopyWith<$R, bool, bool>> get studios =>
|
||||
MapCopyWith($value.studios, (v, t) => ObjectCopyWith(v, $identity, t),
|
||||
(v) => call(studios: v));
|
||||
@override
|
||||
MapCopyWith<$R, String, bool, ObjectCopyWith<$R, bool, bool>> get tags =>
|
||||
MapCopyWith($value.tags, (v, t) => ObjectCopyWith(v, $identity, t),
|
||||
(v) => call(tags: v));
|
||||
@override
|
||||
MapCopyWith<$R, int, bool, ObjectCopyWith<$R, bool, bool>> get years =>
|
||||
MapCopyWith($value.years, (v, t) => ObjectCopyWith(v, $identity, t),
|
||||
(v) => call(years: v));
|
||||
@override
|
||||
MapCopyWith<$R, String, bool, ObjectCopyWith<$R, bool, bool>>
|
||||
get officialRatings => MapCopyWith(
|
||||
$value.officialRatings,
|
||||
(v, t) => ObjectCopyWith(v, $identity, t),
|
||||
(v) => call(officialRatings: v));
|
||||
@override
|
||||
MapCopyWith<$R, FladderItemType, bool, ObjectCopyWith<$R, bool, bool>>
|
||||
get types => MapCopyWith($value.types,
|
||||
(v, t) => ObjectCopyWith(v, $identity, t), (v) => call(types: v));
|
||||
@override
|
||||
MapCopyWith<$R, String, int, ObjectCopyWith<$R, int, int>> get lastIndices =>
|
||||
MapCopyWith($value.lastIndices, (v, t) => ObjectCopyWith(v, $identity, t),
|
||||
(v) => call(lastIndices: v));
|
||||
@override
|
||||
MapCopyWith<$R, String, int, ObjectCopyWith<$R, int, int>>
|
||||
get libraryItemCounts => MapCopyWith(
|
||||
$value.libraryItemCounts,
|
||||
(v, t) => ObjectCopyWith(v, $identity, t),
|
||||
(v) => call(libraryItemCounts: v));
|
||||
@override
|
||||
$R call(
|
||||
{bool? loading,
|
||||
bool? selecteMode,
|
||||
List<ItemBaseModel>? folderOverwrite,
|
||||
String? searchQuery,
|
||||
Map<ViewModel, bool>? views,
|
||||
List<ItemBaseModel>? posters,
|
||||
List<ItemBaseModel>? selectedPosters,
|
||||
Map<ItemFilter, bool>? filters,
|
||||
Map<String, bool>? genres,
|
||||
Map<Studio, bool>? studios,
|
||||
Map<String, bool>? tags,
|
||||
Map<int, bool>? years,
|
||||
Map<String, bool>? officialRatings,
|
||||
Map<FladderItemType, bool>? types,
|
||||
bool? favourites,
|
||||
SortingOptions? sortingOption,
|
||||
SortingOrder? sortOrder,
|
||||
bool? hideEmptyShows,
|
||||
bool? recursive,
|
||||
GroupBy? groupBy,
|
||||
Map<String, int>? lastIndices,
|
||||
Map<String, int>? libraryItemCounts,
|
||||
bool? fetchingItems}) =>
|
||||
$apply(FieldCopyWithData({
|
||||
if (loading != null) #loading: loading,
|
||||
if (selecteMode != null) #selecteMode: selecteMode,
|
||||
if (folderOverwrite != null) #folderOverwrite: folderOverwrite,
|
||||
if (searchQuery != null) #searchQuery: searchQuery,
|
||||
if (views != null) #views: views,
|
||||
if (posters != null) #posters: posters,
|
||||
if (selectedPosters != null) #selectedPosters: selectedPosters,
|
||||
if (filters != null) #filters: filters,
|
||||
if (genres != null) #genres: genres,
|
||||
if (studios != null) #studios: studios,
|
||||
if (tags != null) #tags: tags,
|
||||
if (years != null) #years: years,
|
||||
if (officialRatings != null) #officialRatings: officialRatings,
|
||||
if (types != null) #types: types,
|
||||
if (favourites != null) #favourites: favourites,
|
||||
if (sortingOption != null) #sortingOption: sortingOption,
|
||||
if (sortOrder != null) #sortOrder: sortOrder,
|
||||
if (hideEmptyShows != null) #hideEmptyShows: hideEmptyShows,
|
||||
if (recursive != null) #recursive: recursive,
|
||||
if (groupBy != null) #groupBy: groupBy,
|
||||
if (lastIndices != null) #lastIndices: lastIndices,
|
||||
if (libraryItemCounts != null) #libraryItemCounts: libraryItemCounts,
|
||||
if (fetchingItems != null) #fetchingItems: fetchingItems
|
||||
}));
|
||||
@override
|
||||
LibrarySearchModel $make(CopyWithData data) => LibrarySearchModel(
|
||||
loading: data.get(#loading, or: $value.loading),
|
||||
selecteMode: data.get(#selecteMode, or: $value.selecteMode),
|
||||
folderOverwrite: data.get(#folderOverwrite, or: $value.folderOverwrite),
|
||||
searchQuery: data.get(#searchQuery, or: $value.searchQuery),
|
||||
views: data.get(#views, or: $value.views),
|
||||
posters: data.get(#posters, or: $value.posters),
|
||||
selectedPosters: data.get(#selectedPosters, or: $value.selectedPosters),
|
||||
filters: data.get(#filters, or: $value.filters),
|
||||
genres: data.get(#genres, or: $value.genres),
|
||||
studios: data.get(#studios, or: $value.studios),
|
||||
tags: data.get(#tags, or: $value.tags),
|
||||
years: data.get(#years, or: $value.years),
|
||||
officialRatings: data.get(#officialRatings, or: $value.officialRatings),
|
||||
types: data.get(#types, or: $value.types),
|
||||
favourites: data.get(#favourites, or: $value.favourites),
|
||||
sortingOption: data.get(#sortingOption, or: $value.sortingOption),
|
||||
sortOrder: data.get(#sortOrder, or: $value.sortOrder),
|
||||
hideEmptyShows: data.get(#hideEmptyShows, or: $value.hideEmptyShows),
|
||||
recursive: data.get(#recursive, or: $value.recursive),
|
||||
groupBy: data.get(#groupBy, or: $value.groupBy),
|
||||
lastIndices: data.get(#lastIndices, or: $value.lastIndices),
|
||||
libraryItemCounts:
|
||||
data.get(#libraryItemCounts, or: $value.libraryItemCounts),
|
||||
fetchingItems: data.get(#fetchingItems, or: $value.fetchingItems));
|
||||
|
||||
@override
|
||||
LibrarySearchModelCopyWith<$R2, LibrarySearchModel, $Out2> $chain<$R2, $Out2>(
|
||||
Then<$Out2, $R2> t) =>
|
||||
_LibrarySearchModelCopyWithImpl<$R2, $Out2>($value, $cast, t);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue