feat: Add a small details bottom sheet

This commit is contained in:
2026-05-10 22:14:37 +02:00
parent 10b76ac214
commit c422d5c27c
14 changed files with 1752 additions and 2549 deletions

View File

@@ -48,7 +48,10 @@
"readState": "Read state", "readState": "Read state",
"episodes": "Episodes", "episodes": "Episodes",
"chapters": "Chapters", "chapters": "Chapters",
"volumesOwned": "Volumes owned" "volumesOwned": "Volumes owned",
"details": {
"titleJa": "Japanese Title"
}
}, },
"calendar": { "calendar": {
"calendar": "Calendar", "calendar": "Calendar",

3
devtools_options.yaml Normal file
View File

@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:

View File

@@ -42,7 +42,7 @@ void main() async {
); );
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
LocaleSettings.useDeviceLocale(); await LocaleSettings.useDeviceLocale();
runApp( runApp(
MultiBlocProvider( MultiBlocProvider(

View File

@@ -14,90 +14,55 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$AnimeTrackingData { mixin _$AnimeTrackingData {
/// The ID of the anime /// The ID of the anime
String get id; String get id;/// The state of the anime
@MediumTrackingStateConverter() MediumTrackingState get state;/// The title of the anime
/// The state of the anime String get title;/// Episodes in total.
@MediumTrackingStateConverter() int get episodesWatched;/// Episodes watched.
MediumTrackingState get state; int? get episodesTotal;/// URL to the thumbnail/cover art for the anime.
String get thumbnailUrl;/// Flag whether the anime is airing
/// The title of the anime @BoolConverter() bool get airing;/// The day of the week the anime is airing
String get title;
/// Episodes in total.
int get episodesWatched;
/// Episodes watched.
int? get episodesTotal;
/// URL to the thumbnail/cover art for the anime.
String get thumbnailUrl;
/// Flag whether the anime is airing
@BoolConverter()
bool get airing;
/// The day of the week the anime is airing
String? get broadcastDay; String? get broadcastDay;
/// Create a copy of AnimeTrackingData /// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$AnimeTrackingDataCopyWith<AnimeTrackingData> get copyWith => $AnimeTrackingDataCopyWith<AnimeTrackingData> get copyWith => _$AnimeTrackingDataCopyWithImpl<AnimeTrackingData>(this as AnimeTrackingData, _$identity);
_$AnimeTrackingDataCopyWithImpl<AnimeTrackingData>(
this as AnimeTrackingData, _$identity);
/// Serializes this AnimeTrackingData to a JSON map. /// Serializes this AnimeTrackingData to a JSON map.
Map<String, dynamic> toJson(); Map<String, dynamic> toJson();
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is AnimeTrackingData&&(identical(other.id, id) || other.id == id)&&(identical(other.state, state) || other.state == state)&&(identical(other.title, title) || other.title == title)&&(identical(other.episodesWatched, episodesWatched) || other.episodesWatched == episodesWatched)&&(identical(other.episodesTotal, episodesTotal) || other.episodesTotal == episodesTotal)&&(identical(other.thumbnailUrl, thumbnailUrl) || other.thumbnailUrl == thumbnailUrl)&&(identical(other.airing, airing) || other.airing == airing)&&(identical(other.broadcastDay, broadcastDay) || other.broadcastDay == broadcastDay));
(other.runtimeType == runtimeType &&
other is AnimeTrackingData &&
(identical(other.id, id) || other.id == id) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.title, title) || other.title == title) &&
(identical(other.episodesWatched, episodesWatched) ||
other.episodesWatched == episodesWatched) &&
(identical(other.episodesTotal, episodesTotal) ||
other.episodesTotal == episodesTotal) &&
(identical(other.thumbnailUrl, thumbnailUrl) ||
other.thumbnailUrl == thumbnailUrl) &&
(identical(other.airing, airing) || other.airing == airing) &&
(identical(other.broadcastDay, broadcastDay) ||
other.broadcastDay == broadcastDay));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType, id, state, title, int get hashCode => Object.hash(runtimeType,id,state,title,episodesWatched,episodesTotal,thumbnailUrl,airing,broadcastDay);
episodesWatched, episodesTotal, thumbnailUrl, airing, broadcastDay);
@override @override
String toString() { String toString() {
return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)'; return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class $AnimeTrackingDataCopyWith<$Res> { abstract mixin class $AnimeTrackingDataCopyWith<$Res> {
factory $AnimeTrackingDataCopyWith( factory $AnimeTrackingDataCopyWith(AnimeTrackingData value, $Res Function(AnimeTrackingData) _then) = _$AnimeTrackingDataCopyWithImpl;
AnimeTrackingData value, $Res Function(AnimeTrackingData) _then) =
_$AnimeTrackingDataCopyWithImpl;
@useResult @useResult
$Res call( $Res call({
{String id, String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl,@BoolConverter() bool airing, String? broadcastDay
@MediumTrackingStateConverter() MediumTrackingState state, });
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay});
}
}
/// @nodoc /// @nodoc
class _$AnimeTrackingDataCopyWithImpl<$Res> class _$AnimeTrackingDataCopyWithImpl<$Res>
implements $AnimeTrackingDataCopyWith<$Res> { implements $AnimeTrackingDataCopyWith<$Res> {
@@ -108,55 +73,23 @@ class _$AnimeTrackingDataCopyWithImpl<$Res>
/// Create a copy of AnimeTrackingData /// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? state = null,Object? title = null,Object? episodesWatched = null,Object? episodesTotal = freezed,Object? thumbnailUrl = null,Object? airing = null,Object? broadcastDay = freezed,}) {
@override
$Res call({
Object? id = null,
Object? state = null,
Object? title = null,
Object? episodesWatched = null,
Object? episodesTotal = freezed,
Object? thumbnailUrl = null,
Object? airing = null,
Object? broadcastDay = freezed,
}) {
return _then(_self.copyWith( return _then(_self.copyWith(
id: null == id id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
? _self.id as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
: id // ignore: cast_nullable_to_non_nullable as MediumTrackingState,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String, as String,episodesWatched: null == episodesWatched ? _self.episodesWatched : episodesWatched // ignore: cast_nullable_to_non_nullable
state: null == state as int,episodesTotal: freezed == episodesTotal ? _self.episodesTotal : episodesTotal // ignore: cast_nullable_to_non_nullable
? _self.state as int?,thumbnailUrl: null == thumbnailUrl ? _self.thumbnailUrl : thumbnailUrl // ignore: cast_nullable_to_non_nullable
: state // ignore: cast_nullable_to_non_nullable as String,airing: null == airing ? _self.airing : airing // ignore: cast_nullable_to_non_nullable
as MediumTrackingState, as bool,broadcastDay: freezed == broadcastDay ? _self.broadcastDay : broadcastDay // ignore: cast_nullable_to_non_nullable
title: null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
episodesWatched: null == episodesWatched
? _self.episodesWatched
: episodesWatched // ignore: cast_nullable_to_non_nullable
as int,
episodesTotal: freezed == episodesTotal
? _self.episodesTotal
: episodesTotal // ignore: cast_nullable_to_non_nullable
as int?,
thumbnailUrl: null == thumbnailUrl
? _self.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,
airing: null == airing
? _self.airing
: airing // ignore: cast_nullable_to_non_nullable
as bool,
broadcastDay: freezed == broadcastDay
? _self.broadcastDay
: broadcastDay // ignore: cast_nullable_to_non_nullable
as String?, as String?,
)); ));
} }
} }
/// Adds pattern-matching-related methods to [AnimeTrackingData]. /// Adds pattern-matching-related methods to [AnimeTrackingData].
extension AnimeTrackingDataPatterns on AnimeTrackingData { extension AnimeTrackingDataPatterns on AnimeTrackingData {
/// A variant of `map` that fallback to returning `orElse`. /// A variant of `map` that fallback to returning `orElse`.
@@ -171,20 +104,15 @@ extension AnimeTrackingDataPatterns on AnimeTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AnimeTrackingData value)? $default,{required TResult orElse(),}){
TResult maybeMap<TResult extends Object?>(
TResult Function(_AnimeTrackingData value)? $default, {
required TResult orElse(),
}) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _AnimeTrackingData() when $default != null: case _AnimeTrackingData() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// Callbacks receives the raw object, upcasted. /// Callbacks receives the raw object, upcasted.
@@ -198,19 +126,15 @@ extension AnimeTrackingDataPatterns on AnimeTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AnimeTrackingData value) $default,){
TResult map<TResult extends Object?>(
TResult Function(_AnimeTrackingData value) $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _AnimeTrackingData(): case _AnimeTrackingData():
return $default(_that); return $default(_that);case _:
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `map` that fallback to returning `null`. /// A variant of `map` that fallback to returning `null`.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -223,19 +147,15 @@ extension AnimeTrackingDataPatterns on AnimeTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AnimeTrackingData value)? $default,){
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_AnimeTrackingData value)? $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _AnimeTrackingData() when $default != null: case _AnimeTrackingData() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return null; return null;
}
}
}
}
/// A variant of `when` that fallback to an `orElse` callback. /// A variant of `when` that fallback to an `orElse` callback.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -248,37 +168,14 @@ extension AnimeTrackingDataPatterns on AnimeTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl, @BoolConverter() bool airing, String? broadcastDay)? $default,{required TResult orElse(),}) {final _that = this;
TResult maybeWhen<TResult extends Object?>(
TResult Function(
String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) { switch (_that) {
case _AnimeTrackingData() when $default != null: case _AnimeTrackingData() when $default != null:
return $default( return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay);case _:
_that.id,
_that.state,
_that.title,
_that.episodesWatched,
_that.episodesTotal,
_that.thumbnailUrl,
_that.airing,
_that.broadcastDay);
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// As opposed to `map`, this offers destructuring. /// As opposed to `map`, this offers destructuring.
@@ -292,36 +189,14 @@ extension AnimeTrackingDataPatterns on AnimeTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl, @BoolConverter() bool airing, String? broadcastDay) $default,) {final _that = this;
TResult when<TResult extends Object?>(
TResult Function(
String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay)
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _AnimeTrackingData(): case _AnimeTrackingData():
return $default( return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay);case _:
_that.id,
_that.state,
_that.title,
_that.episodesWatched,
_that.episodesTotal,
_that.thumbnailUrl,
_that.airing,
_that.broadcastDay);
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `when` that fallback to returning `null` /// A variant of `when` that fallback to returning `null`
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -334,151 +209,81 @@ extension AnimeTrackingDataPatterns on AnimeTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl, @BoolConverter() bool airing, String? broadcastDay)? $default,) {final _that = this;
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(
String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay)?
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _AnimeTrackingData() when $default != null: case _AnimeTrackingData() when $default != null:
return $default( return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay);case _:
_that.id,
_that.state,
_that.title,
_that.episodesWatched,
_that.episodesTotal,
_that.thumbnailUrl,
_that.airing,
_that.broadcastDay);
case _:
return null; return null;
} }
} }
} }
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _AnimeTrackingData extends AnimeTrackingData { class _AnimeTrackingData extends AnimeTrackingData {
_AnimeTrackingData( _AnimeTrackingData(this.id, @MediumTrackingStateConverter() this.state, this.title, this.episodesWatched, this.episodesTotal, this.thumbnailUrl, @BoolConverter() this.airing, this.broadcastDay): super._();
this.id, factory _AnimeTrackingData.fromJson(Map<String, dynamic> json) => _$AnimeTrackingDataFromJson(json);
@MediumTrackingStateConverter() this.state,
this.title,
this.episodesWatched,
this.episodesTotal,
this.thumbnailUrl,
@BoolConverter() this.airing,
this.broadcastDay)
: super._();
factory _AnimeTrackingData.fromJson(Map<String, dynamic> json) =>
_$AnimeTrackingDataFromJson(json);
/// The ID of the anime /// The ID of the anime
@override @override final String id;
final String id;
/// The state of the anime /// The state of the anime
@override @override@MediumTrackingStateConverter() final MediumTrackingState state;
@MediumTrackingStateConverter()
final MediumTrackingState state;
/// The title of the anime /// The title of the anime
@override @override final String title;
final String title;
/// Episodes in total. /// Episodes in total.
@override @override final int episodesWatched;
final int episodesWatched;
/// Episodes watched. /// Episodes watched.
@override @override final int? episodesTotal;
final int? episodesTotal;
/// URL to the thumbnail/cover art for the anime. /// URL to the thumbnail/cover art for the anime.
@override @override final String thumbnailUrl;
final String thumbnailUrl;
/// Flag whether the anime is airing /// Flag whether the anime is airing
@override @override@BoolConverter() final bool airing;
@BoolConverter()
final bool airing;
/// The day of the week the anime is airing /// The day of the week the anime is airing
@override @override final String? broadcastDay;
final String? broadcastDay;
/// Create a copy of AnimeTrackingData /// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$AnimeTrackingDataCopyWith<_AnimeTrackingData> get copyWith => _$AnimeTrackingDataCopyWith<_AnimeTrackingData> get copyWith => __$AnimeTrackingDataCopyWithImpl<_AnimeTrackingData>(this, _$identity);
__$AnimeTrackingDataCopyWithImpl<_AnimeTrackingData>(this, _$identity);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$AnimeTrackingDataToJson( return _$AnimeTrackingDataToJson(this, );
this,
);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is _AnimeTrackingData&&(identical(other.id, id) || other.id == id)&&(identical(other.state, state) || other.state == state)&&(identical(other.title, title) || other.title == title)&&(identical(other.episodesWatched, episodesWatched) || other.episodesWatched == episodesWatched)&&(identical(other.episodesTotal, episodesTotal) || other.episodesTotal == episodesTotal)&&(identical(other.thumbnailUrl, thumbnailUrl) || other.thumbnailUrl == thumbnailUrl)&&(identical(other.airing, airing) || other.airing == airing)&&(identical(other.broadcastDay, broadcastDay) || other.broadcastDay == broadcastDay));
(other.runtimeType == runtimeType &&
other is _AnimeTrackingData &&
(identical(other.id, id) || other.id == id) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.title, title) || other.title == title) &&
(identical(other.episodesWatched, episodesWatched) ||
other.episodesWatched == episodesWatched) &&
(identical(other.episodesTotal, episodesTotal) ||
other.episodesTotal == episodesTotal) &&
(identical(other.thumbnailUrl, thumbnailUrl) ||
other.thumbnailUrl == thumbnailUrl) &&
(identical(other.airing, airing) || other.airing == airing) &&
(identical(other.broadcastDay, broadcastDay) ||
other.broadcastDay == broadcastDay));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType, id, state, title, int get hashCode => Object.hash(runtimeType,id,state,title,episodesWatched,episodesTotal,thumbnailUrl,airing,broadcastDay);
episodesWatched, episodesTotal, thumbnailUrl, airing, broadcastDay);
@override @override
String toString() { String toString() {
return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)'; return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class _$AnimeTrackingDataCopyWith<$Res> abstract mixin class _$AnimeTrackingDataCopyWith<$Res> implements $AnimeTrackingDataCopyWith<$Res> {
implements $AnimeTrackingDataCopyWith<$Res> { factory _$AnimeTrackingDataCopyWith(_AnimeTrackingData value, $Res Function(_AnimeTrackingData) _then) = __$AnimeTrackingDataCopyWithImpl;
factory _$AnimeTrackingDataCopyWith( @override @useResult
_AnimeTrackingData value, $Res Function(_AnimeTrackingData) _then) = $Res call({
__$AnimeTrackingDataCopyWithImpl; String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl,@BoolConverter() bool airing, String? broadcastDay
@override });
@useResult
$Res call(
{String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int episodesWatched,
int? episodesTotal,
String thumbnailUrl,
@BoolConverter() bool airing,
String? broadcastDay});
}
}
/// @nodoc /// @nodoc
class __$AnimeTrackingDataCopyWithImpl<$Res> class __$AnimeTrackingDataCopyWithImpl<$Res>
implements _$AnimeTrackingDataCopyWith<$Res> { implements _$AnimeTrackingDataCopyWith<$Res> {
@@ -489,53 +294,21 @@ class __$AnimeTrackingDataCopyWithImpl<$Res>
/// Create a copy of AnimeTrackingData /// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? state = null,Object? title = null,Object? episodesWatched = null,Object? episodesTotal = freezed,Object? thumbnailUrl = null,Object? airing = null,Object? broadcastDay = freezed,}) {
@pragma('vm:prefer-inline')
$Res call({
Object? id = null,
Object? state = null,
Object? title = null,
Object? episodesWatched = null,
Object? episodesTotal = freezed,
Object? thumbnailUrl = null,
Object? airing = null,
Object? broadcastDay = freezed,
}) {
return _then(_AnimeTrackingData( return _then(_AnimeTrackingData(
null == id null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
? _self.id as String,null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
: id // ignore: cast_nullable_to_non_nullable as MediumTrackingState,null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String, as String,null == episodesWatched ? _self.episodesWatched : episodesWatched // ignore: cast_nullable_to_non_nullable
null == state as int,freezed == episodesTotal ? _self.episodesTotal : episodesTotal // ignore: cast_nullable_to_non_nullable
? _self.state as int?,null == thumbnailUrl ? _self.thumbnailUrl : thumbnailUrl // ignore: cast_nullable_to_non_nullable
: state // ignore: cast_nullable_to_non_nullable as String,null == airing ? _self.airing : airing // ignore: cast_nullable_to_non_nullable
as MediumTrackingState, as bool,freezed == broadcastDay ? _self.broadcastDay : broadcastDay // ignore: cast_nullable_to_non_nullable
null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
null == episodesWatched
? _self.episodesWatched
: episodesWatched // ignore: cast_nullable_to_non_nullable
as int,
freezed == episodesTotal
? _self.episodesTotal
: episodesTotal // ignore: cast_nullable_to_non_nullable
as int?,
null == thumbnailUrl
? _self.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,
null == airing
? _self.airing
: airing // ignore: cast_nullable_to_non_nullable
as bool,
freezed == broadcastDay
? _self.broadcastDay
: broadcastDay // ignore: cast_nullable_to_non_nullable
as String?, as String?,
)); ));
} }
} }
// dart format on // dart format on

View File

@@ -9,8 +9,9 @@ part of 'anime.dart';
_AnimeTrackingData _$AnimeTrackingDataFromJson(Map<String, dynamic> json) => _AnimeTrackingData _$AnimeTrackingDataFromJson(Map<String, dynamic> json) =>
_AnimeTrackingData( _AnimeTrackingData(
json['id'] as String, json['id'] as String,
const MediumTrackingStateConverter() const MediumTrackingStateConverter().fromJson(
.fromJson((json['state'] as num).toInt()), (json['state'] as num).toInt(),
),
json['title'] as String, json['title'] as String,
(json['episodesWatched'] as num).toInt(), (json['episodesWatched'] as num).toInt(),
(json['episodesTotal'] as num?)?.toInt(), (json['episodesTotal'] as num?)?.toInt(),

View File

@@ -14,84 +14,54 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$MangaTrackingData { mixin _$MangaTrackingData {
/// The ID of the manga /// The ID of the manga
String get id; String get id;/// The state of the manga
@MediumTrackingStateConverter() MediumTrackingState get state;/// The title of the manga
/// The state of the manga String get title;/// Chapters read.
@MediumTrackingStateConverter() int get chaptersRead;/// Chapters read.
MediumTrackingState get state; int get volumesOwned;/// Episodes watched.
int? get chaptersTotal;/// URL to the thumbnail/cover art for the manga.
/// The title of the manga
String get title;
/// Chapters read.
int get chaptersRead;
/// Chapters read.
int get volumesOwned;
/// Episodes watched.
int? get chaptersTotal;
/// URL to the thumbnail/cover art for the manga.
String get thumbnailUrl; String get thumbnailUrl;
/// Create a copy of MangaTrackingData /// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$MangaTrackingDataCopyWith<MangaTrackingData> get copyWith => $MangaTrackingDataCopyWith<MangaTrackingData> get copyWith => _$MangaTrackingDataCopyWithImpl<MangaTrackingData>(this as MangaTrackingData, _$identity);
_$MangaTrackingDataCopyWithImpl<MangaTrackingData>(
this as MangaTrackingData, _$identity);
/// Serializes this MangaTrackingData to a JSON map. /// Serializes this MangaTrackingData to a JSON map.
Map<String, dynamic> toJson(); Map<String, dynamic> toJson();
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is MangaTrackingData&&(identical(other.id, id) || other.id == id)&&(identical(other.state, state) || other.state == state)&&(identical(other.title, title) || other.title == title)&&(identical(other.chaptersRead, chaptersRead) || other.chaptersRead == chaptersRead)&&(identical(other.volumesOwned, volumesOwned) || other.volumesOwned == volumesOwned)&&(identical(other.chaptersTotal, chaptersTotal) || other.chaptersTotal == chaptersTotal)&&(identical(other.thumbnailUrl, thumbnailUrl) || other.thumbnailUrl == thumbnailUrl));
(other.runtimeType == runtimeType &&
other is MangaTrackingData &&
(identical(other.id, id) || other.id == id) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.title, title) || other.title == title) &&
(identical(other.chaptersRead, chaptersRead) ||
other.chaptersRead == chaptersRead) &&
(identical(other.volumesOwned, volumesOwned) ||
other.volumesOwned == volumesOwned) &&
(identical(other.chaptersTotal, chaptersTotal) ||
other.chaptersTotal == chaptersTotal) &&
(identical(other.thumbnailUrl, thumbnailUrl) ||
other.thumbnailUrl == thumbnailUrl));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType, id, state, title, chaptersRead, int get hashCode => Object.hash(runtimeType,id,state,title,chaptersRead,volumesOwned,chaptersTotal,thumbnailUrl);
volumesOwned, chaptersTotal, thumbnailUrl);
@override @override
String toString() { String toString() {
return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)'; return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class $MangaTrackingDataCopyWith<$Res> { abstract mixin class $MangaTrackingDataCopyWith<$Res> {
factory $MangaTrackingDataCopyWith( factory $MangaTrackingDataCopyWith(MangaTrackingData value, $Res Function(MangaTrackingData) _then) = _$MangaTrackingDataCopyWithImpl;
MangaTrackingData value, $Res Function(MangaTrackingData) _then) =
_$MangaTrackingDataCopyWithImpl;
@useResult @useResult
$Res call( $Res call({
{String id, String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl
@MediumTrackingStateConverter() MediumTrackingState state, });
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl});
}
}
/// @nodoc /// @nodoc
class _$MangaTrackingDataCopyWithImpl<$Res> class _$MangaTrackingDataCopyWithImpl<$Res>
implements $MangaTrackingDataCopyWith<$Res> { implements $MangaTrackingDataCopyWith<$Res> {
@@ -102,50 +72,22 @@ class _$MangaTrackingDataCopyWithImpl<$Res>
/// Create a copy of MangaTrackingData /// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? state = null,Object? title = null,Object? chaptersRead = null,Object? volumesOwned = null,Object? chaptersTotal = freezed,Object? thumbnailUrl = null,}) {
@override
$Res call({
Object? id = null,
Object? state = null,
Object? title = null,
Object? chaptersRead = null,
Object? volumesOwned = null,
Object? chaptersTotal = freezed,
Object? thumbnailUrl = null,
}) {
return _then(_self.copyWith( return _then(_self.copyWith(
id: null == id id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
? _self.id as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
: id // ignore: cast_nullable_to_non_nullable as MediumTrackingState,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String, as String,chaptersRead: null == chaptersRead ? _self.chaptersRead : chaptersRead // ignore: cast_nullable_to_non_nullable
state: null == state as int,volumesOwned: null == volumesOwned ? _self.volumesOwned : volumesOwned // ignore: cast_nullable_to_non_nullable
? _self.state as int,chaptersTotal: freezed == chaptersTotal ? _self.chaptersTotal : chaptersTotal // ignore: cast_nullable_to_non_nullable
: state // ignore: cast_nullable_to_non_nullable as int?,thumbnailUrl: null == thumbnailUrl ? _self.thumbnailUrl : thumbnailUrl // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
title: null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
chaptersRead: null == chaptersRead
? _self.chaptersRead
: chaptersRead // ignore: cast_nullable_to_non_nullable
as int,
volumesOwned: null == volumesOwned
? _self.volumesOwned
: volumesOwned // ignore: cast_nullable_to_non_nullable
as int,
chaptersTotal: freezed == chaptersTotal
? _self.chaptersTotal
: chaptersTotal // ignore: cast_nullable_to_non_nullable
as int?,
thumbnailUrl: null == thumbnailUrl
? _self.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String, as String,
)); ));
} }
} }
/// Adds pattern-matching-related methods to [MangaTrackingData]. /// Adds pattern-matching-related methods to [MangaTrackingData].
extension MangaTrackingDataPatterns on MangaTrackingData { extension MangaTrackingDataPatterns on MangaTrackingData {
/// A variant of `map` that fallback to returning `orElse`. /// A variant of `map` that fallback to returning `orElse`.
@@ -160,20 +102,15 @@ extension MangaTrackingDataPatterns on MangaTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _MangaTrackingData value)? $default,{required TResult orElse(),}){
TResult maybeMap<TResult extends Object?>(
TResult Function(_MangaTrackingData value)? $default, {
required TResult orElse(),
}) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _MangaTrackingData() when $default != null: case _MangaTrackingData() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// Callbacks receives the raw object, upcasted. /// Callbacks receives the raw object, upcasted.
@@ -187,19 +124,15 @@ extension MangaTrackingDataPatterns on MangaTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _MangaTrackingData value) $default,){
TResult map<TResult extends Object?>(
TResult Function(_MangaTrackingData value) $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _MangaTrackingData(): case _MangaTrackingData():
return $default(_that); return $default(_that);case _:
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `map` that fallback to returning `null`. /// A variant of `map` that fallback to returning `null`.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -212,19 +145,15 @@ extension MangaTrackingDataPatterns on MangaTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _MangaTrackingData value)? $default,){
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_MangaTrackingData value)? $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _MangaTrackingData() when $default != null: case _MangaTrackingData() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return null; return null;
}
}
}
}
/// A variant of `when` that fallback to an `orElse` callback. /// A variant of `when` that fallback to an `orElse` callback.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -237,29 +166,14 @@ extension MangaTrackingDataPatterns on MangaTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl)? $default,{required TResult orElse(),}) {final _that = this;
TResult maybeWhen<TResult extends Object?>(
TResult Function(
String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) { switch (_that) {
case _MangaTrackingData() when $default != null: case _MangaTrackingData() when $default != null:
return $default(_that.id, _that.state, _that.title, _that.chaptersRead, return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl);case _:
_that.volumesOwned, _that.chaptersTotal, _that.thumbnailUrl);
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// As opposed to `map`, this offers destructuring. /// As opposed to `map`, this offers destructuring.
@@ -273,28 +187,14 @@ extension MangaTrackingDataPatterns on MangaTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl) $default,) {final _that = this;
TResult when<TResult extends Object?>(
TResult Function(
String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl)
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _MangaTrackingData(): case _MangaTrackingData():
return $default(_that.id, _that.state, _that.title, _that.chaptersRead, return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl);case _:
_that.volumesOwned, _that.chaptersTotal, _that.thumbnailUrl);
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `when` that fallback to returning `null` /// A variant of `when` that fallback to returning `null`
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -307,135 +207,79 @@ extension MangaTrackingDataPatterns on MangaTrackingData {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl)? $default,) {final _that = this;
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(
String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl)?
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _MangaTrackingData() when $default != null: case _MangaTrackingData() when $default != null:
return $default(_that.id, _that.state, _that.title, _that.chaptersRead, return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl);case _:
_that.volumesOwned, _that.chaptersTotal, _that.thumbnailUrl);
case _:
return null; return null;
} }
} }
} }
/// @nodoc /// @nodoc
@JsonSerializable() @JsonSerializable()
class _MangaTrackingData extends MangaTrackingData { class _MangaTrackingData extends MangaTrackingData {
_MangaTrackingData( _MangaTrackingData(this.id, @MediumTrackingStateConverter() this.state, this.title, this.chaptersRead, this.volumesOwned, this.chaptersTotal, this.thumbnailUrl): super._();
this.id, factory _MangaTrackingData.fromJson(Map<String, dynamic> json) => _$MangaTrackingDataFromJson(json);
@MediumTrackingStateConverter() this.state,
this.title,
this.chaptersRead,
this.volumesOwned,
this.chaptersTotal,
this.thumbnailUrl)
: super._();
factory _MangaTrackingData.fromJson(Map<String, dynamic> json) =>
_$MangaTrackingDataFromJson(json);
/// The ID of the manga /// The ID of the manga
@override @override final String id;
final String id;
/// The state of the manga /// The state of the manga
@override @override@MediumTrackingStateConverter() final MediumTrackingState state;
@MediumTrackingStateConverter()
final MediumTrackingState state;
/// The title of the manga /// The title of the manga
@override @override final String title;
final String title;
/// Chapters read. /// Chapters read.
@override @override final int chaptersRead;
final int chaptersRead;
/// Chapters read. /// Chapters read.
@override @override final int volumesOwned;
final int volumesOwned;
/// Episodes watched. /// Episodes watched.
@override @override final int? chaptersTotal;
final int? chaptersTotal;
/// URL to the thumbnail/cover art for the manga. /// URL to the thumbnail/cover art for the manga.
@override @override final String thumbnailUrl;
final String thumbnailUrl;
/// Create a copy of MangaTrackingData /// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$MangaTrackingDataCopyWith<_MangaTrackingData> get copyWith => _$MangaTrackingDataCopyWith<_MangaTrackingData> get copyWith => __$MangaTrackingDataCopyWithImpl<_MangaTrackingData>(this, _$identity);
__$MangaTrackingDataCopyWithImpl<_MangaTrackingData>(this, _$identity);
@override @override
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return _$MangaTrackingDataToJson( return _$MangaTrackingDataToJson(this, );
this,
);
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is _MangaTrackingData&&(identical(other.id, id) || other.id == id)&&(identical(other.state, state) || other.state == state)&&(identical(other.title, title) || other.title == title)&&(identical(other.chaptersRead, chaptersRead) || other.chaptersRead == chaptersRead)&&(identical(other.volumesOwned, volumesOwned) || other.volumesOwned == volumesOwned)&&(identical(other.chaptersTotal, chaptersTotal) || other.chaptersTotal == chaptersTotal)&&(identical(other.thumbnailUrl, thumbnailUrl) || other.thumbnailUrl == thumbnailUrl));
(other.runtimeType == runtimeType &&
other is _MangaTrackingData &&
(identical(other.id, id) || other.id == id) &&
(identical(other.state, state) || other.state == state) &&
(identical(other.title, title) || other.title == title) &&
(identical(other.chaptersRead, chaptersRead) ||
other.chaptersRead == chaptersRead) &&
(identical(other.volumesOwned, volumesOwned) ||
other.volumesOwned == volumesOwned) &&
(identical(other.chaptersTotal, chaptersTotal) ||
other.chaptersTotal == chaptersTotal) &&
(identical(other.thumbnailUrl, thumbnailUrl) ||
other.thumbnailUrl == thumbnailUrl));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType, id, state, title, chaptersRead, int get hashCode => Object.hash(runtimeType,id,state,title,chaptersRead,volumesOwned,chaptersTotal,thumbnailUrl);
volumesOwned, chaptersTotal, thumbnailUrl);
@override @override
String toString() { String toString() {
return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)'; return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class _$MangaTrackingDataCopyWith<$Res> abstract mixin class _$MangaTrackingDataCopyWith<$Res> implements $MangaTrackingDataCopyWith<$Res> {
implements $MangaTrackingDataCopyWith<$Res> { factory _$MangaTrackingDataCopyWith(_MangaTrackingData value, $Res Function(_MangaTrackingData) _then) = __$MangaTrackingDataCopyWithImpl;
factory _$MangaTrackingDataCopyWith( @override @useResult
_MangaTrackingData value, $Res Function(_MangaTrackingData) _then) = $Res call({
__$MangaTrackingDataCopyWithImpl; String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl
@override });
@useResult
$Res call(
{String id,
@MediumTrackingStateConverter() MediumTrackingState state,
String title,
int chaptersRead,
int volumesOwned,
int? chaptersTotal,
String thumbnailUrl});
}
}
/// @nodoc /// @nodoc
class __$MangaTrackingDataCopyWithImpl<$Res> class __$MangaTrackingDataCopyWithImpl<$Res>
implements _$MangaTrackingDataCopyWith<$Res> { implements _$MangaTrackingDataCopyWith<$Res> {
@@ -446,48 +290,20 @@ class __$MangaTrackingDataCopyWithImpl<$Res>
/// Create a copy of MangaTrackingData /// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? state = null,Object? title = null,Object? chaptersRead = null,Object? volumesOwned = null,Object? chaptersTotal = freezed,Object? thumbnailUrl = null,}) {
@pragma('vm:prefer-inline')
$Res call({
Object? id = null,
Object? state = null,
Object? title = null,
Object? chaptersRead = null,
Object? volumesOwned = null,
Object? chaptersTotal = freezed,
Object? thumbnailUrl = null,
}) {
return _then(_MangaTrackingData( return _then(_MangaTrackingData(
null == id null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
? _self.id as String,null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
: id // ignore: cast_nullable_to_non_nullable as MediumTrackingState,null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String, as String,null == chaptersRead ? _self.chaptersRead : chaptersRead // ignore: cast_nullable_to_non_nullable
null == state as int,null == volumesOwned ? _self.volumesOwned : volumesOwned // ignore: cast_nullable_to_non_nullable
? _self.state as int,freezed == chaptersTotal ? _self.chaptersTotal : chaptersTotal // ignore: cast_nullable_to_non_nullable
: state // ignore: cast_nullable_to_non_nullable as int?,null == thumbnailUrl ? _self.thumbnailUrl : thumbnailUrl // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
null == title
? _self.title
: title // ignore: cast_nullable_to_non_nullable
as String,
null == chaptersRead
? _self.chaptersRead
: chaptersRead // ignore: cast_nullable_to_non_nullable
as int,
null == volumesOwned
? _self.volumesOwned
: volumesOwned // ignore: cast_nullable_to_non_nullable
as int,
freezed == chaptersTotal
? _self.chaptersTotal
: chaptersTotal // ignore: cast_nullable_to_non_nullable
as int?,
null == thumbnailUrl
? _self.thumbnailUrl
: thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String, as String,
)); ));
} }
} }
// dart format on // dart format on

View File

@@ -9,8 +9,9 @@ part of 'manga.dart';
_MangaTrackingData _$MangaTrackingDataFromJson(Map<String, dynamic> json) => _MangaTrackingData _$MangaTrackingDataFromJson(Map<String, dynamic> json) =>
_MangaTrackingData( _MangaTrackingData(
json['id'] as String, json['id'] as String,
const MediumTrackingStateConverter() const MediumTrackingStateConverter().fromJson(
.fromJson((json['state'] as num).toInt()), (json['state'] as num).toInt(),
),
json['title'] as String, json['title'] as String,
(json['chaptersRead'] as num).toInt(), (json['chaptersRead'] as num).toInt(),
(json['volumesOwned'] as num).toInt(), (json['volumesOwned'] as num).toInt(),

View File

@@ -4,7 +4,6 @@ import 'package:anitrack/src/data/anime.dart';
import 'package:anitrack/src/data/manga.dart'; import 'package:anitrack/src/data/manga.dart';
import 'package:anitrack/src/service/migrations/0000_airing.dart'; import 'package:anitrack/src/service/migrations/0000_airing.dart';
import 'package:anitrack/src/service/migrations/0000_score.dart'; import 'package:anitrack/src/service/migrations/0000_score.dart';
import 'package:sqflite/sqflite.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart'; import 'package:sqflite_common_ffi/sqflite_ffi.dart';
const animeTable = 'Anime'; const animeTable = 'Anime';
@@ -32,6 +31,7 @@ Future<void> _createDatabase(Database db, int version) async {
episodesWatched INTEGER NOT NULL, episodesWatched INTEGER NOT NULL,
thumbnailUrl TEXT NOT NULL, thumbnailUrl TEXT NOT NULL,
title TEXT NOT NULL, title TEXT NOT NULL,
otherTitles TEXT NOT NULL,
score INTEGER, score INTEGER,
airing INTEGER NOT NULL, airing INTEGER NOT NULL,
broadcastDay TEXT broadcastDay TEXT
@@ -47,6 +47,7 @@ Future<void> _createDatabase(Database db, int version) async {
volumesOwned INTEGER NOT NULL, volumesOwned INTEGER NOT NULL,
thumbnailUrl TEXT NOT NULL, thumbnailUrl TEXT NOT NULL,
title TEXT NOT NULL, title TEXT NOT NULL,
otherTitles TEXT NOT NULL,
score INTEGER score INTEGER
)''', )''',
); );

View File

@@ -11,72 +11,47 @@ part of 'anime_list_bloc.dart';
// dart format off // dart format off
T _$identity<T>(T value) => value; T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$AnimeListState { mixin _$AnimeListState {
bool get buttonVisibility;
List<AnimeTrackingData> get animes;
List<MangaTrackingData> get mangas;
MediumTrackingState get animeFilterState;
MediumTrackingState get mangaFilterState;
TrackingMediumType get trackingType;
bool get buttonVisibility; List<AnimeTrackingData> get animes; List<MangaTrackingData> get mangas; MediumTrackingState get animeFilterState; MediumTrackingState get mangaFilterState; TrackingMediumType get trackingType;
/// Create a copy of AnimeListState /// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$AnimeListStateCopyWith<AnimeListState> get copyWith => $AnimeListStateCopyWith<AnimeListState> get copyWith => _$AnimeListStateCopyWithImpl<AnimeListState>(this as AnimeListState, _$identity);
_$AnimeListStateCopyWithImpl<AnimeListState>(
this as AnimeListState, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is AnimeListState&&(identical(other.buttonVisibility, buttonVisibility) || other.buttonVisibility == buttonVisibility)&&const DeepCollectionEquality().equals(other.animes, animes)&&const DeepCollectionEquality().equals(other.mangas, mangas)&&(identical(other.animeFilterState, animeFilterState) || other.animeFilterState == animeFilterState)&&(identical(other.mangaFilterState, mangaFilterState) || other.mangaFilterState == mangaFilterState)&&(identical(other.trackingType, trackingType) || other.trackingType == trackingType));
(other.runtimeType == runtimeType &&
other is AnimeListState &&
(identical(other.buttonVisibility, buttonVisibility) ||
other.buttonVisibility == buttonVisibility) &&
const DeepCollectionEquality().equals(other.animes, animes) &&
const DeepCollectionEquality().equals(other.mangas, mangas) &&
(identical(other.animeFilterState, animeFilterState) ||
other.animeFilterState == animeFilterState) &&
(identical(other.mangaFilterState, mangaFilterState) ||
other.mangaFilterState == mangaFilterState) &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType));
} }
@override @override
int get hashCode => Object.hash( int get hashCode => Object.hash(runtimeType,buttonVisibility,const DeepCollectionEquality().hash(animes),const DeepCollectionEquality().hash(mangas),animeFilterState,mangaFilterState,trackingType);
runtimeType,
buttonVisibility,
const DeepCollectionEquality().hash(animes),
const DeepCollectionEquality().hash(mangas),
animeFilterState,
mangaFilterState,
trackingType);
@override @override
String toString() { String toString() {
return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)'; return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class $AnimeListStateCopyWith<$Res> { abstract mixin class $AnimeListStateCopyWith<$Res> {
factory $AnimeListStateCopyWith( factory $AnimeListStateCopyWith(AnimeListState value, $Res Function(AnimeListState) _then) = _$AnimeListStateCopyWithImpl;
AnimeListState value, $Res Function(AnimeListState) _then) =
_$AnimeListStateCopyWithImpl;
@useResult @useResult
$Res call( $Res call({
{bool buttonVisibility, bool buttonVisibility, List<AnimeTrackingData> animes, List<MangaTrackingData> mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType
List<AnimeTrackingData> animes, });
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType});
}
}
/// @nodoc /// @nodoc
class _$AnimeListStateCopyWithImpl<$Res> class _$AnimeListStateCopyWithImpl<$Res>
implements $AnimeListStateCopyWith<$Res> { implements $AnimeListStateCopyWith<$Res> {
@@ -87,45 +62,21 @@ class _$AnimeListStateCopyWithImpl<$Res>
/// Create a copy of AnimeListState /// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? buttonVisibility = null,Object? animes = null,Object? mangas = null,Object? animeFilterState = null,Object? mangaFilterState = null,Object? trackingType = null,}) {
@override
$Res call({
Object? buttonVisibility = null,
Object? animes = null,
Object? mangas = null,
Object? animeFilterState = null,
Object? mangaFilterState = null,
Object? trackingType = null,
}) {
return _then(_self.copyWith( return _then(_self.copyWith(
buttonVisibility: null == buttonVisibility buttonVisibility: null == buttonVisibility ? _self.buttonVisibility : buttonVisibility // ignore: cast_nullable_to_non_nullable
? _self.buttonVisibility as bool,animes: null == animes ? _self.animes : animes // ignore: cast_nullable_to_non_nullable
: buttonVisibility // ignore: cast_nullable_to_non_nullable as List<AnimeTrackingData>,mangas: null == mangas ? _self.mangas : mangas // ignore: cast_nullable_to_non_nullable
as bool, as List<MangaTrackingData>,animeFilterState: null == animeFilterState ? _self.animeFilterState : animeFilterState // ignore: cast_nullable_to_non_nullable
animes: null == animes as MediumTrackingState,mangaFilterState: null == mangaFilterState ? _self.mangaFilterState : mangaFilterState // ignore: cast_nullable_to_non_nullable
? _self.animes as MediumTrackingState,trackingType: null == trackingType ? _self.trackingType : trackingType // ignore: cast_nullable_to_non_nullable
: animes // ignore: cast_nullable_to_non_nullable
as List<AnimeTrackingData>,
mangas: null == mangas
? _self.mangas
: mangas // ignore: cast_nullable_to_non_nullable
as List<MangaTrackingData>,
animeFilterState: null == animeFilterState
? _self.animeFilterState
: animeFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
mangaFilterState: null == mangaFilterState
? _self.mangaFilterState
: mangaFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
trackingType: null == trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType, as TrackingMediumType,
)); ));
} }
} }
/// Adds pattern-matching-related methods to [AnimeListState]. /// Adds pattern-matching-related methods to [AnimeListState].
extension AnimeListStatePatterns on AnimeListState { extension AnimeListStatePatterns on AnimeListState {
/// A variant of `map` that fallback to returning `orElse`. /// A variant of `map` that fallback to returning `orElse`.
@@ -140,20 +91,15 @@ extension AnimeListStatePatterns on AnimeListState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AnimeListState value)? $default,{required TResult orElse(),}){
TResult maybeMap<TResult extends Object?>(
TResult Function(_AnimeListState value)? $default, {
required TResult orElse(),
}) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _AnimeListState() when $default != null: case _AnimeListState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// Callbacks receives the raw object, upcasted. /// Callbacks receives the raw object, upcasted.
@@ -167,19 +113,15 @@ extension AnimeListStatePatterns on AnimeListState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AnimeListState value) $default,){
TResult map<TResult extends Object?>(
TResult Function(_AnimeListState value) $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _AnimeListState(): case _AnimeListState():
return $default(_that); return $default(_that);case _:
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `map` that fallback to returning `null`. /// A variant of `map` that fallback to returning `null`.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -192,19 +134,15 @@ extension AnimeListStatePatterns on AnimeListState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AnimeListState value)? $default,){
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_AnimeListState value)? $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _AnimeListState() when $default != null: case _AnimeListState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return null; return null;
}
}
}
}
/// A variant of `when` that fallback to an `orElse` callback. /// A variant of `when` that fallback to an `orElse` callback.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -217,28 +155,14 @@ extension AnimeListStatePatterns on AnimeListState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool buttonVisibility, List<AnimeTrackingData> animes, List<MangaTrackingData> mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType)? $default,{required TResult orElse(),}) {final _that = this;
TResult maybeWhen<TResult extends Object?>(
TResult Function(
bool buttonVisibility,
List<AnimeTrackingData> animes,
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) { switch (_that) {
case _AnimeListState() when $default != null: case _AnimeListState() when $default != null:
return $default(_that.buttonVisibility, _that.animes, _that.mangas, return $default(_that.buttonVisibility,_that.animes,_that.mangas,_that.animeFilterState,_that.mangaFilterState,_that.trackingType);case _:
_that.animeFilterState, _that.mangaFilterState, _that.trackingType);
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// As opposed to `map`, this offers destructuring. /// As opposed to `map`, this offers destructuring.
@@ -252,27 +176,14 @@ extension AnimeListStatePatterns on AnimeListState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool buttonVisibility, List<AnimeTrackingData> animes, List<MangaTrackingData> mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType) $default,) {final _that = this;
TResult when<TResult extends Object?>(
TResult Function(
bool buttonVisibility,
List<AnimeTrackingData> animes,
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType)
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _AnimeListState(): case _AnimeListState():
return $default(_that.buttonVisibility, _that.animes, _that.mangas, return $default(_that.buttonVisibility,_that.animes,_that.mangas,_that.animeFilterState,_that.mangaFilterState,_that.trackingType);case _:
_that.animeFilterState, _that.mangaFilterState, _that.trackingType);
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `when` that fallback to returning `null` /// A variant of `when` that fallback to returning `null`
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -285,130 +196,80 @@ extension AnimeListStatePatterns on AnimeListState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool buttonVisibility, List<AnimeTrackingData> animes, List<MangaTrackingData> mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType)? $default,) {final _that = this;
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(
bool buttonVisibility,
List<AnimeTrackingData> animes,
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType)?
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _AnimeListState() when $default != null: case _AnimeListState() when $default != null:
return $default(_that.buttonVisibility, _that.animes, _that.mangas, return $default(_that.buttonVisibility,_that.animes,_that.mangas,_that.animeFilterState,_that.mangaFilterState,_that.trackingType);case _:
_that.animeFilterState, _that.mangaFilterState, _that.trackingType);
case _:
return null; return null;
} }
} }
} }
/// @nodoc /// @nodoc
class _AnimeListState implements AnimeListState {
_AnimeListState(
{this.buttonVisibility = true,
final List<AnimeTrackingData> animes = const [],
final List<MangaTrackingData> mangas = const [],
this.animeFilterState = MediumTrackingState.ongoing,
this.mangaFilterState = MediumTrackingState.ongoing,
this.trackingType = TrackingMediumType.anime})
: _animes = animes,
_mangas = mangas;
@override class _AnimeListState implements AnimeListState {
@JsonKey() _AnimeListState({this.buttonVisibility = true, final List<AnimeTrackingData> animes = const [], final List<MangaTrackingData> mangas = const [], this.animeFilterState = MediumTrackingState.ongoing, this.mangaFilterState = MediumTrackingState.ongoing, this.trackingType = TrackingMediumType.anime}): _animes = animes,_mangas = mangas;
final bool buttonVisibility;
@override@JsonKey() final bool buttonVisibility;
final List<AnimeTrackingData> _animes; final List<AnimeTrackingData> _animes;
@override @override@JsonKey() List<AnimeTrackingData> get animes {
@JsonKey()
List<AnimeTrackingData> get animes {
if (_animes is EqualUnmodifiableListView) return _animes; if (_animes is EqualUnmodifiableListView) return _animes;
// ignore: implicit_dynamic_type // ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_animes); return EqualUnmodifiableListView(_animes);
} }
final List<MangaTrackingData> _mangas; final List<MangaTrackingData> _mangas;
@override @override@JsonKey() List<MangaTrackingData> get mangas {
@JsonKey()
List<MangaTrackingData> get mangas {
if (_mangas is EqualUnmodifiableListView) return _mangas; if (_mangas is EqualUnmodifiableListView) return _mangas;
// ignore: implicit_dynamic_type // ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_mangas); return EqualUnmodifiableListView(_mangas);
} }
@override @override@JsonKey() final MediumTrackingState animeFilterState;
@JsonKey() @override@JsonKey() final MediumTrackingState mangaFilterState;
final MediumTrackingState animeFilterState; @override@JsonKey() final TrackingMediumType trackingType;
@override
@JsonKey()
final MediumTrackingState mangaFilterState;
@override
@JsonKey()
final TrackingMediumType trackingType;
/// Create a copy of AnimeListState /// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$AnimeListStateCopyWith<_AnimeListState> get copyWith => _$AnimeListStateCopyWith<_AnimeListState> get copyWith => __$AnimeListStateCopyWithImpl<_AnimeListState>(this, _$identity);
__$AnimeListStateCopyWithImpl<_AnimeListState>(this, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is _AnimeListState&&(identical(other.buttonVisibility, buttonVisibility) || other.buttonVisibility == buttonVisibility)&&const DeepCollectionEquality().equals(other._animes, _animes)&&const DeepCollectionEquality().equals(other._mangas, _mangas)&&(identical(other.animeFilterState, animeFilterState) || other.animeFilterState == animeFilterState)&&(identical(other.mangaFilterState, mangaFilterState) || other.mangaFilterState == mangaFilterState)&&(identical(other.trackingType, trackingType) || other.trackingType == trackingType));
(other.runtimeType == runtimeType &&
other is _AnimeListState &&
(identical(other.buttonVisibility, buttonVisibility) ||
other.buttonVisibility == buttonVisibility) &&
const DeepCollectionEquality().equals(other._animes, _animes) &&
const DeepCollectionEquality().equals(other._mangas, _mangas) &&
(identical(other.animeFilterState, animeFilterState) ||
other.animeFilterState == animeFilterState) &&
(identical(other.mangaFilterState, mangaFilterState) ||
other.mangaFilterState == mangaFilterState) &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType));
} }
@override @override
int get hashCode => Object.hash( int get hashCode => Object.hash(runtimeType,buttonVisibility,const DeepCollectionEquality().hash(_animes),const DeepCollectionEquality().hash(_mangas),animeFilterState,mangaFilterState,trackingType);
runtimeType,
buttonVisibility,
const DeepCollectionEquality().hash(_animes),
const DeepCollectionEquality().hash(_mangas),
animeFilterState,
mangaFilterState,
trackingType);
@override @override
String toString() { String toString() {
return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)'; return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class _$AnimeListStateCopyWith<$Res> abstract mixin class _$AnimeListStateCopyWith<$Res> implements $AnimeListStateCopyWith<$Res> {
implements $AnimeListStateCopyWith<$Res> { factory _$AnimeListStateCopyWith(_AnimeListState value, $Res Function(_AnimeListState) _then) = __$AnimeListStateCopyWithImpl;
factory _$AnimeListStateCopyWith( @override @useResult
_AnimeListState value, $Res Function(_AnimeListState) _then) = $Res call({
__$AnimeListStateCopyWithImpl; bool buttonVisibility, List<AnimeTrackingData> animes, List<MangaTrackingData> mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType
@override });
@useResult
$Res call(
{bool buttonVisibility,
List<AnimeTrackingData> animes,
List<MangaTrackingData> mangas,
MediumTrackingState animeFilterState,
MediumTrackingState mangaFilterState,
TrackingMediumType trackingType});
}
}
/// @nodoc /// @nodoc
class __$AnimeListStateCopyWithImpl<$Res> class __$AnimeListStateCopyWithImpl<$Res>
implements _$AnimeListStateCopyWith<$Res> { implements _$AnimeListStateCopyWith<$Res> {
@@ -419,43 +280,19 @@ class __$AnimeListStateCopyWithImpl<$Res>
/// Create a copy of AnimeListState /// Create a copy of AnimeListState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @pragma('vm:prefer-inline') $Res call({Object? buttonVisibility = null,Object? animes = null,Object? mangas = null,Object? animeFilterState = null,Object? mangaFilterState = null,Object? trackingType = null,}) {
@pragma('vm:prefer-inline')
$Res call({
Object? buttonVisibility = null,
Object? animes = null,
Object? mangas = null,
Object? animeFilterState = null,
Object? mangaFilterState = null,
Object? trackingType = null,
}) {
return _then(_AnimeListState( return _then(_AnimeListState(
buttonVisibility: null == buttonVisibility buttonVisibility: null == buttonVisibility ? _self.buttonVisibility : buttonVisibility // ignore: cast_nullable_to_non_nullable
? _self.buttonVisibility as bool,animes: null == animes ? _self._animes : animes // ignore: cast_nullable_to_non_nullable
: buttonVisibility // ignore: cast_nullable_to_non_nullable as List<AnimeTrackingData>,mangas: null == mangas ? _self._mangas : mangas // ignore: cast_nullable_to_non_nullable
as bool, as List<MangaTrackingData>,animeFilterState: null == animeFilterState ? _self.animeFilterState : animeFilterState // ignore: cast_nullable_to_non_nullable
animes: null == animes as MediumTrackingState,mangaFilterState: null == mangaFilterState ? _self.mangaFilterState : mangaFilterState // ignore: cast_nullable_to_non_nullable
? _self._animes as MediumTrackingState,trackingType: null == trackingType ? _self.trackingType : trackingType // ignore: cast_nullable_to_non_nullable
: animes // ignore: cast_nullable_to_non_nullable
as List<AnimeTrackingData>,
mangas: null == mangas
? _self._mangas
: mangas // ignore: cast_nullable_to_non_nullable
as List<MangaTrackingData>,
animeFilterState: null == animeFilterState
? _self.animeFilterState
: animeFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
mangaFilterState: null == mangaFilterState
? _self.mangaFilterState
: mangaFilterState // ignore: cast_nullable_to_non_nullable
as MediumTrackingState,
trackingType: null == trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType, as TrackingMediumType,
)); ));
} }
} }
// dart format on // dart format on

View File

@@ -11,59 +11,47 @@ part of 'anime_search_bloc.dart';
// dart format off // dart format off
T _$identity<T>(T value) => value; T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$AnimeSearchState { mixin _$AnimeSearchState {
TrackingMediumType get trackingType;
String get searchQuery;
bool get working;
List<SearchResult> get searchResults;
TrackingMediumType get trackingType; String get searchQuery; bool get working; List<SearchResult> get searchResults;
/// Create a copy of AnimeSearchState /// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$AnimeSearchStateCopyWith<AnimeSearchState> get copyWith => $AnimeSearchStateCopyWith<AnimeSearchState> get copyWith => _$AnimeSearchStateCopyWithImpl<AnimeSearchState>(this as AnimeSearchState, _$identity);
_$AnimeSearchStateCopyWithImpl<AnimeSearchState>(
this as AnimeSearchState, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is AnimeSearchState&&(identical(other.trackingType, trackingType) || other.trackingType == trackingType)&&(identical(other.searchQuery, searchQuery) || other.searchQuery == searchQuery)&&(identical(other.working, working) || other.working == working)&&const DeepCollectionEquality().equals(other.searchResults, searchResults));
(other.runtimeType == runtimeType &&
other is AnimeSearchState &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType) &&
(identical(other.searchQuery, searchQuery) ||
other.searchQuery == searchQuery) &&
(identical(other.working, working) || other.working == working) &&
const DeepCollectionEquality()
.equals(other.searchResults, searchResults));
} }
@override @override
int get hashCode => Object.hash(runtimeType, trackingType, searchQuery, int get hashCode => Object.hash(runtimeType,trackingType,searchQuery,working,const DeepCollectionEquality().hash(searchResults));
working, const DeepCollectionEquality().hash(searchResults));
@override @override
String toString() { String toString() {
return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)'; return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class $AnimeSearchStateCopyWith<$Res> { abstract mixin class $AnimeSearchStateCopyWith<$Res> {
factory $AnimeSearchStateCopyWith( factory $AnimeSearchStateCopyWith(AnimeSearchState value, $Res Function(AnimeSearchState) _then) = _$AnimeSearchStateCopyWithImpl;
AnimeSearchState value, $Res Function(AnimeSearchState) _then) =
_$AnimeSearchStateCopyWithImpl;
@useResult @useResult
$Res call( $Res call({
{TrackingMediumType trackingType, TrackingMediumType trackingType, String searchQuery, bool working, List<SearchResult> searchResults
String searchQuery, });
bool working,
List<SearchResult> searchResults});
}
}
/// @nodoc /// @nodoc
class _$AnimeSearchStateCopyWithImpl<$Res> class _$AnimeSearchStateCopyWithImpl<$Res>
implements $AnimeSearchStateCopyWith<$Res> { implements $AnimeSearchStateCopyWith<$Res> {
@@ -74,35 +62,19 @@ class _$AnimeSearchStateCopyWithImpl<$Res>
/// Create a copy of AnimeSearchState /// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? trackingType = null,Object? searchQuery = null,Object? working = null,Object? searchResults = null,}) {
@override
$Res call({
Object? trackingType = null,
Object? searchQuery = null,
Object? working = null,
Object? searchResults = null,
}) {
return _then(_self.copyWith( return _then(_self.copyWith(
trackingType: null == trackingType trackingType: null == trackingType ? _self.trackingType : trackingType // ignore: cast_nullable_to_non_nullable
? _self.trackingType as TrackingMediumType,searchQuery: null == searchQuery ? _self.searchQuery : searchQuery // ignore: cast_nullable_to_non_nullable
: trackingType // ignore: cast_nullable_to_non_nullable as String,working: null == working ? _self.working : working // ignore: cast_nullable_to_non_nullable
as TrackingMediumType, as bool,searchResults: null == searchResults ? _self.searchResults : searchResults // ignore: cast_nullable_to_non_nullable
searchQuery: null == searchQuery
? _self.searchQuery
: searchQuery // ignore: cast_nullable_to_non_nullable
as String,
working: null == working
? _self.working
: working // ignore: cast_nullable_to_non_nullable
as bool,
searchResults: null == searchResults
? _self.searchResults
: searchResults // ignore: cast_nullable_to_non_nullable
as List<SearchResult>, as List<SearchResult>,
)); ));
} }
} }
/// Adds pattern-matching-related methods to [AnimeSearchState]. /// Adds pattern-matching-related methods to [AnimeSearchState].
extension AnimeSearchStatePatterns on AnimeSearchState { extension AnimeSearchStatePatterns on AnimeSearchState {
/// A variant of `map` that fallback to returning `orElse`. /// A variant of `map` that fallback to returning `orElse`.
@@ -117,20 +89,15 @@ extension AnimeSearchStatePatterns on AnimeSearchState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AnimeSearchState value)? $default,{required TResult orElse(),}){
TResult maybeMap<TResult extends Object?>(
TResult Function(_AnimeSearchState value)? $default, {
required TResult orElse(),
}) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _AnimeSearchState() when $default != null: case _AnimeSearchState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// Callbacks receives the raw object, upcasted. /// Callbacks receives the raw object, upcasted.
@@ -144,19 +111,15 @@ extension AnimeSearchStatePatterns on AnimeSearchState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AnimeSearchState value) $default,){
TResult map<TResult extends Object?>(
TResult Function(_AnimeSearchState value) $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _AnimeSearchState(): case _AnimeSearchState():
return $default(_that); return $default(_that);case _:
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `map` that fallback to returning `null`. /// A variant of `map` that fallback to returning `null`.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -169,19 +132,15 @@ extension AnimeSearchStatePatterns on AnimeSearchState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AnimeSearchState value)? $default,){
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_AnimeSearchState value)? $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _AnimeSearchState() when $default != null: case _AnimeSearchState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return null; return null;
}
}
}
}
/// A variant of `when` that fallback to an `orElse` callback. /// A variant of `when` that fallback to an `orElse` callback.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -194,23 +153,14 @@ extension AnimeSearchStatePatterns on AnimeSearchState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( TrackingMediumType trackingType, String searchQuery, bool working, List<SearchResult> searchResults)? $default,{required TResult orElse(),}) {final _that = this;
TResult maybeWhen<TResult extends Object?>(
TResult Function(TrackingMediumType trackingType, String searchQuery,
bool working, List<SearchResult> searchResults)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) { switch (_that) {
case _AnimeSearchState() when $default != null: case _AnimeSearchState() when $default != null:
return $default(_that.trackingType, _that.searchQuery, _that.working, return $default(_that.trackingType,_that.searchQuery,_that.working,_that.searchResults);case _:
_that.searchResults);
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// As opposed to `map`, this offers destructuring. /// As opposed to `map`, this offers destructuring.
@@ -224,22 +174,14 @@ extension AnimeSearchStatePatterns on AnimeSearchState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( TrackingMediumType trackingType, String searchQuery, bool working, List<SearchResult> searchResults) $default,) {final _that = this;
TResult when<TResult extends Object?>(
TResult Function(TrackingMediumType trackingType, String searchQuery,
bool working, List<SearchResult> searchResults)
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _AnimeSearchState(): case _AnimeSearchState():
return $default(_that.trackingType, _that.searchQuery, _that.working, return $default(_that.trackingType,_that.searchQuery,_that.working,_that.searchResults);case _:
_that.searchResults);
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `when` that fallback to returning `null` /// A variant of `when` that fallback to returning `null`
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -252,98 +194,72 @@ extension AnimeSearchStatePatterns on AnimeSearchState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( TrackingMediumType trackingType, String searchQuery, bool working, List<SearchResult> searchResults)? $default,) {final _that = this;
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(TrackingMediumType trackingType, String searchQuery,
bool working, List<SearchResult> searchResults)?
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _AnimeSearchState() when $default != null: case _AnimeSearchState() when $default != null:
return $default(_that.trackingType, _that.searchQuery, _that.working, return $default(_that.trackingType,_that.searchQuery,_that.working,_that.searchResults);case _:
_that.searchResults);
case _:
return null; return null;
} }
} }
} }
/// @nodoc /// @nodoc
class _AnimeSearchState implements AnimeSearchState {
_AnimeSearchState(
{this.trackingType = TrackingMediumType.anime,
this.searchQuery = '',
this.working = false,
final List<SearchResult> searchResults = const []})
: _searchResults = searchResults;
@override class _AnimeSearchState implements AnimeSearchState {
@JsonKey() _AnimeSearchState({this.trackingType = TrackingMediumType.anime, this.searchQuery = '', this.working = false, final List<SearchResult> searchResults = const []}): _searchResults = searchResults;
final TrackingMediumType trackingType;
@override
@JsonKey() @override@JsonKey() final TrackingMediumType trackingType;
final String searchQuery; @override@JsonKey() final String searchQuery;
@override @override@JsonKey() final bool working;
@JsonKey()
final bool working;
final List<SearchResult> _searchResults; final List<SearchResult> _searchResults;
@override @override@JsonKey() List<SearchResult> get searchResults {
@JsonKey()
List<SearchResult> get searchResults {
if (_searchResults is EqualUnmodifiableListView) return _searchResults; if (_searchResults is EqualUnmodifiableListView) return _searchResults;
// ignore: implicit_dynamic_type // ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_searchResults); return EqualUnmodifiableListView(_searchResults);
} }
/// Create a copy of AnimeSearchState /// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$AnimeSearchStateCopyWith<_AnimeSearchState> get copyWith => _$AnimeSearchStateCopyWith<_AnimeSearchState> get copyWith => __$AnimeSearchStateCopyWithImpl<_AnimeSearchState>(this, _$identity);
__$AnimeSearchStateCopyWithImpl<_AnimeSearchState>(this, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is _AnimeSearchState&&(identical(other.trackingType, trackingType) || other.trackingType == trackingType)&&(identical(other.searchQuery, searchQuery) || other.searchQuery == searchQuery)&&(identical(other.working, working) || other.working == working)&&const DeepCollectionEquality().equals(other._searchResults, _searchResults));
(other.runtimeType == runtimeType &&
other is _AnimeSearchState &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType) &&
(identical(other.searchQuery, searchQuery) ||
other.searchQuery == searchQuery) &&
(identical(other.working, working) || other.working == working) &&
const DeepCollectionEquality()
.equals(other._searchResults, _searchResults));
} }
@override @override
int get hashCode => Object.hash(runtimeType, trackingType, searchQuery, int get hashCode => Object.hash(runtimeType,trackingType,searchQuery,working,const DeepCollectionEquality().hash(_searchResults));
working, const DeepCollectionEquality().hash(_searchResults));
@override @override
String toString() { String toString() {
return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)'; return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class _$AnimeSearchStateCopyWith<$Res> abstract mixin class _$AnimeSearchStateCopyWith<$Res> implements $AnimeSearchStateCopyWith<$Res> {
implements $AnimeSearchStateCopyWith<$Res> { factory _$AnimeSearchStateCopyWith(_AnimeSearchState value, $Res Function(_AnimeSearchState) _then) = __$AnimeSearchStateCopyWithImpl;
factory _$AnimeSearchStateCopyWith( @override @useResult
_AnimeSearchState value, $Res Function(_AnimeSearchState) _then) = $Res call({
__$AnimeSearchStateCopyWithImpl; TrackingMediumType trackingType, String searchQuery, bool working, List<SearchResult> searchResults
@override });
@useResult
$Res call(
{TrackingMediumType trackingType,
String searchQuery,
bool working,
List<SearchResult> searchResults});
}
}
/// @nodoc /// @nodoc
class __$AnimeSearchStateCopyWithImpl<$Res> class __$AnimeSearchStateCopyWithImpl<$Res>
implements _$AnimeSearchStateCopyWith<$Res> { implements _$AnimeSearchStateCopyWith<$Res> {
@@ -354,33 +270,17 @@ class __$AnimeSearchStateCopyWithImpl<$Res>
/// Create a copy of AnimeSearchState /// Create a copy of AnimeSearchState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @pragma('vm:prefer-inline') $Res call({Object? trackingType = null,Object? searchQuery = null,Object? working = null,Object? searchResults = null,}) {
@pragma('vm:prefer-inline')
$Res call({
Object? trackingType = null,
Object? searchQuery = null,
Object? working = null,
Object? searchResults = null,
}) {
return _then(_AnimeSearchState( return _then(_AnimeSearchState(
trackingType: null == trackingType trackingType: null == trackingType ? _self.trackingType : trackingType // ignore: cast_nullable_to_non_nullable
? _self.trackingType as TrackingMediumType,searchQuery: null == searchQuery ? _self.searchQuery : searchQuery // ignore: cast_nullable_to_non_nullable
: trackingType // ignore: cast_nullable_to_non_nullable as String,working: null == working ? _self.working : working // ignore: cast_nullable_to_non_nullable
as TrackingMediumType, as bool,searchResults: null == searchResults ? _self._searchResults : searchResults // ignore: cast_nullable_to_non_nullable
searchQuery: null == searchQuery
? _self.searchQuery
: searchQuery // ignore: cast_nullable_to_non_nullable
as String,
working: null == working
? _self.working
: working // ignore: cast_nullable_to_non_nullable
as bool,
searchResults: null == searchResults
? _self._searchResults
: searchResults // ignore: cast_nullable_to_non_nullable
as List<SearchResult>, as List<SearchResult>,
)); ));
} }
} }
// dart format on // dart format on

View File

@@ -11,53 +11,47 @@ part of 'calendar_bloc.dart';
// dart format off // dart format off
T _$identity<T>(T value) => value; T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$CalendarState { mixin _$CalendarState {
bool get refreshing;
int get refreshingCount;
int get refreshingTotal;
bool get refreshing; int get refreshingCount; int get refreshingTotal;
/// Create a copy of CalendarState /// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$CalendarStateCopyWith<CalendarState> get copyWith => $CalendarStateCopyWith<CalendarState> get copyWith => _$CalendarStateCopyWithImpl<CalendarState>(this as CalendarState, _$identity);
_$CalendarStateCopyWithImpl<CalendarState>(
this as CalendarState, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is CalendarState&&(identical(other.refreshing, refreshing) || other.refreshing == refreshing)&&(identical(other.refreshingCount, refreshingCount) || other.refreshingCount == refreshingCount)&&(identical(other.refreshingTotal, refreshingTotal) || other.refreshingTotal == refreshingTotal));
(other.runtimeType == runtimeType &&
other is CalendarState &&
(identical(other.refreshing, refreshing) ||
other.refreshing == refreshing) &&
(identical(other.refreshingCount, refreshingCount) ||
other.refreshingCount == refreshingCount) &&
(identical(other.refreshingTotal, refreshingTotal) ||
other.refreshingTotal == refreshingTotal));
} }
@override @override
int get hashCode => int get hashCode => Object.hash(runtimeType,refreshing,refreshingCount,refreshingTotal);
Object.hash(runtimeType, refreshing, refreshingCount, refreshingTotal);
@override @override
String toString() { String toString() {
return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)'; return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class $CalendarStateCopyWith<$Res> { abstract mixin class $CalendarStateCopyWith<$Res> {
factory $CalendarStateCopyWith( factory $CalendarStateCopyWith(CalendarState value, $Res Function(CalendarState) _then) = _$CalendarStateCopyWithImpl;
CalendarState value, $Res Function(CalendarState) _then) =
_$CalendarStateCopyWithImpl;
@useResult @useResult
$Res call({bool refreshing, int refreshingCount, int refreshingTotal}); $Res call({
} bool refreshing, int refreshingCount, int refreshingTotal
});
}
/// @nodoc /// @nodoc
class _$CalendarStateCopyWithImpl<$Res> class _$CalendarStateCopyWithImpl<$Res>
implements $CalendarStateCopyWith<$Res> { implements $CalendarStateCopyWith<$Res> {
@@ -68,30 +62,18 @@ class _$CalendarStateCopyWithImpl<$Res>
/// Create a copy of CalendarState /// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? refreshing = null,Object? refreshingCount = null,Object? refreshingTotal = null,}) {
@override
$Res call({
Object? refreshing = null,
Object? refreshingCount = null,
Object? refreshingTotal = null,
}) {
return _then(_self.copyWith( return _then(_self.copyWith(
refreshing: null == refreshing refreshing: null == refreshing ? _self.refreshing : refreshing // ignore: cast_nullable_to_non_nullable
? _self.refreshing as bool,refreshingCount: null == refreshingCount ? _self.refreshingCount : refreshingCount // ignore: cast_nullable_to_non_nullable
: refreshing // ignore: cast_nullable_to_non_nullable as int,refreshingTotal: null == refreshingTotal ? _self.refreshingTotal : refreshingTotal // ignore: cast_nullable_to_non_nullable
as bool,
refreshingCount: null == refreshingCount
? _self.refreshingCount
: refreshingCount // ignore: cast_nullable_to_non_nullable
as int,
refreshingTotal: null == refreshingTotal
? _self.refreshingTotal
: refreshingTotal // ignore: cast_nullable_to_non_nullable
as int, as int,
)); ));
} }
} }
/// Adds pattern-matching-related methods to [CalendarState]. /// Adds pattern-matching-related methods to [CalendarState].
extension CalendarStatePatterns on CalendarState { extension CalendarStatePatterns on CalendarState {
/// A variant of `map` that fallback to returning `orElse`. /// A variant of `map` that fallback to returning `orElse`.
@@ -106,20 +88,15 @@ extension CalendarStatePatterns on CalendarState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _CalendarState value)? $default,{required TResult orElse(),}){
TResult maybeMap<TResult extends Object?>(
TResult Function(_CalendarState value)? $default, {
required TResult orElse(),
}) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _CalendarState() when $default != null: case _CalendarState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// Callbacks receives the raw object, upcasted. /// Callbacks receives the raw object, upcasted.
@@ -133,19 +110,15 @@ extension CalendarStatePatterns on CalendarState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _CalendarState value) $default,){
TResult map<TResult extends Object?>(
TResult Function(_CalendarState value) $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _CalendarState(): case _CalendarState():
return $default(_that); return $default(_that);case _:
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `map` that fallback to returning `null`. /// A variant of `map` that fallback to returning `null`.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -158,19 +131,15 @@ extension CalendarStatePatterns on CalendarState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _CalendarState value)? $default,){
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_CalendarState value)? $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _CalendarState() when $default != null: case _CalendarState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return null; return null;
}
}
}
}
/// A variant of `when` that fallback to an `orElse` callback. /// A variant of `when` that fallback to an `orElse` callback.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -183,22 +152,14 @@ extension CalendarStatePatterns on CalendarState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool refreshing, int refreshingCount, int refreshingTotal)? $default,{required TResult orElse(),}) {final _that = this;
TResult maybeWhen<TResult extends Object?>(
TResult Function(bool refreshing, int refreshingCount, int refreshingTotal)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) { switch (_that) {
case _CalendarState() when $default != null: case _CalendarState() when $default != null:
return $default( return $default(_that.refreshing,_that.refreshingCount,_that.refreshingTotal);case _:
_that.refreshing, _that.refreshingCount, _that.refreshingTotal);
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// As opposed to `map`, this offers destructuring. /// As opposed to `map`, this offers destructuring.
@@ -212,21 +173,14 @@ extension CalendarStatePatterns on CalendarState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool refreshing, int refreshingCount, int refreshingTotal) $default,) {final _that = this;
TResult when<TResult extends Object?>(
TResult Function(bool refreshing, int refreshingCount, int refreshingTotal)
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _CalendarState(): case _CalendarState():
return $default( return $default(_that.refreshing,_that.refreshingCount,_that.refreshingTotal);case _:
_that.refreshing, _that.refreshingCount, _that.refreshingTotal);
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `when` that fallback to returning `null` /// A variant of `when` that fallback to returning `null`
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -239,77 +193,65 @@ extension CalendarStatePatterns on CalendarState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool refreshing, int refreshingCount, int refreshingTotal)? $default,) {final _that = this;
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(
bool refreshing, int refreshingCount, int refreshingTotal)?
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _CalendarState() when $default != null: case _CalendarState() when $default != null:
return $default( return $default(_that.refreshing,_that.refreshingCount,_that.refreshingTotal);case _:
_that.refreshing, _that.refreshingCount, _that.refreshingTotal);
case _:
return null; return null;
} }
} }
} }
/// @nodoc /// @nodoc
class _CalendarState implements CalendarState { class _CalendarState implements CalendarState {
_CalendarState(this.refreshing, this.refreshingCount, this.refreshingTotal); _CalendarState(this.refreshing, this.refreshingCount, this.refreshingTotal);
@override
final bool refreshing; @override final bool refreshing;
@override @override final int refreshingCount;
final int refreshingCount; @override final int refreshingTotal;
@override
final int refreshingTotal;
/// Create a copy of CalendarState /// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$CalendarStateCopyWith<_CalendarState> get copyWith => _$CalendarStateCopyWith<_CalendarState> get copyWith => __$CalendarStateCopyWithImpl<_CalendarState>(this, _$identity);
__$CalendarStateCopyWithImpl<_CalendarState>(this, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is _CalendarState&&(identical(other.refreshing, refreshing) || other.refreshing == refreshing)&&(identical(other.refreshingCount, refreshingCount) || other.refreshingCount == refreshingCount)&&(identical(other.refreshingTotal, refreshingTotal) || other.refreshingTotal == refreshingTotal));
(other.runtimeType == runtimeType &&
other is _CalendarState &&
(identical(other.refreshing, refreshing) ||
other.refreshing == refreshing) &&
(identical(other.refreshingCount, refreshingCount) ||
other.refreshingCount == refreshingCount) &&
(identical(other.refreshingTotal, refreshingTotal) ||
other.refreshingTotal == refreshingTotal));
} }
@override @override
int get hashCode => int get hashCode => Object.hash(runtimeType,refreshing,refreshingCount,refreshingTotal);
Object.hash(runtimeType, refreshing, refreshingCount, refreshingTotal);
@override @override
String toString() { String toString() {
return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)'; return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class _$CalendarStateCopyWith<$Res> abstract mixin class _$CalendarStateCopyWith<$Res> implements $CalendarStateCopyWith<$Res> {
implements $CalendarStateCopyWith<$Res> { factory _$CalendarStateCopyWith(_CalendarState value, $Res Function(_CalendarState) _then) = __$CalendarStateCopyWithImpl;
factory _$CalendarStateCopyWith( @override @useResult
_CalendarState value, $Res Function(_CalendarState) _then) = $Res call({
__$CalendarStateCopyWithImpl; bool refreshing, int refreshingCount, int refreshingTotal
@override });
@useResult
$Res call({bool refreshing, int refreshingCount, int refreshingTotal});
}
}
/// @nodoc /// @nodoc
class __$CalendarStateCopyWithImpl<$Res> class __$CalendarStateCopyWithImpl<$Res>
implements _$CalendarStateCopyWith<$Res> { implements _$CalendarStateCopyWith<$Res> {
@@ -320,28 +262,16 @@ class __$CalendarStateCopyWithImpl<$Res>
/// Create a copy of CalendarState /// Create a copy of CalendarState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @pragma('vm:prefer-inline') $Res call({Object? refreshing = null,Object? refreshingCount = null,Object? refreshingTotal = null,}) {
@pragma('vm:prefer-inline')
$Res call({
Object? refreshing = null,
Object? refreshingCount = null,
Object? refreshingTotal = null,
}) {
return _then(_CalendarState( return _then(_CalendarState(
null == refreshing null == refreshing ? _self.refreshing : refreshing // ignore: cast_nullable_to_non_nullable
? _self.refreshing as bool,null == refreshingCount ? _self.refreshingCount : refreshingCount // ignore: cast_nullable_to_non_nullable
: refreshing // ignore: cast_nullable_to_non_nullable as int,null == refreshingTotal ? _self.refreshingTotal : refreshingTotal // ignore: cast_nullable_to_non_nullable
as bool,
null == refreshingCount
? _self.refreshingCount
: refreshingCount // ignore: cast_nullable_to_non_nullable
as int,
null == refreshingTotal
? _self.refreshingTotal
: refreshingTotal // ignore: cast_nullable_to_non_nullable
as int, as int,
)); ));
} }
} }
// dart format on // dart format on

View File

@@ -11,57 +11,50 @@ part of 'details_bloc.dart';
// dart format off // dart format off
T _$identity<T>(T value) => value; T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$DetailsState { mixin _$DetailsState {
TrackingMedium? get data;
String? get heroImagePrefix;
TrackingMediumType get trackingType;
TrackingMedium? get data; String? get heroImagePrefix; TrackingMediumType get trackingType;
/// Create a copy of DetailsState /// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$DetailsStateCopyWith<DetailsState> get copyWith => $DetailsStateCopyWith<DetailsState> get copyWith => _$DetailsStateCopyWithImpl<DetailsState>(this as DetailsState, _$identity);
_$DetailsStateCopyWithImpl<DetailsState>(
this as DetailsState, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is DetailsState&&(identical(other.data, data) || other.data == data)&&(identical(other.heroImagePrefix, heroImagePrefix) || other.heroImagePrefix == heroImagePrefix)&&(identical(other.trackingType, trackingType) || other.trackingType == trackingType));
(other.runtimeType == runtimeType &&
other is DetailsState &&
(identical(other.data, data) || other.data == data) &&
(identical(other.heroImagePrefix, heroImagePrefix) ||
other.heroImagePrefix == heroImagePrefix) &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType));
} }
@override @override
int get hashCode => int get hashCode => Object.hash(runtimeType,data,heroImagePrefix,trackingType);
Object.hash(runtimeType, data, heroImagePrefix, trackingType);
@override @override
String toString() { String toString() {
return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)'; return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class $DetailsStateCopyWith<$Res> { abstract mixin class $DetailsStateCopyWith<$Res> {
factory $DetailsStateCopyWith( factory $DetailsStateCopyWith(DetailsState value, $Res Function(DetailsState) _then) = _$DetailsStateCopyWithImpl;
DetailsState value, $Res Function(DetailsState) _then) =
_$DetailsStateCopyWithImpl;
@useResult @useResult
$Res call( $Res call({
{TrackingMedium? data, TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType
String? heroImagePrefix, });
TrackingMediumType trackingType});
}
}
/// @nodoc /// @nodoc
class _$DetailsStateCopyWithImpl<$Res> implements $DetailsStateCopyWith<$Res> { class _$DetailsStateCopyWithImpl<$Res>
implements $DetailsStateCopyWith<$Res> {
_$DetailsStateCopyWithImpl(this._self, this._then); _$DetailsStateCopyWithImpl(this._self, this._then);
final DetailsState _self; final DetailsState _self;
@@ -69,30 +62,18 @@ class _$DetailsStateCopyWithImpl<$Res> implements $DetailsStateCopyWith<$Res> {
/// Create a copy of DetailsState /// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? data = freezed,Object? heroImagePrefix = freezed,Object? trackingType = null,}) {
@override
$Res call({
Object? data = freezed,
Object? heroImagePrefix = freezed,
Object? trackingType = null,
}) {
return _then(_self.copyWith( return _then(_self.copyWith(
data: freezed == data data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
? _self.data as TrackingMedium?,heroImagePrefix: freezed == heroImagePrefix ? _self.heroImagePrefix : heroImagePrefix // ignore: cast_nullable_to_non_nullable
: data // ignore: cast_nullable_to_non_nullable as String?,trackingType: null == trackingType ? _self.trackingType : trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMedium?,
heroImagePrefix: freezed == heroImagePrefix
? _self.heroImagePrefix
: heroImagePrefix // ignore: cast_nullable_to_non_nullable
as String?,
trackingType: null == trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType, as TrackingMediumType,
)); ));
} }
} }
/// Adds pattern-matching-related methods to [DetailsState]. /// Adds pattern-matching-related methods to [DetailsState].
extension DetailsStatePatterns on DetailsState { extension DetailsStatePatterns on DetailsState {
/// A variant of `map` that fallback to returning `orElse`. /// A variant of `map` that fallback to returning `orElse`.
@@ -107,20 +88,15 @@ extension DetailsStatePatterns on DetailsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _DetailsState value)? $default,{required TResult orElse(),}){
TResult maybeMap<TResult extends Object?>(
TResult Function(_DetailsState value)? $default, {
required TResult orElse(),
}) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _DetailsState() when $default != null: case _DetailsState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// Callbacks receives the raw object, upcasted. /// Callbacks receives the raw object, upcasted.
@@ -134,19 +110,15 @@ extension DetailsStatePatterns on DetailsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _DetailsState value) $default,){
TResult map<TResult extends Object?>(
TResult Function(_DetailsState value) $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _DetailsState(): case _DetailsState():
return $default(_that); return $default(_that);case _:
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `map` that fallback to returning `null`. /// A variant of `map` that fallback to returning `null`.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -159,19 +131,15 @@ extension DetailsStatePatterns on DetailsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _DetailsState value)? $default,){
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_DetailsState value)? $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _DetailsState() when $default != null: case _DetailsState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return null; return null;
}
}
}
}
/// A variant of `when` that fallback to an `orElse` callback. /// A variant of `when` that fallback to an `orElse` callback.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -184,22 +152,14 @@ extension DetailsStatePatterns on DetailsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType)? $default,{required TResult orElse(),}) {final _that = this;
TResult maybeWhen<TResult extends Object?>(
TResult Function(TrackingMedium? data, String? heroImagePrefix,
TrackingMediumType trackingType)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) { switch (_that) {
case _DetailsState() when $default != null: case _DetailsState() when $default != null:
return $default(_that.data, _that.heroImagePrefix, _that.trackingType); return $default(_that.data,_that.heroImagePrefix,_that.trackingType);case _:
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// As opposed to `map`, this offers destructuring. /// As opposed to `map`, this offers destructuring.
@@ -213,21 +173,14 @@ extension DetailsStatePatterns on DetailsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType) $default,) {final _that = this;
TResult when<TResult extends Object?>(
TResult Function(TrackingMedium? data, String? heroImagePrefix,
TrackingMediumType trackingType)
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _DetailsState(): case _DetailsState():
return $default(_that.data, _that.heroImagePrefix, _that.trackingType); return $default(_that.data,_that.heroImagePrefix,_that.trackingType);case _:
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `when` that fallback to returning `null` /// A variant of `when` that fallback to returning `null`
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -240,82 +193,65 @@ extension DetailsStatePatterns on DetailsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType)? $default,) {final _that = this;
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(TrackingMedium? data, String? heroImagePrefix,
TrackingMediumType trackingType)?
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _DetailsState() when $default != null: case _DetailsState() when $default != null:
return $default(_that.data, _that.heroImagePrefix, _that.trackingType); return $default(_that.data,_that.heroImagePrefix,_that.trackingType);case _:
case _:
return null; return null;
} }
} }
} }
/// @nodoc /// @nodoc
class _DetailsState implements DetailsState {
_DetailsState(
{this.data,
this.heroImagePrefix,
this.trackingType = TrackingMediumType.anime});
@override class _DetailsState implements DetailsState {
final TrackingMedium? data; _DetailsState({this.data, this.heroImagePrefix, this.trackingType = TrackingMediumType.anime});
@override
final String? heroImagePrefix;
@override @override final TrackingMedium? data;
@JsonKey() @override final String? heroImagePrefix;
final TrackingMediumType trackingType; @override@JsonKey() final TrackingMediumType trackingType;
/// Create a copy of DetailsState /// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$DetailsStateCopyWith<_DetailsState> get copyWith => _$DetailsStateCopyWith<_DetailsState> get copyWith => __$DetailsStateCopyWithImpl<_DetailsState>(this, _$identity);
__$DetailsStateCopyWithImpl<_DetailsState>(this, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is _DetailsState&&(identical(other.data, data) || other.data == data)&&(identical(other.heroImagePrefix, heroImagePrefix) || other.heroImagePrefix == heroImagePrefix)&&(identical(other.trackingType, trackingType) || other.trackingType == trackingType));
(other.runtimeType == runtimeType &&
other is _DetailsState &&
(identical(other.data, data) || other.data == data) &&
(identical(other.heroImagePrefix, heroImagePrefix) ||
other.heroImagePrefix == heroImagePrefix) &&
(identical(other.trackingType, trackingType) ||
other.trackingType == trackingType));
} }
@override @override
int get hashCode => int get hashCode => Object.hash(runtimeType,data,heroImagePrefix,trackingType);
Object.hash(runtimeType, data, heroImagePrefix, trackingType);
@override @override
String toString() { String toString() {
return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)'; return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class _$DetailsStateCopyWith<$Res> abstract mixin class _$DetailsStateCopyWith<$Res> implements $DetailsStateCopyWith<$Res> {
implements $DetailsStateCopyWith<$Res> { factory _$DetailsStateCopyWith(_DetailsState value, $Res Function(_DetailsState) _then) = __$DetailsStateCopyWithImpl;
factory _$DetailsStateCopyWith( @override @useResult
_DetailsState value, $Res Function(_DetailsState) _then) = $Res call({
__$DetailsStateCopyWithImpl; TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType
@override });
@useResult
$Res call(
{TrackingMedium? data,
String? heroImagePrefix,
TrackingMediumType trackingType});
}
}
/// @nodoc /// @nodoc
class __$DetailsStateCopyWithImpl<$Res> class __$DetailsStateCopyWithImpl<$Res>
implements _$DetailsStateCopyWith<$Res> { implements _$DetailsStateCopyWith<$Res> {
@@ -326,28 +262,16 @@ class __$DetailsStateCopyWithImpl<$Res>
/// Create a copy of DetailsState /// Create a copy of DetailsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @pragma('vm:prefer-inline') $Res call({Object? data = freezed,Object? heroImagePrefix = freezed,Object? trackingType = null,}) {
@pragma('vm:prefer-inline')
$Res call({
Object? data = freezed,
Object? heroImagePrefix = freezed,
Object? trackingType = null,
}) {
return _then(_DetailsState( return _then(_DetailsState(
data: freezed == data data: freezed == data ? _self.data : data // ignore: cast_nullable_to_non_nullable
? _self.data as TrackingMedium?,heroImagePrefix: freezed == heroImagePrefix ? _self.heroImagePrefix : heroImagePrefix // ignore: cast_nullable_to_non_nullable
: data // ignore: cast_nullable_to_non_nullable as String?,trackingType: null == trackingType ? _self.trackingType : trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMedium?,
heroImagePrefix: freezed == heroImagePrefix
? _self.heroImagePrefix
: heroImagePrefix // ignore: cast_nullable_to_non_nullable
as String?,
trackingType: null == trackingType
? _self.trackingType
: trackingType // ignore: cast_nullable_to_non_nullable
as TrackingMediumType, as TrackingMediumType,
)); ));
} }
} }
// dart format on // dart format on

View File

@@ -11,53 +11,47 @@ part of 'settings_bloc.dart';
// dart format off // dart format off
T _$identity<T>(T value) => value; T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$SettingsState { mixin _$SettingsState {
bool get importSpinnerVisible;
int get importCurrent;
int get importTotal;
bool get importSpinnerVisible; int get importCurrent; int get importTotal;
/// Create a copy of SettingsState /// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
$SettingsStateCopyWith<SettingsState> get copyWith => $SettingsStateCopyWith<SettingsState> get copyWith => _$SettingsStateCopyWithImpl<SettingsState>(this as SettingsState, _$identity);
_$SettingsStateCopyWithImpl<SettingsState>(
this as SettingsState, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is SettingsState&&(identical(other.importSpinnerVisible, importSpinnerVisible) || other.importSpinnerVisible == importSpinnerVisible)&&(identical(other.importCurrent, importCurrent) || other.importCurrent == importCurrent)&&(identical(other.importTotal, importTotal) || other.importTotal == importTotal));
(other.runtimeType == runtimeType &&
other is SettingsState &&
(identical(other.importSpinnerVisible, importSpinnerVisible) ||
other.importSpinnerVisible == importSpinnerVisible) &&
(identical(other.importCurrent, importCurrent) ||
other.importCurrent == importCurrent) &&
(identical(other.importTotal, importTotal) ||
other.importTotal == importTotal));
} }
@override @override
int get hashCode => Object.hash( int get hashCode => Object.hash(runtimeType,importSpinnerVisible,importCurrent,importTotal);
runtimeType, importSpinnerVisible, importCurrent, importTotal);
@override @override
String toString() { String toString() {
return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)'; return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class $SettingsStateCopyWith<$Res> { abstract mixin class $SettingsStateCopyWith<$Res> {
factory $SettingsStateCopyWith( factory $SettingsStateCopyWith(SettingsState value, $Res Function(SettingsState) _then) = _$SettingsStateCopyWithImpl;
SettingsState value, $Res Function(SettingsState) _then) =
_$SettingsStateCopyWithImpl;
@useResult @useResult
$Res call({bool importSpinnerVisible, int importCurrent, int importTotal}); $Res call({
} bool importSpinnerVisible, int importCurrent, int importTotal
});
}
/// @nodoc /// @nodoc
class _$SettingsStateCopyWithImpl<$Res> class _$SettingsStateCopyWithImpl<$Res>
implements $SettingsStateCopyWith<$Res> { implements $SettingsStateCopyWith<$Res> {
@@ -68,30 +62,18 @@ class _$SettingsStateCopyWithImpl<$Res>
/// Create a copy of SettingsState /// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline') @override $Res call({Object? importSpinnerVisible = null,Object? importCurrent = null,Object? importTotal = null,}) {
@override
$Res call({
Object? importSpinnerVisible = null,
Object? importCurrent = null,
Object? importTotal = null,
}) {
return _then(_self.copyWith( return _then(_self.copyWith(
importSpinnerVisible: null == importSpinnerVisible importSpinnerVisible: null == importSpinnerVisible ? _self.importSpinnerVisible : importSpinnerVisible // ignore: cast_nullable_to_non_nullable
? _self.importSpinnerVisible as bool,importCurrent: null == importCurrent ? _self.importCurrent : importCurrent // ignore: cast_nullable_to_non_nullable
: importSpinnerVisible // ignore: cast_nullable_to_non_nullable as int,importTotal: null == importTotal ? _self.importTotal : importTotal // ignore: cast_nullable_to_non_nullable
as bool,
importCurrent: null == importCurrent
? _self.importCurrent
: importCurrent // ignore: cast_nullable_to_non_nullable
as int,
importTotal: null == importTotal
? _self.importTotal
: importTotal // ignore: cast_nullable_to_non_nullable
as int, as int,
)); ));
} }
} }
/// Adds pattern-matching-related methods to [SettingsState]. /// Adds pattern-matching-related methods to [SettingsState].
extension SettingsStatePatterns on SettingsState { extension SettingsStatePatterns on SettingsState {
/// A variant of `map` that fallback to returning `orElse`. /// A variant of `map` that fallback to returning `orElse`.
@@ -106,20 +88,15 @@ extension SettingsStatePatterns on SettingsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _SettingsState value)? $default,{required TResult orElse(),}){
TResult maybeMap<TResult extends Object?>(
TResult Function(_SettingsState value)? $default, {
required TResult orElse(),
}) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _SettingsState() when $default != null: case _SettingsState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// Callbacks receives the raw object, upcasted. /// Callbacks receives the raw object, upcasted.
@@ -133,19 +110,15 @@ extension SettingsStatePatterns on SettingsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _SettingsState value) $default,){
TResult map<TResult extends Object?>(
TResult Function(_SettingsState value) $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _SettingsState(): case _SettingsState():
return $default(_that); return $default(_that);case _:
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `map` that fallback to returning `null`. /// A variant of `map` that fallback to returning `null`.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -158,19 +131,15 @@ extension SettingsStatePatterns on SettingsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _SettingsState value)? $default,){
TResult? mapOrNull<TResult extends Object?>(
TResult? Function(_SettingsState value)? $default,
) {
final _that = this; final _that = this;
switch (_that) { switch (_that) {
case _SettingsState() when $default != null: case _SettingsState() when $default != null:
return $default(_that); return $default(_that);case _:
case _:
return null; return null;
}
}
}
}
/// A variant of `when` that fallback to an `orElse` callback. /// A variant of `when` that fallback to an `orElse` callback.
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -183,23 +152,14 @@ extension SettingsStatePatterns on SettingsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool importSpinnerVisible, int importCurrent, int importTotal)? $default,{required TResult orElse(),}) {final _that = this;
TResult maybeWhen<TResult extends Object?>(
TResult Function(
bool importSpinnerVisible, int importCurrent, int importTotal)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) { switch (_that) {
case _SettingsState() when $default != null: case _SettingsState() when $default != null:
return $default( return $default(_that.importSpinnerVisible,_that.importCurrent,_that.importTotal);case _:
_that.importSpinnerVisible, _that.importCurrent, _that.importTotal);
case _:
return orElse(); return orElse();
}
}
}
}
/// A `switch`-like method, using callbacks. /// A `switch`-like method, using callbacks.
/// ///
/// As opposed to `map`, this offers destructuring. /// As opposed to `map`, this offers destructuring.
@@ -213,22 +173,14 @@ extension SettingsStatePatterns on SettingsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool importSpinnerVisible, int importCurrent, int importTotal) $default,) {final _that = this;
TResult when<TResult extends Object?>(
TResult Function(
bool importSpinnerVisible, int importCurrent, int importTotal)
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _SettingsState(): case _SettingsState():
return $default( return $default(_that.importSpinnerVisible,_that.importCurrent,_that.importTotal);case _:
_that.importSpinnerVisible, _that.importCurrent, _that.importTotal);
case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
}
}
}
}
/// A variant of `when` that fallback to returning `null` /// A variant of `when` that fallback to returning `null`
/// ///
/// It is equivalent to doing: /// It is equivalent to doing:
@@ -241,83 +193,65 @@ extension SettingsStatePatterns on SettingsState {
/// } /// }
/// ``` /// ```
@optionalTypeArgs @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool importSpinnerVisible, int importCurrent, int importTotal)? $default,) {final _that = this;
TResult? whenOrNull<TResult extends Object?>(
TResult? Function(
bool importSpinnerVisible, int importCurrent, int importTotal)?
$default,
) {
final _that = this;
switch (_that) { switch (_that) {
case _SettingsState() when $default != null: case _SettingsState() when $default != null:
return $default( return $default(_that.importSpinnerVisible,_that.importCurrent,_that.importTotal);case _:
_that.importSpinnerVisible, _that.importCurrent, _that.importTotal);
case _:
return null; return null;
} }
} }
} }
/// @nodoc /// @nodoc
class _SettingsState implements SettingsState {
_SettingsState(
{this.importSpinnerVisible = false,
this.importCurrent = 0,
this.importTotal = 0});
@override class _SettingsState implements SettingsState {
@JsonKey() _SettingsState({this.importSpinnerVisible = false, this.importCurrent = 0, this.importTotal = 0});
final bool importSpinnerVisible;
@override
@JsonKey() @override@JsonKey() final bool importSpinnerVisible;
final int importCurrent; @override@JsonKey() final int importCurrent;
@override @override@JsonKey() final int importTotal;
@JsonKey()
final int importTotal;
/// Create a copy of SettingsState /// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @JsonKey(includeFromJson: false, includeToJson: false)
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$SettingsStateCopyWith<_SettingsState> get copyWith => _$SettingsStateCopyWith<_SettingsState> get copyWith => __$SettingsStateCopyWithImpl<_SettingsState>(this, _$identity);
__$SettingsStateCopyWithImpl<_SettingsState>(this, _$identity);
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) || (other.runtimeType == runtimeType&&other is _SettingsState&&(identical(other.importSpinnerVisible, importSpinnerVisible) || other.importSpinnerVisible == importSpinnerVisible)&&(identical(other.importCurrent, importCurrent) || other.importCurrent == importCurrent)&&(identical(other.importTotal, importTotal) || other.importTotal == importTotal));
(other.runtimeType == runtimeType &&
other is _SettingsState &&
(identical(other.importSpinnerVisible, importSpinnerVisible) ||
other.importSpinnerVisible == importSpinnerVisible) &&
(identical(other.importCurrent, importCurrent) ||
other.importCurrent == importCurrent) &&
(identical(other.importTotal, importTotal) ||
other.importTotal == importTotal));
} }
@override @override
int get hashCode => Object.hash( int get hashCode => Object.hash(runtimeType,importSpinnerVisible,importCurrent,importTotal);
runtimeType, importSpinnerVisible, importCurrent, importTotal);
@override @override
String toString() { String toString() {
return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)'; return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)';
} }
} }
/// @nodoc /// @nodoc
abstract mixin class _$SettingsStateCopyWith<$Res> abstract mixin class _$SettingsStateCopyWith<$Res> implements $SettingsStateCopyWith<$Res> {
implements $SettingsStateCopyWith<$Res> { factory _$SettingsStateCopyWith(_SettingsState value, $Res Function(_SettingsState) _then) = __$SettingsStateCopyWithImpl;
factory _$SettingsStateCopyWith( @override @useResult
_SettingsState value, $Res Function(_SettingsState) _then) = $Res call({
__$SettingsStateCopyWithImpl; bool importSpinnerVisible, int importCurrent, int importTotal
@override });
@useResult
$Res call({bool importSpinnerVisible, int importCurrent, int importTotal});
}
}
/// @nodoc /// @nodoc
class __$SettingsStateCopyWithImpl<$Res> class __$SettingsStateCopyWithImpl<$Res>
implements _$SettingsStateCopyWith<$Res> { implements _$SettingsStateCopyWith<$Res> {
@@ -328,28 +262,16 @@ class __$SettingsStateCopyWithImpl<$Res>
/// Create a copy of SettingsState /// Create a copy of SettingsState
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @override @pragma('vm:prefer-inline') $Res call({Object? importSpinnerVisible = null,Object? importCurrent = null,Object? importTotal = null,}) {
@pragma('vm:prefer-inline')
$Res call({
Object? importSpinnerVisible = null,
Object? importCurrent = null,
Object? importTotal = null,
}) {
return _then(_SettingsState( return _then(_SettingsState(
importSpinnerVisible: null == importSpinnerVisible importSpinnerVisible: null == importSpinnerVisible ? _self.importSpinnerVisible : importSpinnerVisible // ignore: cast_nullable_to_non_nullable
? _self.importSpinnerVisible as bool,importCurrent: null == importCurrent ? _self.importCurrent : importCurrent // ignore: cast_nullable_to_non_nullable
: importSpinnerVisible // ignore: cast_nullable_to_non_nullable as int,importTotal: null == importTotal ? _self.importTotal : importTotal // ignore: cast_nullable_to_non_nullable
as bool,
importCurrent: null == importCurrent
? _self.importCurrent
: importCurrent // ignore: cast_nullable_to_non_nullable
as int,
importTotal: null == importTotal
? _self.importTotal
: importTotal // ignore: cast_nullable_to_non_nullable
as int, as int,
)); ));
} }
} }
// dart format on // dart format on

View File

@@ -56,12 +56,20 @@ class DetailsPage extends StatelessWidget {
Text( Text(
state.data!.title, state.data!.title,
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: style: Theme.of(
Theme.of(context).textTheme.titleLarge, context,
).textTheme.titleLarge,
maxLines: 2, maxLines: 2,
softWrap: true, softWrap: true,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
Padding(
padding: const EdgeInsets.only(
top: 6,
),
child: Row(
spacing: 8,
children: [
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
final result = await showDialog<bool>( final result = await showDialog<bool>(
@@ -81,11 +89,14 @@ class DetailsPage extends StatelessWidget {
actions: [ actions: [
TextButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.of(
.pop(true); context,
).pop(true);
}, },
style: TextButton.styleFrom( style:
foregroundColor: Colors.red, TextButton.styleFrom(
foregroundColor:
Colors.red,
), ),
child: Text( child: Text(
t.details.removeButton, t.details.removeButton,
@@ -93,8 +104,9 @@ class DetailsPage extends StatelessWidget {
), ),
TextButton( TextButton(
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.of(
.pop(false); context,
).pop(false);
}, },
child: Text( child: Text(
t.details.cancelButton, t.details.cancelButton,
@@ -115,7 +127,85 @@ class DetailsPage extends StatelessWidget {
), ),
); );
}, },
child: const Icon(Icons.delete), child: const Icon(
Icons.delete,
color: Colors.redAccent,
),
),
ElevatedButton(
onPressed: () async {
await showModalBottomSheet<void>(
context: context,
builder: (ctx) => DraggableScrollableSheet(
initialChildSize: 1,
builder: (ctx, scrollController) {
return Padding(
padding:
const EdgeInsetsGeometry.only(
top: 18,
),
child: ListView(
controller:
scrollController,
children: [
Padding(
padding:
const EdgeInsetsGeometry.directional(
start: 8,
end: 8,
),
child: Text(
t.details.details.titleJa,
style:
Theme.of(
context,
)
.textTheme
.headlineSmall,
),
),
Padding(
padding:
const EdgeInsetsGeometry.directional(
start: 8,
end: 8,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.copy),
),
Expanded(
child: Padding(
padding: const EdgeInsetsGeometry.only(left: 8),
child: Text(
state
.data!
.title,
style: Theme.of(
context,
).textTheme.bodyLarge,
),
),
),
],
),
),
],
),
);
},
),
);
},
child: const Icon(
Icons.info,
),
),
],
),
), ),
], ],
), ),
@@ -136,8 +226,7 @@ class DetailsPage extends StatelessWidget {
TrackingMediumType.anime) { TrackingMediumType.anime) {
context.read<DetailsBloc>().add( context.read<DetailsBloc>().add(
DetailsUpdatedEvent( DetailsUpdatedEvent(
(state.data! as AnimeTrackingData) (state.data! as AnimeTrackingData).copyWith(
.copyWith(
state: newState, state: newState,
), ),
), ),
@@ -146,8 +235,7 @@ class DetailsPage extends StatelessWidget {
TrackingMediumType.manga) { TrackingMediumType.manga) {
context.read<DetailsBloc>().add( context.read<DetailsBloc>().add(
DetailsUpdatedEvent( DetailsUpdatedEvent(
(state.data! as MangaTrackingData) (state.data! as MangaTrackingData).copyWith(
.copyWith(
state: newState, state: newState,
), ),
), ),
@@ -157,28 +245,33 @@ class DetailsPage extends StatelessWidget {
values: [ values: [
SelectorItem( SelectorItem(
MediumTrackingState.ongoing, MediumTrackingState.ongoing,
MediumTrackingState.ongoing MediumTrackingState.ongoing.getName(
.getName(state.trackingType), state.trackingType,
),
), ),
SelectorItem( SelectorItem(
MediumTrackingState.completed, MediumTrackingState.completed,
MediumTrackingState.completed MediumTrackingState.completed.getName(
.getName(state.trackingType), state.trackingType,
),
), ),
SelectorItem( SelectorItem(
MediumTrackingState.planned, MediumTrackingState.planned,
MediumTrackingState.planned MediumTrackingState.planned.getName(
.getName(state.trackingType), state.trackingType,
),
), ),
SelectorItem( SelectorItem(
MediumTrackingState.dropped, MediumTrackingState.dropped,
MediumTrackingState.dropped MediumTrackingState.dropped.getName(
.getName(state.trackingType), state.trackingType,
),
), ),
SelectorItem( SelectorItem(
MediumTrackingState.paused, MediumTrackingState.paused,
MediumTrackingState.paused MediumTrackingState.paused.getName(
.getName(state.trackingType), state.trackingType,
),
), ),
], ],
initialValue: state.data!.state, initialValue: state.data!.state,
@@ -217,8 +310,8 @@ class DetailsPage extends StatelessWidget {
break; break;
} }
}, },
initialValue: state.trackingType == initialValue:
TrackingMediumType.anime state.trackingType == TrackingMediumType.anime
? (state.data! as AnimeTrackingData) ? (state.data! as AnimeTrackingData)
.episodesWatched .episodesWatched
: (state.data! as MangaTrackingData).chaptersRead, : (state.data! as MangaTrackingData).chaptersRead,
@@ -241,10 +334,9 @@ class DetailsPage extends StatelessWidget {
), ),
); );
}, },
initialValue: (GetIt.I initialValue:
.get<DetailsBloc>() (GetIt.I.get<DetailsBloc>().state.data!
.state as MangaTrackingData)
.data! as MangaTrackingData)
.volumesOwned, .volumesOwned,
), ),
), ),