mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2026-02-17 14:59:35 +00:00
恢复
This commit is contained in:
parent
1ca8e4889a
commit
aad510ea45
31 changed files with 777 additions and 239 deletions
|
|
@ -10,8 +10,20 @@ class BookSettings with _$BookSettings {
|
|||
const factory BookSettings({
|
||||
required String bookId,
|
||||
@Default(NullablePlayerSettings()) NullablePlayerSettings playerSettings,
|
||||
BookProgress? progress,
|
||||
}) = _BookSettings;
|
||||
|
||||
factory BookSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$BookSettingsFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class BookProgress with _$BookProgress {
|
||||
const factory BookProgress({
|
||||
required DateTime lastUpdate,
|
||||
@Default(Duration.zero) Duration currentTime,
|
||||
}) = _BookProgress;
|
||||
|
||||
factory BookProgress.fromJson(Map<String, dynamic> json) =>
|
||||
_$BookProgressFromJson(json);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ mixin _$BookSettings {
|
|||
String get bookId => throw _privateConstructorUsedError;
|
||||
NullablePlayerSettings get playerSettings =>
|
||||
throw _privateConstructorUsedError;
|
||||
BookProgress? get progress => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this BookSettings to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
|
@ -40,9 +41,13 @@ abstract class $BookSettingsCopyWith<$Res> {
|
|||
BookSettings value, $Res Function(BookSettings) then) =
|
||||
_$BookSettingsCopyWithImpl<$Res, BookSettings>;
|
||||
@useResult
|
||||
$Res call({String bookId, NullablePlayerSettings playerSettings});
|
||||
$Res call(
|
||||
{String bookId,
|
||||
NullablePlayerSettings playerSettings,
|
||||
BookProgress? progress});
|
||||
|
||||
$NullablePlayerSettingsCopyWith<$Res> get playerSettings;
|
||||
$BookProgressCopyWith<$Res>? get progress;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
|
@ -62,6 +67,7 @@ class _$BookSettingsCopyWithImpl<$Res, $Val extends BookSettings>
|
|||
$Res call({
|
||||
Object? bookId = null,
|
||||
Object? playerSettings = null,
|
||||
Object? progress = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
bookId: null == bookId
|
||||
|
|
@ -72,6 +78,10 @@ class _$BookSettingsCopyWithImpl<$Res, $Val extends BookSettings>
|
|||
? _value.playerSettings
|
||||
: playerSettings // ignore: cast_nullable_to_non_nullable
|
||||
as NullablePlayerSettings,
|
||||
progress: freezed == progress
|
||||
? _value.progress
|
||||
: progress // ignore: cast_nullable_to_non_nullable
|
||||
as BookProgress?,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
|
|
@ -85,6 +95,20 @@ class _$BookSettingsCopyWithImpl<$Res, $Val extends BookSettings>
|
|||
return _then(_value.copyWith(playerSettings: value) as $Val);
|
||||
});
|
||||
}
|
||||
|
||||
/// Create a copy of BookSettings
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$BookProgressCopyWith<$Res>? get progress {
|
||||
if (_value.progress == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $BookProgressCopyWith<$Res>(_value.progress!, (value) {
|
||||
return _then(_value.copyWith(progress: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
|
@ -95,10 +119,15 @@ abstract class _$$BookSettingsImplCopyWith<$Res>
|
|||
__$$BookSettingsImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String bookId, NullablePlayerSettings playerSettings});
|
||||
$Res call(
|
||||
{String bookId,
|
||||
NullablePlayerSettings playerSettings,
|
||||
BookProgress? progress});
|
||||
|
||||
@override
|
||||
$NullablePlayerSettingsCopyWith<$Res> get playerSettings;
|
||||
@override
|
||||
$BookProgressCopyWith<$Res>? get progress;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
|
@ -116,6 +145,7 @@ class __$$BookSettingsImplCopyWithImpl<$Res>
|
|||
$Res call({
|
||||
Object? bookId = null,
|
||||
Object? playerSettings = null,
|
||||
Object? progress = freezed,
|
||||
}) {
|
||||
return _then(_$BookSettingsImpl(
|
||||
bookId: null == bookId
|
||||
|
|
@ -126,6 +156,10 @@ class __$$BookSettingsImplCopyWithImpl<$Res>
|
|||
? _value.playerSettings
|
||||
: playerSettings // ignore: cast_nullable_to_non_nullable
|
||||
as NullablePlayerSettings,
|
||||
progress: freezed == progress
|
||||
? _value.progress
|
||||
: progress // ignore: cast_nullable_to_non_nullable
|
||||
as BookProgress?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -135,7 +169,8 @@ class __$$BookSettingsImplCopyWithImpl<$Res>
|
|||
class _$BookSettingsImpl implements _BookSettings {
|
||||
const _$BookSettingsImpl(
|
||||
{required this.bookId,
|
||||
this.playerSettings = const NullablePlayerSettings()});
|
||||
this.playerSettings = const NullablePlayerSettings(),
|
||||
this.progress});
|
||||
|
||||
factory _$BookSettingsImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$BookSettingsImplFromJson(json);
|
||||
|
|
@ -145,10 +180,12 @@ class _$BookSettingsImpl implements _BookSettings {
|
|||
@override
|
||||
@JsonKey()
|
||||
final NullablePlayerSettings playerSettings;
|
||||
@override
|
||||
final BookProgress? progress;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BookSettings(bookId: $bookId, playerSettings: $playerSettings)';
|
||||
return 'BookSettings(bookId: $bookId, playerSettings: $playerSettings, progress: $progress)';
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -158,12 +195,15 @@ class _$BookSettingsImpl implements _BookSettings {
|
|||
other is _$BookSettingsImpl &&
|
||||
(identical(other.bookId, bookId) || other.bookId == bookId) &&
|
||||
(identical(other.playerSettings, playerSettings) ||
|
||||
other.playerSettings == playerSettings));
|
||||
other.playerSettings == playerSettings) &&
|
||||
(identical(other.progress, progress) ||
|
||||
other.progress == progress));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, bookId, playerSettings);
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, bookId, playerSettings, progress);
|
||||
|
||||
/// Create a copy of BookSettings
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
|
@ -184,7 +224,8 @@ class _$BookSettingsImpl implements _BookSettings {
|
|||
abstract class _BookSettings implements BookSettings {
|
||||
const factory _BookSettings(
|
||||
{required final String bookId,
|
||||
final NullablePlayerSettings playerSettings}) = _$BookSettingsImpl;
|
||||
final NullablePlayerSettings playerSettings,
|
||||
final BookProgress? progress}) = _$BookSettingsImpl;
|
||||
|
||||
factory _BookSettings.fromJson(Map<String, dynamic> json) =
|
||||
_$BookSettingsImpl.fromJson;
|
||||
|
|
@ -193,6 +234,8 @@ abstract class _BookSettings implements BookSettings {
|
|||
String get bookId;
|
||||
@override
|
||||
NullablePlayerSettings get playerSettings;
|
||||
@override
|
||||
BookProgress? get progress;
|
||||
|
||||
/// Create a copy of BookSettings
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
|
|
@ -201,3 +244,174 @@ abstract class _BookSettings implements BookSettings {
|
|||
_$$BookSettingsImplCopyWith<_$BookSettingsImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
BookProgress _$BookProgressFromJson(Map<String, dynamic> json) {
|
||||
return _BookProgress.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$BookProgress {
|
||||
DateTime get lastUpdate => throw _privateConstructorUsedError;
|
||||
Duration get currentTime => throw _privateConstructorUsedError;
|
||||
|
||||
/// Serializes this BookProgress to a JSON map.
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of BookProgress
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$BookProgressCopyWith<BookProgress> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $BookProgressCopyWith<$Res> {
|
||||
factory $BookProgressCopyWith(
|
||||
BookProgress value, $Res Function(BookProgress) then) =
|
||||
_$BookProgressCopyWithImpl<$Res, BookProgress>;
|
||||
@useResult
|
||||
$Res call({DateTime lastUpdate, Duration currentTime});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$BookProgressCopyWithImpl<$Res, $Val extends BookProgress>
|
||||
implements $BookProgressCopyWith<$Res> {
|
||||
_$BookProgressCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of BookProgress
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? lastUpdate = null,
|
||||
Object? currentTime = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
lastUpdate: null == lastUpdate
|
||||
? _value.lastUpdate
|
||||
: lastUpdate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
currentTime: null == currentTime
|
||||
? _value.currentTime
|
||||
: currentTime // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$BookProgressImplCopyWith<$Res>
|
||||
implements $BookProgressCopyWith<$Res> {
|
||||
factory _$$BookProgressImplCopyWith(
|
||||
_$BookProgressImpl value, $Res Function(_$BookProgressImpl) then) =
|
||||
__$$BookProgressImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({DateTime lastUpdate, Duration currentTime});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$BookProgressImplCopyWithImpl<$Res>
|
||||
extends _$BookProgressCopyWithImpl<$Res, _$BookProgressImpl>
|
||||
implements _$$BookProgressImplCopyWith<$Res> {
|
||||
__$$BookProgressImplCopyWithImpl(
|
||||
_$BookProgressImpl _value, $Res Function(_$BookProgressImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of BookProgress
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? lastUpdate = null,
|
||||
Object? currentTime = null,
|
||||
}) {
|
||||
return _then(_$BookProgressImpl(
|
||||
lastUpdate: null == lastUpdate
|
||||
? _value.lastUpdate
|
||||
: lastUpdate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
currentTime: null == currentTime
|
||||
? _value.currentTime
|
||||
: currentTime // ignore: cast_nullable_to_non_nullable
|
||||
as Duration,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$BookProgressImpl implements _BookProgress {
|
||||
const _$BookProgressImpl(
|
||||
{required this.lastUpdate, this.currentTime = Duration.zero});
|
||||
|
||||
factory _$BookProgressImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$BookProgressImplFromJson(json);
|
||||
|
||||
@override
|
||||
final DateTime lastUpdate;
|
||||
@override
|
||||
@JsonKey()
|
||||
final Duration currentTime;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BookProgress(lastUpdate: $lastUpdate, currentTime: $currentTime)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$BookProgressImpl &&
|
||||
(identical(other.lastUpdate, lastUpdate) ||
|
||||
other.lastUpdate == lastUpdate) &&
|
||||
(identical(other.currentTime, currentTime) ||
|
||||
other.currentTime == currentTime));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, lastUpdate, currentTime);
|
||||
|
||||
/// Create a copy of BookProgress
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$BookProgressImplCopyWith<_$BookProgressImpl> get copyWith =>
|
||||
__$$BookProgressImplCopyWithImpl<_$BookProgressImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$BookProgressImplToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _BookProgress implements BookProgress {
|
||||
const factory _BookProgress(
|
||||
{required final DateTime lastUpdate,
|
||||
final Duration currentTime}) = _$BookProgressImpl;
|
||||
|
||||
factory _BookProgress.fromJson(Map<String, dynamic> json) =
|
||||
_$BookProgressImpl.fromJson;
|
||||
|
||||
@override
|
||||
DateTime get lastUpdate;
|
||||
@override
|
||||
Duration get currentTime;
|
||||
|
||||
/// Create a copy of BookProgress
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$BookProgressImplCopyWith<_$BookProgressImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,10 +13,28 @@ _$BookSettingsImpl _$$BookSettingsImplFromJson(Map<String, dynamic> json) =>
|
|||
? const NullablePlayerSettings()
|
||||
: NullablePlayerSettings.fromJson(
|
||||
json['playerSettings'] as Map<String, dynamic>),
|
||||
progress: json['progress'] == null
|
||||
? null
|
||||
: BookProgress.fromJson(json['progress'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$BookSettingsImplToJson(_$BookSettingsImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'bookId': instance.bookId,
|
||||
'playerSettings': instance.playerSettings,
|
||||
'progress': instance.progress,
|
||||
};
|
||||
|
||||
_$BookProgressImpl _$$BookProgressImplFromJson(Map<String, dynamic> json) =>
|
||||
_$BookProgressImpl(
|
||||
lastUpdate: DateTime.parse(json['lastUpdate'] as String),
|
||||
currentTime: json['currentTime'] == null
|
||||
? Duration.zero
|
||||
: Duration(microseconds: (json['currentTime'] as num).toInt()),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$BookProgressImplToJson(_$BookProgressImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'lastUpdate': instance.lastUpdate.toIso8601String(),
|
||||
'currentTime': instance.currentTime.inMicroseconds,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue