mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-07 19:49:29 +00:00
kickoff library item
This commit is contained in:
parent
f8597f7430
commit
6c60d1c6ed
13 changed files with 439 additions and 99 deletions
|
|
@ -1,10 +1,11 @@
|
|||
// a freezed class to store the settings of the app
|
||||
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:shelfsdk/audiobookshelf_api.dart';
|
||||
|
||||
part 'library_item_extras.freezed.dart';
|
||||
part 'library_item_extras.g.dart';
|
||||
|
||||
/// any extras when navigating to a library item
|
||||
///
|
||||
|
|
@ -15,9 +16,8 @@ part 'library_item_extras.g.dart';
|
|||
class LibraryItemExtras with _$LibraryItemExtras {
|
||||
const factory LibraryItemExtras({
|
||||
BookMinified? book,
|
||||
String? heroTagSuffix,
|
||||
@Default('') String heroTagSuffix,
|
||||
Uint8List? coverImage,
|
||||
}) = _LibraryItemExtras;
|
||||
|
||||
factory LibraryItemExtras.fromJson(Map<String, dynamic> json) =>
|
||||
_$LibraryItemExtrasFromJson(json);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,16 +14,12 @@ T _$identity<T>(T value) => value;
|
|||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
LibraryItemExtras _$LibraryItemExtrasFromJson(Map<String, dynamic> json) {
|
||||
return _LibraryItemExtras.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LibraryItemExtras {
|
||||
BookMinified? get book => throw _privateConstructorUsedError;
|
||||
String? get heroTagSuffix => throw _privateConstructorUsedError;
|
||||
String get heroTagSuffix => throw _privateConstructorUsedError;
|
||||
Uint8List? get coverImage => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$LibraryItemExtrasCopyWith<LibraryItemExtras> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
|
|
@ -35,7 +31,7 @@ abstract class $LibraryItemExtrasCopyWith<$Res> {
|
|||
LibraryItemExtras value, $Res Function(LibraryItemExtras) then) =
|
||||
_$LibraryItemExtrasCopyWithImpl<$Res, LibraryItemExtras>;
|
||||
@useResult
|
||||
$Res call({BookMinified? book, String? heroTagSuffix});
|
||||
$Res call({BookMinified? book, String heroTagSuffix, Uint8List? coverImage});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
|
@ -52,17 +48,22 @@ class _$LibraryItemExtrasCopyWithImpl<$Res, $Val extends LibraryItemExtras>
|
|||
@override
|
||||
$Res call({
|
||||
Object? book = freezed,
|
||||
Object? heroTagSuffix = freezed,
|
||||
Object? heroTagSuffix = null,
|
||||
Object? coverImage = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
book: freezed == book
|
||||
? _value.book
|
||||
: book // ignore: cast_nullable_to_non_nullable
|
||||
as BookMinified?,
|
||||
heroTagSuffix: freezed == heroTagSuffix
|
||||
heroTagSuffix: null == heroTagSuffix
|
||||
? _value.heroTagSuffix
|
||||
: heroTagSuffix // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
as String,
|
||||
coverImage: freezed == coverImage
|
||||
? _value.coverImage
|
||||
: coverImage // ignore: cast_nullable_to_non_nullable
|
||||
as Uint8List?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
|
@ -75,7 +76,7 @@ abstract class _$$LibraryItemExtrasImplCopyWith<$Res>
|
|||
__$$LibraryItemExtrasImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({BookMinified? book, String? heroTagSuffix});
|
||||
$Res call({BookMinified? book, String heroTagSuffix, Uint8List? coverImage});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
|
@ -90,37 +91,43 @@ class __$$LibraryItemExtrasImplCopyWithImpl<$Res>
|
|||
@override
|
||||
$Res call({
|
||||
Object? book = freezed,
|
||||
Object? heroTagSuffix = freezed,
|
||||
Object? heroTagSuffix = null,
|
||||
Object? coverImage = freezed,
|
||||
}) {
|
||||
return _then(_$LibraryItemExtrasImpl(
|
||||
book: freezed == book
|
||||
? _value.book
|
||||
: book // ignore: cast_nullable_to_non_nullable
|
||||
as BookMinified?,
|
||||
heroTagSuffix: freezed == heroTagSuffix
|
||||
heroTagSuffix: null == heroTagSuffix
|
||||
? _value.heroTagSuffix
|
||||
: heroTagSuffix // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
as String,
|
||||
coverImage: freezed == coverImage
|
||||
? _value.coverImage
|
||||
: coverImage // ignore: cast_nullable_to_non_nullable
|
||||
as Uint8List?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$LibraryItemExtrasImpl implements _LibraryItemExtras {
|
||||
const _$LibraryItemExtrasImpl({this.book, this.heroTagSuffix});
|
||||
|
||||
factory _$LibraryItemExtrasImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$LibraryItemExtrasImplFromJson(json);
|
||||
class _$LibraryItemExtrasImpl implements _LibraryItemExtras {
|
||||
const _$LibraryItemExtrasImpl(
|
||||
{this.book, this.heroTagSuffix = '', this.coverImage});
|
||||
|
||||
@override
|
||||
final BookMinified? book;
|
||||
@override
|
||||
final String? heroTagSuffix;
|
||||
@JsonKey()
|
||||
final String heroTagSuffix;
|
||||
@override
|
||||
final Uint8List? coverImage;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LibraryItemExtras(book: $book, heroTagSuffix: $heroTagSuffix)';
|
||||
return 'LibraryItemExtras(book: $book, heroTagSuffix: $heroTagSuffix, coverImage: $coverImage)';
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -130,12 +137,14 @@ class _$LibraryItemExtrasImpl implements _LibraryItemExtras {
|
|||
other is _$LibraryItemExtrasImpl &&
|
||||
(identical(other.book, book) || other.book == book) &&
|
||||
(identical(other.heroTagSuffix, heroTagSuffix) ||
|
||||
other.heroTagSuffix == heroTagSuffix));
|
||||
other.heroTagSuffix == heroTagSuffix) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other.coverImage, coverImage));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, book, heroTagSuffix);
|
||||
int get hashCode => Object.hash(runtimeType, book, heroTagSuffix,
|
||||
const DeepCollectionEquality().hash(coverImage));
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
|
|
@ -143,27 +152,20 @@ class _$LibraryItemExtrasImpl implements _LibraryItemExtras {
|
|||
_$$LibraryItemExtrasImplCopyWith<_$LibraryItemExtrasImpl> get copyWith =>
|
||||
__$$LibraryItemExtrasImplCopyWithImpl<_$LibraryItemExtrasImpl>(
|
||||
this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$LibraryItemExtrasImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LibraryItemExtras implements LibraryItemExtras {
|
||||
const factory _LibraryItemExtras(
|
||||
{final BookMinified? book,
|
||||
final String? heroTagSuffix}) = _$LibraryItemExtrasImpl;
|
||||
|
||||
factory _LibraryItemExtras.fromJson(Map<String, dynamic> json) =
|
||||
_$LibraryItemExtrasImpl.fromJson;
|
||||
final String heroTagSuffix,
|
||||
final Uint8List? coverImage}) = _$LibraryItemExtrasImpl;
|
||||
|
||||
@override
|
||||
BookMinified? get book;
|
||||
@override
|
||||
String? get heroTagSuffix;
|
||||
String get heroTagSuffix;
|
||||
@override
|
||||
Uint8List? get coverImage;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$LibraryItemExtrasImplCopyWith<_$LibraryItemExtrasImpl> get copyWith =>
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'library_item_extras.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$LibraryItemExtrasImpl _$$LibraryItemExtrasImplFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$LibraryItemExtrasImpl(
|
||||
book: json['book'] == null
|
||||
? null
|
||||
: BookMinified.fromJson(json['book'] as Map<String, dynamic>),
|
||||
heroTagSuffix: json['heroTagSuffix'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$LibraryItemExtrasImplToJson(
|
||||
_$LibraryItemExtrasImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'book': instance.book,
|
||||
'heroTagSuffix': instance.heroTagSuffix,
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue