From c422d5c27cf26d60d8217189f0e92df4a1daf40b Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Sun, 10 May 2026 22:14:37 +0200 Subject: [PATCH] feat: Add a small details bottom sheet --- assets/i18n/strings_en.i18n.json | 5 +- devtools_options.yaml | 3 + lib/main.dart | 2 +- lib/src/data/anime.freezed.dart | 699 ++++++------------ lib/src/data/anime.g.dart | 5 +- lib/src/data/manga.freezed.dart | 646 ++++++---------- lib/src/data/manga.g.dart | 5 +- lib/src/service/database.dart | 15 +- lib/src/ui/bloc/anime_list_bloc.freezed.dart | 613 ++++++--------- .../ui/bloc/anime_search_bloc.freezed.dart | 530 ++++++------- lib/src/ui/bloc/calendar_bloc.freezed.dart | 482 ++++++------ lib/src/ui/bloc/details_bloc.freezed.dart | 492 ++++++------ lib/src/ui/bloc/settings_bloc.freezed.dart | 490 ++++++------ lib/src/ui/pages/details.dart | 314 +++++--- 14 files changed, 1752 insertions(+), 2549 deletions(-) create mode 100644 devtools_options.yaml diff --git a/assets/i18n/strings_en.i18n.json b/assets/i18n/strings_en.i18n.json index d8872b7..7a738f6 100644 --- a/assets/i18n/strings_en.i18n.json +++ b/assets/i18n/strings_en.i18n.json @@ -48,7 +48,10 @@ "readState": "Read state", "episodes": "Episodes", "chapters": "Chapters", - "volumesOwned": "Volumes owned" + "volumesOwned": "Volumes owned", + "details": { + "titleJa": "Japanese Title" + } }, "calendar": { "calendar": "Calendar", diff --git a/devtools_options.yaml b/devtools_options.yaml new file mode 100644 index 0000000..fa0b357 --- /dev/null +++ b/devtools_options.yaml @@ -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: diff --git a/lib/main.dart b/lib/main.dart index ee23ab3..2e71ea3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -42,7 +42,7 @@ void main() async { ); WidgetsFlutterBinding.ensureInitialized(); - LocaleSettings.useDeviceLocale(); + await LocaleSettings.useDeviceLocale(); runApp( MultiBlocProvider( diff --git a/lib/src/data/anime.freezed.dart b/lib/src/data/anime.freezed.dart index b5430a0..4341bdf 100644 --- a/lib/src/data/anime.freezed.dart +++ b/lib/src/data/anime.freezed.dart @@ -14,90 +14,55 @@ T _$identity(T value) => value; /// @nodoc mixin _$AnimeTrackingData { - /// The ID of the anime - String get id; - /// The state of the anime - @MediumTrackingStateConverter() - MediumTrackingState get state; - - /// The title of the anime - 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; - - /// Create a copy of AnimeTrackingData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $AnimeTrackingDataCopyWith get copyWith => - _$AnimeTrackingDataCopyWithImpl( - this as AnimeTrackingData, _$identity); +/// The ID of the anime + String get id;/// The state of the anime +@MediumTrackingStateConverter() MediumTrackingState get state;/// The title of the anime + 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; +/// Create a copy of AnimeTrackingData +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AnimeTrackingDataCopyWith get copyWith => _$AnimeTrackingDataCopyWithImpl(this as AnimeTrackingData, _$identity); /// Serializes this AnimeTrackingData to a JSON map. Map toJson(); - @override - bool operator ==(Object 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)); - } - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, id, state, title, - episodesWatched, episodesTotal, thumbnailUrl, airing, broadcastDay); +@override +bool operator ==(Object 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)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,state,title,episodesWatched,episodesTotal,thumbnailUrl,airing,broadcastDay); + +@override +String toString() { + return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)'; +} + - @override - String toString() { - return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)'; - } } /// @nodoc -abstract mixin class $AnimeTrackingDataCopyWith<$Res> { - factory $AnimeTrackingDataCopyWith( - AnimeTrackingData value, $Res Function(AnimeTrackingData) _then) = - _$AnimeTrackingDataCopyWithImpl; - @useResult - $Res call( - {String id, - @MediumTrackingStateConverter() MediumTrackingState state, - String title, - int episodesWatched, - int? episodesTotal, - String thumbnailUrl, - @BoolConverter() bool airing, - String? broadcastDay}); -} +abstract mixin class $AnimeTrackingDataCopyWith<$Res> { + factory $AnimeTrackingDataCopyWith(AnimeTrackingData value, $Res Function(AnimeTrackingData) _then) = _$AnimeTrackingDataCopyWithImpl; +@useResult +$Res call({ + String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl,@BoolConverter() bool airing, String? broadcastDay +}); + + + +} /// @nodoc class _$AnimeTrackingDataCopyWithImpl<$Res> implements $AnimeTrackingDataCopyWith<$Res> { @@ -106,379 +71,219 @@ class _$AnimeTrackingDataCopyWithImpl<$Res> final AnimeTrackingData _self; final $Res Function(AnimeTrackingData) _then; - /// Create a copy of AnimeTrackingData - /// with the given fields replaced by the non-null parameter values. - @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, - }) { - return _then(_self.copyWith( - id: null == id - ? _self.id - : id // ignore: cast_nullable_to_non_nullable - as String, - state: null == state - ? _self.state - : state // ignore: cast_nullable_to_non_nullable - as MediumTrackingState, - 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?, - )); - } +/// Create a copy of AnimeTrackingData +/// with the given fields replaced by the non-null parameter values. +@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,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as MediumTrackingState,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?, + )); } +} + + /// Adds pattern-matching-related methods to [AnimeTrackingData]. extension AnimeTrackingDataPatterns on AnimeTrackingData { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeMap( - TResult Function(_AnimeTrackingData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _AnimeTrackingData() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeMap(TResult Function( _AnimeTrackingData value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _AnimeTrackingData() when $default != null: +return $default(_that);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult map( - TResult Function(_AnimeTrackingData value) $default, - ) { - final _that = this; - switch (_that) { - case _AnimeTrackingData(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult map(TResult Function( _AnimeTrackingData value) $default,){ +final _that = this; +switch (_that) { +case _AnimeTrackingData(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_AnimeTrackingData value)? $default, - ) { - final _that = this; - switch (_that) { - case _AnimeTrackingData() when $default != null: - return $default(_that); - case _: - return null; - } - } +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _AnimeTrackingData value)? $default,){ +final _that = this; +switch (_that) { +case _AnimeTrackingData() when $default != null: +return $default(_that);case _: + return null; - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeWhen( - TResult 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) { - case _AnimeTrackingData() when $default != null: - return $default( - _that.id, - _that.state, - _that.title, - _that.episodesWatched, - _that.episodesTotal, - _that.thumbnailUrl, - _that.airing, - _that.broadcastDay); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeWhen(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) { +case _AnimeTrackingData() when $default != null: +return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult when( - TResult 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) { - case _AnimeTrackingData(): - return $default( - _that.id, - _that.state, - _that.title, - _that.episodesWatched, - _that.episodesTotal, - _that.thumbnailUrl, - _that.airing, - _that.broadcastDay); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult when(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) { +case _AnimeTrackingData(): +return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay);case _: + throw StateError('Unexpected subclass'); - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? 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) { +case _AnimeTrackingData() when $default != null: +return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay);case _: + return null; + +} +} - @optionalTypeArgs - TResult? whenOrNull( - 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) { - case _AnimeTrackingData() when $default != null: - return $default( - _that.id, - _that.state, - _that.title, - _that.episodesWatched, - _that.episodesTotal, - _that.thumbnailUrl, - _that.airing, - _that.broadcastDay); - case _: - return null; - } - } } /// @nodoc @JsonSerializable() + class _AnimeTrackingData extends AnimeTrackingData { - _AnimeTrackingData( - this.id, - @MediumTrackingStateConverter() this.state, - this.title, - this.episodesWatched, - this.episodesTotal, - this.thumbnailUrl, - @BoolConverter() this.airing, - this.broadcastDay) - : super._(); - factory _AnimeTrackingData.fromJson(Map json) => - _$AnimeTrackingDataFromJson(json); + _AnimeTrackingData(this.id, @MediumTrackingStateConverter() this.state, this.title, this.episodesWatched, this.episodesTotal, this.thumbnailUrl, @BoolConverter() this.airing, this.broadcastDay): super._(); + factory _AnimeTrackingData.fromJson(Map json) => _$AnimeTrackingDataFromJson(json); - /// The ID of the anime - @override - final String id; +/// The ID of the anime +@override final String id; +/// The state of the anime +@override@MediumTrackingStateConverter() final MediumTrackingState state; +/// The title of the anime +@override final String title; +/// Episodes in total. +@override final int episodesWatched; +/// Episodes watched. +@override final int? episodesTotal; +/// URL to the thumbnail/cover art for the anime. +@override final String thumbnailUrl; +/// Flag whether the anime is airing +@override@BoolConverter() final bool airing; +/// The day of the week the anime is airing +@override final String? broadcastDay; - /// The state of the anime - @override - @MediumTrackingStateConverter() - final MediumTrackingState state; +/// Create a copy of AnimeTrackingData +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$AnimeTrackingDataCopyWith<_AnimeTrackingData> get copyWith => __$AnimeTrackingDataCopyWithImpl<_AnimeTrackingData>(this, _$identity); - /// The title of the anime - @override - final String title; +@override +Map toJson() { + return _$AnimeTrackingDataToJson(this, ); +} - /// Episodes in total. - @override - final int episodesWatched; +@override +bool operator ==(Object 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)); +} - /// Episodes watched. - @override - final int? episodesTotal; +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,state,title,episodesWatched,episodesTotal,thumbnailUrl,airing,broadcastDay); - /// URL to the thumbnail/cover art for the anime. - @override - final String thumbnailUrl; +@override +String toString() { + return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)'; +} - /// Flag whether the anime is airing - @override - @BoolConverter() - final bool airing; - /// The day of the week the anime is airing - @override - final String? broadcastDay; - - /// Create a copy of AnimeTrackingData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$AnimeTrackingDataCopyWith<_AnimeTrackingData> get copyWith => - __$AnimeTrackingDataCopyWithImpl<_AnimeTrackingData>(this, _$identity); - - @override - Map toJson() { - return _$AnimeTrackingDataToJson( - this, - ); - } - - @override - bool operator ==(Object 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)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, id, state, title, - episodesWatched, episodesTotal, thumbnailUrl, airing, broadcastDay); - - @override - String toString() { - return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay)'; - } } /// @nodoc -abstract mixin class _$AnimeTrackingDataCopyWith<$Res> - implements $AnimeTrackingDataCopyWith<$Res> { - factory _$AnimeTrackingDataCopyWith( - _AnimeTrackingData value, $Res Function(_AnimeTrackingData) _then) = - __$AnimeTrackingDataCopyWithImpl; - @override - @useResult - $Res call( - {String id, - @MediumTrackingStateConverter() MediumTrackingState state, - String title, - int episodesWatched, - int? episodesTotal, - String thumbnailUrl, - @BoolConverter() bool airing, - String? broadcastDay}); -} +abstract mixin class _$AnimeTrackingDataCopyWith<$Res> implements $AnimeTrackingDataCopyWith<$Res> { + factory _$AnimeTrackingDataCopyWith(_AnimeTrackingData value, $Res Function(_AnimeTrackingData) _then) = __$AnimeTrackingDataCopyWithImpl; +@override @useResult +$Res call({ + String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl,@BoolConverter() bool airing, String? broadcastDay +}); + + + +} /// @nodoc class __$AnimeTrackingDataCopyWithImpl<$Res> implements _$AnimeTrackingDataCopyWith<$Res> { @@ -487,55 +292,23 @@ class __$AnimeTrackingDataCopyWithImpl<$Res> final _AnimeTrackingData _self; final $Res Function(_AnimeTrackingData) _then; - /// Create a copy of AnimeTrackingData - /// with the given fields replaced by the non-null parameter values. - @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, - }) { - return _then(_AnimeTrackingData( - null == id - ? _self.id - : id // ignore: cast_nullable_to_non_nullable - as String, - null == state - ? _self.state - : state // ignore: cast_nullable_to_non_nullable - as MediumTrackingState, - 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?, - )); - } +/// Create a copy of AnimeTrackingData +/// with the given fields replaced by the non-null parameter values. +@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,}) { + return _then(_AnimeTrackingData( +null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable +as MediumTrackingState,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?, + )); +} + + } // dart format on diff --git a/lib/src/data/anime.g.dart b/lib/src/data/anime.g.dart index b19a1a8..fe16e86 100644 --- a/lib/src/data/anime.g.dart +++ b/lib/src/data/anime.g.dart @@ -9,8 +9,9 @@ part of 'anime.dart'; _AnimeTrackingData _$AnimeTrackingDataFromJson(Map json) => _AnimeTrackingData( json['id'] as String, - const MediumTrackingStateConverter() - .fromJson((json['state'] as num).toInt()), + const MediumTrackingStateConverter().fromJson( + (json['state'] as num).toInt(), + ), json['title'] as String, (json['episodesWatched'] as num).toInt(), (json['episodesTotal'] as num?)?.toInt(), diff --git a/lib/src/data/manga.freezed.dart b/lib/src/data/manga.freezed.dart index 691e586..5ed048d 100644 --- a/lib/src/data/manga.freezed.dart +++ b/lib/src/data/manga.freezed.dart @@ -14,84 +14,54 @@ T _$identity(T value) => value; /// @nodoc mixin _$MangaTrackingData { - /// The ID of the manga - String get id; - /// The state of the manga - @MediumTrackingStateConverter() - MediumTrackingState get state; - - /// 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; - - /// Create a copy of MangaTrackingData - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $MangaTrackingDataCopyWith get copyWith => - _$MangaTrackingDataCopyWithImpl( - this as MangaTrackingData, _$identity); +/// The ID of the manga + String get id;/// The state of the manga +@MediumTrackingStateConverter() MediumTrackingState get state;/// 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; +/// Create a copy of MangaTrackingData +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MangaTrackingDataCopyWith get copyWith => _$MangaTrackingDataCopyWithImpl(this as MangaTrackingData, _$identity); /// Serializes this MangaTrackingData to a JSON map. Map toJson(); - @override - bool operator ==(Object 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)); - } - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, id, state, title, chaptersRead, - volumesOwned, chaptersTotal, thumbnailUrl); +@override +bool operator ==(Object 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)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,state,title,chaptersRead,volumesOwned,chaptersTotal,thumbnailUrl); + +@override +String toString() { + return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)'; +} + - @override - String toString() { - return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)'; - } } /// @nodoc -abstract mixin class $MangaTrackingDataCopyWith<$Res> { - factory $MangaTrackingDataCopyWith( - MangaTrackingData value, $Res Function(MangaTrackingData) _then) = - _$MangaTrackingDataCopyWithImpl; - @useResult - $Res call( - {String id, - @MediumTrackingStateConverter() MediumTrackingState state, - String title, - int chaptersRead, - int volumesOwned, - int? chaptersTotal, - String thumbnailUrl}); -} +abstract mixin class $MangaTrackingDataCopyWith<$Res> { + factory $MangaTrackingDataCopyWith(MangaTrackingData value, $Res Function(MangaTrackingData) _then) = _$MangaTrackingDataCopyWithImpl; +@useResult +$Res call({ + String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl +}); + + + +} /// @nodoc class _$MangaTrackingDataCopyWithImpl<$Res> implements $MangaTrackingDataCopyWith<$Res> { @@ -100,342 +70,216 @@ class _$MangaTrackingDataCopyWithImpl<$Res> final MangaTrackingData _self; final $Res Function(MangaTrackingData) _then; - /// Create a copy of MangaTrackingData - /// with the given fields replaced by the non-null parameter values. - @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, - }) { - return _then(_self.copyWith( - id: null == id - ? _self.id - : id // ignore: cast_nullable_to_non_nullable - as String, - state: null == state - ? _self.state - : state // 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, - )); - } +/// Create a copy of MangaTrackingData +/// with the given fields replaced by the non-null parameter values. +@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,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,state: null == state ? _self.state : state // 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, + )); } +} + + /// Adds pattern-matching-related methods to [MangaTrackingData]. extension MangaTrackingDataPatterns on MangaTrackingData { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeMap( - TResult Function(_MangaTrackingData value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _MangaTrackingData() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeMap(TResult Function( _MangaTrackingData value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _MangaTrackingData() when $default != null: +return $default(_that);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult map( - TResult Function(_MangaTrackingData value) $default, - ) { - final _that = this; - switch (_that) { - case _MangaTrackingData(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult map(TResult Function( _MangaTrackingData value) $default,){ +final _that = this; +switch (_that) { +case _MangaTrackingData(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_MangaTrackingData value)? $default, - ) { - final _that = this; - switch (_that) { - case _MangaTrackingData() when $default != null: - return $default(_that); - case _: - return null; - } - } +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _MangaTrackingData value)? $default,){ +final _that = this; +switch (_that) { +case _MangaTrackingData() when $default != null: +return $default(_that);case _: + return null; - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeWhen( - TResult 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) { - case _MangaTrackingData() when $default != null: - return $default(_that.id, _that.state, _that.title, _that.chaptersRead, - _that.volumesOwned, _that.chaptersTotal, _that.thumbnailUrl); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeWhen(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) { +case _MangaTrackingData() when $default != null: +return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult when( - TResult Function( - String id, - @MediumTrackingStateConverter() MediumTrackingState state, - String title, - int chaptersRead, - int volumesOwned, - int? chaptersTotal, - String thumbnailUrl) - $default, - ) { - final _that = this; - switch (_that) { - case _MangaTrackingData(): - return $default(_that.id, _that.state, _that.title, _that.chaptersRead, - _that.volumesOwned, _that.chaptersTotal, _that.thumbnailUrl); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult when(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl) $default,) {final _that = this; +switch (_that) { +case _MangaTrackingData(): +return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl);case _: + throw StateError('Unexpected subclass'); - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl)? $default,) {final _that = this; +switch (_that) { +case _MangaTrackingData() when $default != null: +return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl);case _: + return null; + +} +} - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - String id, - @MediumTrackingStateConverter() MediumTrackingState state, - String title, - int chaptersRead, - int volumesOwned, - int? chaptersTotal, - String thumbnailUrl)? - $default, - ) { - final _that = this; - switch (_that) { - case _MangaTrackingData() when $default != null: - return $default(_that.id, _that.state, _that.title, _that.chaptersRead, - _that.volumesOwned, _that.chaptersTotal, _that.thumbnailUrl); - case _: - return null; - } - } } /// @nodoc @JsonSerializable() + class _MangaTrackingData extends MangaTrackingData { - _MangaTrackingData( - this.id, - @MediumTrackingStateConverter() this.state, - this.title, - this.chaptersRead, - this.volumesOwned, - this.chaptersTotal, - this.thumbnailUrl) - : super._(); - factory _MangaTrackingData.fromJson(Map json) => - _$MangaTrackingDataFromJson(json); + _MangaTrackingData(this.id, @MediumTrackingStateConverter() this.state, this.title, this.chaptersRead, this.volumesOwned, this.chaptersTotal, this.thumbnailUrl): super._(); + factory _MangaTrackingData.fromJson(Map json) => _$MangaTrackingDataFromJson(json); - /// The ID of the manga - @override - final String id; +/// The ID of the manga +@override final String id; +/// The state of the manga +@override@MediumTrackingStateConverter() final MediumTrackingState state; +/// The title of the manga +@override final String title; +/// Chapters read. +@override final int chaptersRead; +/// Chapters read. +@override final int volumesOwned; +/// Episodes watched. +@override final int? chaptersTotal; +/// URL to the thumbnail/cover art for the manga. +@override final String thumbnailUrl; - /// The state of the manga - @override - @MediumTrackingStateConverter() - final MediumTrackingState state; +/// Create a copy of MangaTrackingData +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$MangaTrackingDataCopyWith<_MangaTrackingData> get copyWith => __$MangaTrackingDataCopyWithImpl<_MangaTrackingData>(this, _$identity); - /// The title of the manga - @override - final String title; +@override +Map toJson() { + return _$MangaTrackingDataToJson(this, ); +} - /// Chapters read. - @override - final int chaptersRead; +@override +bool operator ==(Object 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)); +} - /// Chapters read. - @override - final int volumesOwned; +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,id,state,title,chaptersRead,volumesOwned,chaptersTotal,thumbnailUrl); - /// Episodes watched. - @override - final int? chaptersTotal; +@override +String toString() { + return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)'; +} - /// URL to the thumbnail/cover art for the manga. - @override - final String thumbnailUrl; - /// Create a copy of MangaTrackingData - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$MangaTrackingDataCopyWith<_MangaTrackingData> get copyWith => - __$MangaTrackingDataCopyWithImpl<_MangaTrackingData>(this, _$identity); - - @override - Map toJson() { - return _$MangaTrackingDataToJson( - this, - ); - } - - @override - bool operator ==(Object 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)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, id, state, title, chaptersRead, - volumesOwned, chaptersTotal, thumbnailUrl); - - @override - String toString() { - return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl)'; - } } /// @nodoc -abstract mixin class _$MangaTrackingDataCopyWith<$Res> - implements $MangaTrackingDataCopyWith<$Res> { - factory _$MangaTrackingDataCopyWith( - _MangaTrackingData value, $Res Function(_MangaTrackingData) _then) = - __$MangaTrackingDataCopyWithImpl; - @override - @useResult - $Res call( - {String id, - @MediumTrackingStateConverter() MediumTrackingState state, - String title, - int chaptersRead, - int volumesOwned, - int? chaptersTotal, - String thumbnailUrl}); -} +abstract mixin class _$MangaTrackingDataCopyWith<$Res> implements $MangaTrackingDataCopyWith<$Res> { + factory _$MangaTrackingDataCopyWith(_MangaTrackingData value, $Res Function(_MangaTrackingData) _then) = __$MangaTrackingDataCopyWithImpl; +@override @useResult +$Res call({ + String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl +}); + + + +} /// @nodoc class __$MangaTrackingDataCopyWithImpl<$Res> implements _$MangaTrackingDataCopyWith<$Res> { @@ -444,50 +288,22 @@ class __$MangaTrackingDataCopyWithImpl<$Res> final _MangaTrackingData _self; final $Res Function(_MangaTrackingData) _then; - /// Create a copy of MangaTrackingData - /// with the given fields replaced by the non-null parameter values. - @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, - }) { - return _then(_MangaTrackingData( - null == id - ? _self.id - : id // ignore: cast_nullable_to_non_nullable - as String, - null == state - ? _self.state - : state // 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, - )); - } +/// Create a copy of MangaTrackingData +/// with the given fields replaced by the non-null parameter values. +@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,}) { + return _then(_MangaTrackingData( +null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,null == state ? _self.state : state // 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, + )); +} + + } // dart format on diff --git a/lib/src/data/manga.g.dart b/lib/src/data/manga.g.dart index 34021d3..916a7fe 100644 --- a/lib/src/data/manga.g.dart +++ b/lib/src/data/manga.g.dart @@ -9,8 +9,9 @@ part of 'manga.dart'; _MangaTrackingData _$MangaTrackingDataFromJson(Map json) => _MangaTrackingData( json['id'] as String, - const MediumTrackingStateConverter() - .fromJson((json['state'] as num).toInt()), + const MediumTrackingStateConverter().fromJson( + (json['state'] as num).toInt(), + ), json['title'] as String, (json['chaptersRead'] as num).toInt(), (json['volumesOwned'] as num).toInt(), diff --git a/lib/src/service/database.dart b/lib/src/service/database.dart index 45350a3..064349b 100644 --- a/lib/src/service/database.dart +++ b/lib/src/service/database.dart @@ -4,7 +4,6 @@ import 'package:anitrack/src/data/anime.dart'; import 'package:anitrack/src/data/manga.dart'; import 'package:anitrack/src/service/migrations/0000_airing.dart'; import 'package:anitrack/src/service/migrations/0000_score.dart'; -import 'package:sqflite/sqflite.dart'; import 'package:sqflite_common_ffi/sqflite_ffi.dart'; const animeTable = 'Anime'; @@ -32,6 +31,7 @@ Future _createDatabase(Database db, int version) async { episodesWatched INTEGER NOT NULL, thumbnailUrl TEXT NOT NULL, title TEXT NOT NULL, + otherTitles TEXT NOT NULL, score INTEGER, airing INTEGER NOT NULL, broadcastDay TEXT @@ -40,14 +40,15 @@ Future _createDatabase(Database db, int version) async { await db.execute( ''' CREATE TABLE $mangaTable( - id TEXT NOT NULL PRIMARY KEY, + id TEXT NOT NULL PRIMARY KEY, state INTEGER NOT NULL, chaptersTotal INTEGER, - chaptersRead INTEGER NOT NULL, - volumesOwned INTEGER NOT NULL, - thumbnailUrl TEXT NOT NULL, - title TEXT NOT NULL, - score INTEGER + chaptersRead INTEGER NOT NULL, + volumesOwned INTEGER NOT NULL, + thumbnailUrl TEXT NOT NULL, + title TEXT NOT NULL, + otherTitles TEXT NOT NULL, + score INTEGER )''', ); } diff --git a/lib/src/ui/bloc/anime_list_bloc.freezed.dart b/lib/src/ui/bloc/anime_list_bloc.freezed.dart index f5e35b7..64e58de 100644 --- a/lib/src/ui/bloc/anime_list_bloc.freezed.dart +++ b/lib/src/ui/bloc/anime_list_bloc.freezed.dart @@ -11,72 +11,47 @@ part of 'anime_list_bloc.dart'; // dart format off T _$identity(T value) => value; - /// @nodoc mixin _$AnimeListState { - bool get buttonVisibility; - List get animes; - List get mangas; - MediumTrackingState get animeFilterState; - MediumTrackingState get mangaFilterState; - TrackingMediumType get trackingType; - /// Create a copy of AnimeListState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $AnimeListStateCopyWith get copyWith => - _$AnimeListStateCopyWithImpl( - this as AnimeListState, _$identity); + bool get buttonVisibility; List get animes; List get mangas; MediumTrackingState get animeFilterState; MediumTrackingState get mangaFilterState; TrackingMediumType get trackingType; +/// Create a copy of AnimeListState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AnimeListStateCopyWith get copyWith => _$AnimeListStateCopyWithImpl(this as AnimeListState, _$identity); - @override - bool operator ==(Object 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)); - } - @override - int get hashCode => Object.hash( - runtimeType, - buttonVisibility, - const DeepCollectionEquality().hash(animes), - const DeepCollectionEquality().hash(mangas), - animeFilterState, - mangaFilterState, - trackingType); - @override - String toString() { - return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)'; - } +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,buttonVisibility,const DeepCollectionEquality().hash(animes),const DeepCollectionEquality().hash(mangas),animeFilterState,mangaFilterState,trackingType); + +@override +String toString() { + return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)'; +} + + } /// @nodoc -abstract mixin class $AnimeListStateCopyWith<$Res> { - factory $AnimeListStateCopyWith( - AnimeListState value, $Res Function(AnimeListState) _then) = - _$AnimeListStateCopyWithImpl; - @useResult - $Res call( - {bool buttonVisibility, - List animes, - List mangas, - MediumTrackingState animeFilterState, - MediumTrackingState mangaFilterState, - TrackingMediumType trackingType}); -} +abstract mixin class $AnimeListStateCopyWith<$Res> { + factory $AnimeListStateCopyWith(AnimeListState value, $Res Function(AnimeListState) _then) = _$AnimeListStateCopyWithImpl; +@useResult +$Res call({ + bool buttonVisibility, List animes, List mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType +}); + + + +} /// @nodoc class _$AnimeListStateCopyWithImpl<$Res> implements $AnimeListStateCopyWith<$Res> { @@ -85,330 +60,216 @@ class _$AnimeListStateCopyWithImpl<$Res> final AnimeListState _self; final $Res Function(AnimeListState) _then; - /// Create a copy of AnimeListState - /// with the given fields replaced by the non-null parameter values. - @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, - }) { - return _then(_self.copyWith( - buttonVisibility: null == buttonVisibility - ? _self.buttonVisibility - : buttonVisibility // ignore: cast_nullable_to_non_nullable - as bool, - animes: null == animes - ? _self.animes - : animes // ignore: cast_nullable_to_non_nullable - as List, - mangas: null == mangas - ? _self.mangas - : mangas // ignore: cast_nullable_to_non_nullable - as List, - 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, - )); - } +/// Create a copy of AnimeListState +/// with the given fields replaced by the non-null parameter values. +@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,}) { + return _then(_self.copyWith( +buttonVisibility: null == buttonVisibility ? _self.buttonVisibility : buttonVisibility // ignore: cast_nullable_to_non_nullable +as bool,animes: null == animes ? _self.animes : animes // ignore: cast_nullable_to_non_nullable +as List,mangas: null == mangas ? _self.mangas : mangas // ignore: cast_nullable_to_non_nullable +as List,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, + )); } +} + + /// Adds pattern-matching-related methods to [AnimeListState]. extension AnimeListStatePatterns on AnimeListState { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeMap( - TResult Function(_AnimeListState value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _AnimeListState() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeMap(TResult Function( _AnimeListState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _AnimeListState() when $default != null: +return $default(_that);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult map( - TResult Function(_AnimeListState value) $default, - ) { - final _that = this; - switch (_that) { - case _AnimeListState(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult map(TResult Function( _AnimeListState value) $default,){ +final _that = this; +switch (_that) { +case _AnimeListState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_AnimeListState value)? $default, - ) { - final _that = this; - switch (_that) { - case _AnimeListState() when $default != null: - return $default(_that); - case _: - return null; - } - } +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _AnimeListState value)? $default,){ +final _that = this; +switch (_that) { +case _AnimeListState() when $default != null: +return $default(_that);case _: + return null; - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - bool buttonVisibility, - List animes, - List mangas, - MediumTrackingState animeFilterState, - MediumTrackingState mangaFilterState, - TrackingMediumType trackingType)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _AnimeListState() when $default != null: - return $default(_that.buttonVisibility, _that.animes, _that.mangas, - _that.animeFilterState, _that.mangaFilterState, _that.trackingType); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeWhen(TResult Function( bool buttonVisibility, List animes, List mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _AnimeListState() when $default != null: +return $default(_that.buttonVisibility,_that.animes,_that.mangas,_that.animeFilterState,_that.mangaFilterState,_that.trackingType);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult when( - TResult Function( - bool buttonVisibility, - List animes, - List mangas, - MediumTrackingState animeFilterState, - MediumTrackingState mangaFilterState, - TrackingMediumType trackingType) - $default, - ) { - final _that = this; - switch (_that) { - case _AnimeListState(): - return $default(_that.buttonVisibility, _that.animes, _that.mangas, - _that.animeFilterState, _that.mangaFilterState, _that.trackingType); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult when(TResult Function( bool buttonVisibility, List animes, List mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType) $default,) {final _that = this; +switch (_that) { +case _AnimeListState(): +return $default(_that.buttonVisibility,_that.animes,_that.mangas,_that.animeFilterState,_that.mangaFilterState,_that.trackingType);case _: + throw StateError('Unexpected subclass'); - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool buttonVisibility, List animes, List mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType)? $default,) {final _that = this; +switch (_that) { +case _AnimeListState() when $default != null: +return $default(_that.buttonVisibility,_that.animes,_that.mangas,_that.animeFilterState,_that.mangaFilterState,_that.trackingType);case _: + return null; + +} +} - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - bool buttonVisibility, - List animes, - List mangas, - MediumTrackingState animeFilterState, - MediumTrackingState mangaFilterState, - TrackingMediumType trackingType)? - $default, - ) { - final _that = this; - switch (_that) { - case _AnimeListState() when $default != null: - return $default(_that.buttonVisibility, _that.animes, _that.mangas, - _that.animeFilterState, _that.mangaFilterState, _that.trackingType); - case _: - return null; - } - } } /// @nodoc + class _AnimeListState implements AnimeListState { - _AnimeListState( - {this.buttonVisibility = true, - final List animes = const [], - final List mangas = const [], - this.animeFilterState = MediumTrackingState.ongoing, - this.mangaFilterState = MediumTrackingState.ongoing, - this.trackingType = TrackingMediumType.anime}) - : _animes = animes, - _mangas = mangas; + _AnimeListState({this.buttonVisibility = true, final List animes = const [], final List mangas = const [], this.animeFilterState = MediumTrackingState.ongoing, this.mangaFilterState = MediumTrackingState.ongoing, this.trackingType = TrackingMediumType.anime}): _animes = animes,_mangas = mangas; + - @override - @JsonKey() - final bool buttonVisibility; - final List _animes; - @override - @JsonKey() - List get animes { - if (_animes is EqualUnmodifiableListView) return _animes; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_animes); - } +@override@JsonKey() final bool buttonVisibility; + final List _animes; +@override@JsonKey() List get animes { + if (_animes is EqualUnmodifiableListView) return _animes; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_animes); +} - final List _mangas; - @override - @JsonKey() - List get mangas { - if (_mangas is EqualUnmodifiableListView) return _mangas; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_mangas); - } + final List _mangas; +@override@JsonKey() List get mangas { + if (_mangas is EqualUnmodifiableListView) return _mangas; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_mangas); +} - @override - @JsonKey() - final MediumTrackingState animeFilterState; - @override - @JsonKey() - final MediumTrackingState mangaFilterState; - @override - @JsonKey() - final TrackingMediumType trackingType; +@override@JsonKey() final MediumTrackingState animeFilterState; +@override@JsonKey() final MediumTrackingState mangaFilterState; +@override@JsonKey() final TrackingMediumType trackingType; - /// Create a copy of AnimeListState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$AnimeListStateCopyWith<_AnimeListState> get copyWith => - __$AnimeListStateCopyWithImpl<_AnimeListState>(this, _$identity); +/// Create a copy of AnimeListState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$AnimeListStateCopyWith<_AnimeListState> get copyWith => __$AnimeListStateCopyWithImpl<_AnimeListState>(this, _$identity); - @override - bool operator ==(Object 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)); - } - @override - int get hashCode => Object.hash( - runtimeType, - buttonVisibility, - const DeepCollectionEquality().hash(_animes), - const DeepCollectionEquality().hash(_mangas), - animeFilterState, - mangaFilterState, - trackingType); - @override - String toString() { - return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)'; - } +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,buttonVisibility,const DeepCollectionEquality().hash(_animes),const DeepCollectionEquality().hash(_mangas),animeFilterState,mangaFilterState,trackingType); + +@override +String toString() { + return 'AnimeListState(buttonVisibility: $buttonVisibility, animes: $animes, mangas: $mangas, animeFilterState: $animeFilterState, mangaFilterState: $mangaFilterState, trackingType: $trackingType)'; +} + + } /// @nodoc -abstract mixin class _$AnimeListStateCopyWith<$Res> - implements $AnimeListStateCopyWith<$Res> { - factory _$AnimeListStateCopyWith( - _AnimeListState value, $Res Function(_AnimeListState) _then) = - __$AnimeListStateCopyWithImpl; - @override - @useResult - $Res call( - {bool buttonVisibility, - List animes, - List mangas, - MediumTrackingState animeFilterState, - MediumTrackingState mangaFilterState, - TrackingMediumType trackingType}); -} +abstract mixin class _$AnimeListStateCopyWith<$Res> implements $AnimeListStateCopyWith<$Res> { + factory _$AnimeListStateCopyWith(_AnimeListState value, $Res Function(_AnimeListState) _then) = __$AnimeListStateCopyWithImpl; +@override @useResult +$Res call({ + bool buttonVisibility, List animes, List mangas, MediumTrackingState animeFilterState, MediumTrackingState mangaFilterState, TrackingMediumType trackingType +}); + + + +} /// @nodoc class __$AnimeListStateCopyWithImpl<$Res> implements _$AnimeListStateCopyWith<$Res> { @@ -417,45 +278,21 @@ class __$AnimeListStateCopyWithImpl<$Res> final _AnimeListState _self; final $Res Function(_AnimeListState) _then; - /// Create a copy of AnimeListState - /// with the given fields replaced by the non-null parameter values. - @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, - }) { - return _then(_AnimeListState( - buttonVisibility: null == buttonVisibility - ? _self.buttonVisibility - : buttonVisibility // ignore: cast_nullable_to_non_nullable - as bool, - animes: null == animes - ? _self._animes - : animes // ignore: cast_nullable_to_non_nullable - as List, - mangas: null == mangas - ? _self._mangas - : mangas // ignore: cast_nullable_to_non_nullable - as List, - 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, - )); - } +/// Create a copy of AnimeListState +/// with the given fields replaced by the non-null parameter values. +@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,}) { + return _then(_AnimeListState( +buttonVisibility: null == buttonVisibility ? _self.buttonVisibility : buttonVisibility // ignore: cast_nullable_to_non_nullable +as bool,animes: null == animes ? _self._animes : animes // ignore: cast_nullable_to_non_nullable +as List,mangas: null == mangas ? _self._mangas : mangas // ignore: cast_nullable_to_non_nullable +as List,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, + )); +} + + } // dart format on diff --git a/lib/src/ui/bloc/anime_search_bloc.freezed.dart b/lib/src/ui/bloc/anime_search_bloc.freezed.dart index e1d9539..ad48e59 100644 --- a/lib/src/ui/bloc/anime_search_bloc.freezed.dart +++ b/lib/src/ui/bloc/anime_search_bloc.freezed.dart @@ -11,59 +11,47 @@ part of 'anime_search_bloc.dart'; // dart format off T _$identity(T value) => value; - /// @nodoc mixin _$AnimeSearchState { - TrackingMediumType get trackingType; - String get searchQuery; - bool get working; - List get searchResults; - /// Create a copy of AnimeSearchState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $AnimeSearchStateCopyWith get copyWith => - _$AnimeSearchStateCopyWithImpl( - this as AnimeSearchState, _$identity); + TrackingMediumType get trackingType; String get searchQuery; bool get working; List get searchResults; +/// Create a copy of AnimeSearchState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AnimeSearchStateCopyWith get copyWith => _$AnimeSearchStateCopyWithImpl(this as AnimeSearchState, _$identity); - @override - bool operator ==(Object 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)); - } - @override - int get hashCode => Object.hash(runtimeType, trackingType, searchQuery, - working, const DeepCollectionEquality().hash(searchResults)); - @override - String toString() { - return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)'; - } +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,trackingType,searchQuery,working,const DeepCollectionEquality().hash(searchResults)); + +@override +String toString() { + return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)'; +} + + } /// @nodoc -abstract mixin class $AnimeSearchStateCopyWith<$Res> { - factory $AnimeSearchStateCopyWith( - AnimeSearchState value, $Res Function(AnimeSearchState) _then) = - _$AnimeSearchStateCopyWithImpl; - @useResult - $Res call( - {TrackingMediumType trackingType, - String searchQuery, - bool working, - List searchResults}); -} +abstract mixin class $AnimeSearchStateCopyWith<$Res> { + factory $AnimeSearchStateCopyWith(AnimeSearchState value, $Res Function(AnimeSearchState) _then) = _$AnimeSearchStateCopyWithImpl; +@useResult +$Res call({ + TrackingMediumType trackingType, String searchQuery, bool working, List searchResults +}); + + + +} /// @nodoc class _$AnimeSearchStateCopyWithImpl<$Res> implements $AnimeSearchStateCopyWith<$Res> { @@ -72,278 +60,206 @@ class _$AnimeSearchStateCopyWithImpl<$Res> final AnimeSearchState _self; final $Res Function(AnimeSearchState) _then; - /// Create a copy of AnimeSearchState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? trackingType = null, - Object? searchQuery = null, - Object? working = null, - Object? searchResults = null, - }) { - return _then(_self.copyWith( - trackingType: null == trackingType - ? _self.trackingType - : trackingType // ignore: cast_nullable_to_non_nullable - as TrackingMediumType, - 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, - )); - } +/// Create a copy of AnimeSearchState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? trackingType = null,Object? searchQuery = null,Object? working = null,Object? searchResults = null,}) { + return _then(_self.copyWith( +trackingType: null == trackingType ? _self.trackingType : trackingType // ignore: cast_nullable_to_non_nullable +as TrackingMediumType,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, + )); } +} + + /// Adds pattern-matching-related methods to [AnimeSearchState]. extension AnimeSearchStatePatterns on AnimeSearchState { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeMap( - TResult Function(_AnimeSearchState value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _AnimeSearchState() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeMap(TResult Function( _AnimeSearchState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _AnimeSearchState() when $default != null: +return $default(_that);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult map( - TResult Function(_AnimeSearchState value) $default, - ) { - final _that = this; - switch (_that) { - case _AnimeSearchState(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult map(TResult Function( _AnimeSearchState value) $default,){ +final _that = this; +switch (_that) { +case _AnimeSearchState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_AnimeSearchState value)? $default, - ) { - final _that = this; - switch (_that) { - case _AnimeSearchState() when $default != null: - return $default(_that); - case _: - return null; - } - } +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _AnimeSearchState value)? $default,){ +final _that = this; +switch (_that) { +case _AnimeSearchState() when $default != null: +return $default(_that);case _: + return null; - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeWhen( - TResult Function(TrackingMediumType trackingType, String searchQuery, - bool working, List searchResults)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _AnimeSearchState() when $default != null: - return $default(_that.trackingType, _that.searchQuery, _that.working, - _that.searchResults); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeWhen(TResult Function( TrackingMediumType trackingType, String searchQuery, bool working, List searchResults)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _AnimeSearchState() when $default != null: +return $default(_that.trackingType,_that.searchQuery,_that.working,_that.searchResults);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult when( - TResult Function(TrackingMediumType trackingType, String searchQuery, - bool working, List searchResults) - $default, - ) { - final _that = this; - switch (_that) { - case _AnimeSearchState(): - return $default(_that.trackingType, _that.searchQuery, _that.working, - _that.searchResults); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult when(TResult Function( TrackingMediumType trackingType, String searchQuery, bool working, List searchResults) $default,) {final _that = this; +switch (_that) { +case _AnimeSearchState(): +return $default(_that.trackingType,_that.searchQuery,_that.working,_that.searchResults);case _: + throw StateError('Unexpected subclass'); - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( TrackingMediumType trackingType, String searchQuery, bool working, List searchResults)? $default,) {final _that = this; +switch (_that) { +case _AnimeSearchState() when $default != null: +return $default(_that.trackingType,_that.searchQuery,_that.working,_that.searchResults);case _: + return null; + +} +} - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(TrackingMediumType trackingType, String searchQuery, - bool working, List searchResults)? - $default, - ) { - final _that = this; - switch (_that) { - case _AnimeSearchState() when $default != null: - return $default(_that.trackingType, _that.searchQuery, _that.working, - _that.searchResults); - case _: - return null; - } - } } /// @nodoc + class _AnimeSearchState implements AnimeSearchState { - _AnimeSearchState( - {this.trackingType = TrackingMediumType.anime, - this.searchQuery = '', - this.working = false, - final List searchResults = const []}) - : _searchResults = searchResults; + _AnimeSearchState({this.trackingType = TrackingMediumType.anime, this.searchQuery = '', this.working = false, final List searchResults = const []}): _searchResults = searchResults; + - @override - @JsonKey() - final TrackingMediumType trackingType; - @override - @JsonKey() - final String searchQuery; - @override - @JsonKey() - final bool working; - final List _searchResults; - @override - @JsonKey() - List get searchResults { - if (_searchResults is EqualUnmodifiableListView) return _searchResults; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_searchResults); - } +@override@JsonKey() final TrackingMediumType trackingType; +@override@JsonKey() final String searchQuery; +@override@JsonKey() final bool working; + final List _searchResults; +@override@JsonKey() List get searchResults { + if (_searchResults is EqualUnmodifiableListView) return _searchResults; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_searchResults); +} - /// Create a copy of AnimeSearchState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$AnimeSearchStateCopyWith<_AnimeSearchState> get copyWith => - __$AnimeSearchStateCopyWithImpl<_AnimeSearchState>(this, _$identity); - @override - bool operator ==(Object 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)); - } +/// Create a copy of AnimeSearchState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$AnimeSearchStateCopyWith<_AnimeSearchState> get copyWith => __$AnimeSearchStateCopyWithImpl<_AnimeSearchState>(this, _$identity); + + + +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,trackingType,searchQuery,working,const DeepCollectionEquality().hash(_searchResults)); + +@override +String toString() { + return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)'; +} - @override - int get hashCode => Object.hash(runtimeType, trackingType, searchQuery, - working, const DeepCollectionEquality().hash(_searchResults)); - @override - String toString() { - return 'AnimeSearchState(trackingType: $trackingType, searchQuery: $searchQuery, working: $working, searchResults: $searchResults)'; - } } /// @nodoc -abstract mixin class _$AnimeSearchStateCopyWith<$Res> - implements $AnimeSearchStateCopyWith<$Res> { - factory _$AnimeSearchStateCopyWith( - _AnimeSearchState value, $Res Function(_AnimeSearchState) _then) = - __$AnimeSearchStateCopyWithImpl; - @override - @useResult - $Res call( - {TrackingMediumType trackingType, - String searchQuery, - bool working, - List searchResults}); -} +abstract mixin class _$AnimeSearchStateCopyWith<$Res> implements $AnimeSearchStateCopyWith<$Res> { + factory _$AnimeSearchStateCopyWith(_AnimeSearchState value, $Res Function(_AnimeSearchState) _then) = __$AnimeSearchStateCopyWithImpl; +@override @useResult +$Res call({ + TrackingMediumType trackingType, String searchQuery, bool working, List searchResults +}); + + + +} /// @nodoc class __$AnimeSearchStateCopyWithImpl<$Res> implements _$AnimeSearchStateCopyWith<$Res> { @@ -352,35 +268,19 @@ class __$AnimeSearchStateCopyWithImpl<$Res> final _AnimeSearchState _self; final $Res Function(_AnimeSearchState) _then; - /// Create a copy of AnimeSearchState - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? trackingType = null, - Object? searchQuery = null, - Object? working = null, - Object? searchResults = null, - }) { - return _then(_AnimeSearchState( - trackingType: null == trackingType - ? _self.trackingType - : trackingType // ignore: cast_nullable_to_non_nullable - as TrackingMediumType, - 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, - )); - } +/// Create a copy of AnimeSearchState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? trackingType = null,Object? searchQuery = null,Object? working = null,Object? searchResults = null,}) { + return _then(_AnimeSearchState( +trackingType: null == trackingType ? _self.trackingType : trackingType // ignore: cast_nullable_to_non_nullable +as TrackingMediumType,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, + )); +} + + } // dart format on diff --git a/lib/src/ui/bloc/calendar_bloc.freezed.dart b/lib/src/ui/bloc/calendar_bloc.freezed.dart index bb3a9f5..fdaeb42 100644 --- a/lib/src/ui/bloc/calendar_bloc.freezed.dart +++ b/lib/src/ui/bloc/calendar_bloc.freezed.dart @@ -11,53 +11,47 @@ part of 'calendar_bloc.dart'; // dart format off T _$identity(T value) => value; - /// @nodoc mixin _$CalendarState { - bool get refreshing; - int get refreshingCount; - int get refreshingTotal; - /// Create a copy of CalendarState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $CalendarStateCopyWith get copyWith => - _$CalendarStateCopyWithImpl( - this as CalendarState, _$identity); + bool get refreshing; int get refreshingCount; int get refreshingTotal; +/// Create a copy of CalendarState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$CalendarStateCopyWith get copyWith => _$CalendarStateCopyWithImpl(this as CalendarState, _$identity); - @override - bool operator ==(Object 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)); - } - @override - int get hashCode => - Object.hash(runtimeType, refreshing, refreshingCount, refreshingTotal); - @override - String toString() { - return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)'; - } +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,refreshing,refreshingCount,refreshingTotal); + +@override +String toString() { + return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)'; +} + + } /// @nodoc -abstract mixin class $CalendarStateCopyWith<$Res> { - factory $CalendarStateCopyWith( - CalendarState value, $Res Function(CalendarState) _then) = - _$CalendarStateCopyWithImpl; - @useResult - $Res call({bool refreshing, int refreshingCount, int refreshingTotal}); -} +abstract mixin class $CalendarStateCopyWith<$Res> { + factory $CalendarStateCopyWith(CalendarState value, $Res Function(CalendarState) _then) = _$CalendarStateCopyWithImpl; +@useResult +$Res call({ + bool refreshing, int refreshingCount, int refreshingTotal +}); + + + +} /// @nodoc class _$CalendarStateCopyWithImpl<$Res> implements $CalendarStateCopyWith<$Res> { @@ -66,250 +60,198 @@ class _$CalendarStateCopyWithImpl<$Res> final CalendarState _self; final $Res Function(CalendarState) _then; - /// Create a copy of CalendarState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? refreshing = null, - Object? refreshingCount = null, - Object? refreshingTotal = null, - }) { - return _then(_self.copyWith( - refreshing: null == refreshing - ? _self.refreshing - : refreshing // 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, - )); - } +/// Create a copy of CalendarState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? refreshing = null,Object? refreshingCount = null,Object? refreshingTotal = null,}) { + return _then(_self.copyWith( +refreshing: null == refreshing ? _self.refreshing : refreshing // 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, + )); } +} + + /// Adds pattern-matching-related methods to [CalendarState]. extension CalendarStatePatterns on CalendarState { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeMap( - TResult Function(_CalendarState value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _CalendarState() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeMap(TResult Function( _CalendarState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _CalendarState() when $default != null: +return $default(_that);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult map( - TResult Function(_CalendarState value) $default, - ) { - final _that = this; - switch (_that) { - case _CalendarState(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult map(TResult Function( _CalendarState value) $default,){ +final _that = this; +switch (_that) { +case _CalendarState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_CalendarState value)? $default, - ) { - final _that = this; - switch (_that) { - case _CalendarState() when $default != null: - return $default(_that); - case _: - return null; - } - } +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _CalendarState value)? $default,){ +final _that = this; +switch (_that) { +case _CalendarState() when $default != null: +return $default(_that);case _: + return null; - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeWhen( - TResult Function(bool refreshing, int refreshingCount, int refreshingTotal)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _CalendarState() when $default != null: - return $default( - _that.refreshing, _that.refreshingCount, _that.refreshingTotal); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeWhen(TResult Function( bool refreshing, int refreshingCount, int refreshingTotal)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _CalendarState() when $default != null: +return $default(_that.refreshing,_that.refreshingCount,_that.refreshingTotal);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult when( - TResult Function(bool refreshing, int refreshingCount, int refreshingTotal) - $default, - ) { - final _that = this; - switch (_that) { - case _CalendarState(): - return $default( - _that.refreshing, _that.refreshingCount, _that.refreshingTotal); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult when(TResult Function( bool refreshing, int refreshingCount, int refreshingTotal) $default,) {final _that = this; +switch (_that) { +case _CalendarState(): +return $default(_that.refreshing,_that.refreshingCount,_that.refreshingTotal);case _: + throw StateError('Unexpected subclass'); - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool refreshing, int refreshingCount, int refreshingTotal)? $default,) {final _that = this; +switch (_that) { +case _CalendarState() when $default != null: +return $default(_that.refreshing,_that.refreshingCount,_that.refreshingTotal);case _: + return null; + +} +} - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - bool refreshing, int refreshingCount, int refreshingTotal)? - $default, - ) { - final _that = this; - switch (_that) { - case _CalendarState() when $default != null: - return $default( - _that.refreshing, _that.refreshingCount, _that.refreshingTotal); - case _: - return null; - } - } } /// @nodoc + class _CalendarState implements CalendarState { - _CalendarState(this.refreshing, this.refreshingCount, this.refreshingTotal); + _CalendarState(this.refreshing, this.refreshingCount, this.refreshingTotal); + - @override - final bool refreshing; - @override - final int refreshingCount; - @override - final int refreshingTotal; +@override final bool refreshing; +@override final int refreshingCount; +@override final int refreshingTotal; - /// Create a copy of CalendarState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$CalendarStateCopyWith<_CalendarState> get copyWith => - __$CalendarStateCopyWithImpl<_CalendarState>(this, _$identity); +/// Create a copy of CalendarState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$CalendarStateCopyWith<_CalendarState> get copyWith => __$CalendarStateCopyWithImpl<_CalendarState>(this, _$identity); - @override - bool operator ==(Object 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)); - } - @override - int get hashCode => - Object.hash(runtimeType, refreshing, refreshingCount, refreshingTotal); - @override - String toString() { - return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)'; - } +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,refreshing,refreshingCount,refreshingTotal); + +@override +String toString() { + return 'CalendarState(refreshing: $refreshing, refreshingCount: $refreshingCount, refreshingTotal: $refreshingTotal)'; +} + + } /// @nodoc -abstract mixin class _$CalendarStateCopyWith<$Res> - implements $CalendarStateCopyWith<$Res> { - factory _$CalendarStateCopyWith( - _CalendarState value, $Res Function(_CalendarState) _then) = - __$CalendarStateCopyWithImpl; - @override - @useResult - $Res call({bool refreshing, int refreshingCount, int refreshingTotal}); -} +abstract mixin class _$CalendarStateCopyWith<$Res> implements $CalendarStateCopyWith<$Res> { + factory _$CalendarStateCopyWith(_CalendarState value, $Res Function(_CalendarState) _then) = __$CalendarStateCopyWithImpl; +@override @useResult +$Res call({ + bool refreshing, int refreshingCount, int refreshingTotal +}); + + + +} /// @nodoc class __$CalendarStateCopyWithImpl<$Res> implements _$CalendarStateCopyWith<$Res> { @@ -318,30 +260,18 @@ class __$CalendarStateCopyWithImpl<$Res> final _CalendarState _self; final $Res Function(_CalendarState) _then; - /// Create a copy of CalendarState - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? refreshing = null, - Object? refreshingCount = null, - Object? refreshingTotal = null, - }) { - return _then(_CalendarState( - null == refreshing - ? _self.refreshing - : refreshing // 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, - )); - } +/// Create a copy of CalendarState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? refreshing = null,Object? refreshingCount = null,Object? refreshingTotal = null,}) { + return _then(_CalendarState( +null == refreshing ? _self.refreshing : refreshing // 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, + )); +} + + } // dart format on diff --git a/lib/src/ui/bloc/details_bloc.freezed.dart b/lib/src/ui/bloc/details_bloc.freezed.dart index 7a615e2..bea28a6 100644 --- a/lib/src/ui/bloc/details_bloc.freezed.dart +++ b/lib/src/ui/bloc/details_bloc.freezed.dart @@ -11,311 +11,247 @@ part of 'details_bloc.dart'; // dart format off T _$identity(T value) => value; - /// @nodoc mixin _$DetailsState { - TrackingMedium? get data; - String? get heroImagePrefix; - TrackingMediumType get trackingType; - /// Create a copy of DetailsState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $DetailsStateCopyWith get copyWith => - _$DetailsStateCopyWithImpl( - this as DetailsState, _$identity); + TrackingMedium? get data; String? get heroImagePrefix; TrackingMediumType get trackingType; +/// Create a copy of DetailsState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$DetailsStateCopyWith get copyWith => _$DetailsStateCopyWithImpl(this as DetailsState, _$identity); - @override - bool operator ==(Object 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)); - } - @override - int get hashCode => - Object.hash(runtimeType, data, heroImagePrefix, trackingType); - @override - String toString() { - return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)'; - } +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data,heroImagePrefix,trackingType); + +@override +String toString() { + return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)'; +} + + } /// @nodoc -abstract mixin class $DetailsStateCopyWith<$Res> { - factory $DetailsStateCopyWith( - DetailsState value, $Res Function(DetailsState) _then) = - _$DetailsStateCopyWithImpl; - @useResult - $Res call( - {TrackingMedium? data, - String? heroImagePrefix, - TrackingMediumType trackingType}); -} +abstract mixin class $DetailsStateCopyWith<$Res> { + factory $DetailsStateCopyWith(DetailsState value, $Res Function(DetailsState) _then) = _$DetailsStateCopyWithImpl; +@useResult +$Res call({ + TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType +}); + + + +} /// @nodoc -class _$DetailsStateCopyWithImpl<$Res> implements $DetailsStateCopyWith<$Res> { +class _$DetailsStateCopyWithImpl<$Res> + implements $DetailsStateCopyWith<$Res> { _$DetailsStateCopyWithImpl(this._self, this._then); final DetailsState _self; final $Res Function(DetailsState) _then; - /// Create a copy of DetailsState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? data = freezed, - Object? heroImagePrefix = freezed, - Object? trackingType = null, - }) { - return _then(_self.copyWith( - data: freezed == data - ? _self.data - : data // 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, - )); - } +/// Create a copy of DetailsState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? data = freezed,Object? heroImagePrefix = freezed,Object? trackingType = null,}) { + return _then(_self.copyWith( +data: freezed == data ? _self.data : data // 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, + )); } +} + + /// Adds pattern-matching-related methods to [DetailsState]. extension DetailsStatePatterns on DetailsState { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeMap( - TResult Function(_DetailsState value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _DetailsState() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeMap(TResult Function( _DetailsState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _DetailsState() when $default != null: +return $default(_that);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult map( - TResult Function(_DetailsState value) $default, - ) { - final _that = this; - switch (_that) { - case _DetailsState(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult map(TResult Function( _DetailsState value) $default,){ +final _that = this; +switch (_that) { +case _DetailsState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_DetailsState value)? $default, - ) { - final _that = this; - switch (_that) { - case _DetailsState() when $default != null: - return $default(_that); - case _: - return null; - } - } +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _DetailsState value)? $default,){ +final _that = this; +switch (_that) { +case _DetailsState() when $default != null: +return $default(_that);case _: + return null; - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeWhen( - TResult Function(TrackingMedium? data, String? heroImagePrefix, - TrackingMediumType trackingType)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _DetailsState() when $default != null: - return $default(_that.data, _that.heroImagePrefix, _that.trackingType); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeWhen(TResult Function( TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _DetailsState() when $default != null: +return $default(_that.data,_that.heroImagePrefix,_that.trackingType);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult when( - TResult Function(TrackingMedium? data, String? heroImagePrefix, - TrackingMediumType trackingType) - $default, - ) { - final _that = this; - switch (_that) { - case _DetailsState(): - return $default(_that.data, _that.heroImagePrefix, _that.trackingType); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult when(TResult Function( TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType) $default,) {final _that = this; +switch (_that) { +case _DetailsState(): +return $default(_that.data,_that.heroImagePrefix,_that.trackingType);case _: + throw StateError('Unexpected subclass'); - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType)? $default,) {final _that = this; +switch (_that) { +case _DetailsState() when $default != null: +return $default(_that.data,_that.heroImagePrefix,_that.trackingType);case _: + return null; + +} +} - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(TrackingMedium? data, String? heroImagePrefix, - TrackingMediumType trackingType)? - $default, - ) { - final _that = this; - switch (_that) { - case _DetailsState() when $default != null: - return $default(_that.data, _that.heroImagePrefix, _that.trackingType); - case _: - return null; - } - } } /// @nodoc + class _DetailsState implements DetailsState { - _DetailsState( - {this.data, - this.heroImagePrefix, - this.trackingType = TrackingMediumType.anime}); + _DetailsState({this.data, this.heroImagePrefix, this.trackingType = TrackingMediumType.anime}); + - @override - final TrackingMedium? data; - @override - final String? heroImagePrefix; - @override - @JsonKey() - final TrackingMediumType trackingType; +@override final TrackingMedium? data; +@override final String? heroImagePrefix; +@override@JsonKey() final TrackingMediumType trackingType; - /// Create a copy of DetailsState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$DetailsStateCopyWith<_DetailsState> get copyWith => - __$DetailsStateCopyWithImpl<_DetailsState>(this, _$identity); +/// Create a copy of DetailsState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$DetailsStateCopyWith<_DetailsState> get copyWith => __$DetailsStateCopyWithImpl<_DetailsState>(this, _$identity); - @override - bool operator ==(Object 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)); - } - @override - int get hashCode => - Object.hash(runtimeType, data, heroImagePrefix, trackingType); - @override - String toString() { - return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)'; - } +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,data,heroImagePrefix,trackingType); + +@override +String toString() { + return 'DetailsState(data: $data, heroImagePrefix: $heroImagePrefix, trackingType: $trackingType)'; +} + + } /// @nodoc -abstract mixin class _$DetailsStateCopyWith<$Res> - implements $DetailsStateCopyWith<$Res> { - factory _$DetailsStateCopyWith( - _DetailsState value, $Res Function(_DetailsState) _then) = - __$DetailsStateCopyWithImpl; - @override - @useResult - $Res call( - {TrackingMedium? data, - String? heroImagePrefix, - TrackingMediumType trackingType}); -} +abstract mixin class _$DetailsStateCopyWith<$Res> implements $DetailsStateCopyWith<$Res> { + factory _$DetailsStateCopyWith(_DetailsState value, $Res Function(_DetailsState) _then) = __$DetailsStateCopyWithImpl; +@override @useResult +$Res call({ + TrackingMedium? data, String? heroImagePrefix, TrackingMediumType trackingType +}); + + + +} /// @nodoc class __$DetailsStateCopyWithImpl<$Res> implements _$DetailsStateCopyWith<$Res> { @@ -324,30 +260,18 @@ class __$DetailsStateCopyWithImpl<$Res> final _DetailsState _self; final $Res Function(_DetailsState) _then; - /// Create a copy of DetailsState - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? data = freezed, - Object? heroImagePrefix = freezed, - Object? trackingType = null, - }) { - return _then(_DetailsState( - data: freezed == data - ? _self.data - : data // 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, - )); - } +/// Create a copy of DetailsState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? data = freezed,Object? heroImagePrefix = freezed,Object? trackingType = null,}) { + return _then(_DetailsState( +data: freezed == data ? _self.data : data // 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, + )); +} + + } // dart format on diff --git a/lib/src/ui/bloc/settings_bloc.freezed.dart b/lib/src/ui/bloc/settings_bloc.freezed.dart index 6234e5a..d895c59 100644 --- a/lib/src/ui/bloc/settings_bloc.freezed.dart +++ b/lib/src/ui/bloc/settings_bloc.freezed.dart @@ -11,53 +11,47 @@ part of 'settings_bloc.dart'; // dart format off T _$identity(T value) => value; - /// @nodoc mixin _$SettingsState { - bool get importSpinnerVisible; - int get importCurrent; - int get importTotal; - /// Create a copy of SettingsState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $SettingsStateCopyWith get copyWith => - _$SettingsStateCopyWithImpl( - this as SettingsState, _$identity); + bool get importSpinnerVisible; int get importCurrent; int get importTotal; +/// Create a copy of SettingsState +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SettingsStateCopyWith get copyWith => _$SettingsStateCopyWithImpl(this as SettingsState, _$identity); - @override - bool operator ==(Object 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)); - } - @override - int get hashCode => Object.hash( - runtimeType, importSpinnerVisible, importCurrent, importTotal); - @override - String toString() { - return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)'; - } +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,importSpinnerVisible,importCurrent,importTotal); + +@override +String toString() { + return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)'; +} + + } /// @nodoc -abstract mixin class $SettingsStateCopyWith<$Res> { - factory $SettingsStateCopyWith( - SettingsState value, $Res Function(SettingsState) _then) = - _$SettingsStateCopyWithImpl; - @useResult - $Res call({bool importSpinnerVisible, int importCurrent, int importTotal}); -} +abstract mixin class $SettingsStateCopyWith<$Res> { + factory $SettingsStateCopyWith(SettingsState value, $Res Function(SettingsState) _then) = _$SettingsStateCopyWithImpl; +@useResult +$Res call({ + bool importSpinnerVisible, int importCurrent, int importTotal +}); + + + +} /// @nodoc class _$SettingsStateCopyWithImpl<$Res> implements $SettingsStateCopyWith<$Res> { @@ -66,258 +60,198 @@ class _$SettingsStateCopyWithImpl<$Res> final SettingsState _self; final $Res Function(SettingsState) _then; - /// Create a copy of SettingsState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? importSpinnerVisible = null, - Object? importCurrent = null, - Object? importTotal = null, - }) { - return _then(_self.copyWith( - importSpinnerVisible: null == importSpinnerVisible - ? _self.importSpinnerVisible - : importSpinnerVisible // 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, - )); - } +/// Create a copy of SettingsState +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? importSpinnerVisible = null,Object? importCurrent = null,Object? importTotal = null,}) { + return _then(_self.copyWith( +importSpinnerVisible: null == importSpinnerVisible ? _self.importSpinnerVisible : importSpinnerVisible // 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, + )); } +} + + /// Adds pattern-matching-related methods to [SettingsState]. extension SettingsStatePatterns on SettingsState { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeMap( - TResult Function(_SettingsState value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _SettingsState() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeMap(TResult Function( _SettingsState value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SettingsState() when $default != null: +return $default(_that);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult map( - TResult Function(_SettingsState value) $default, - ) { - final _that = this; - switch (_that) { - case _SettingsState(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult map(TResult Function( _SettingsState value) $default,){ +final _that = this; +switch (_that) { +case _SettingsState(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_SettingsState value)? $default, - ) { - final _that = this; - switch (_that) { - case _SettingsState() when $default != null: - return $default(_that); - case _: - return null; - } - } +@optionalTypeArgs TResult? mapOrNull(TResult? Function( _SettingsState value)? $default,){ +final _that = this; +switch (_that) { +case _SettingsState() when $default != null: +return $default(_that);case _: + return null; - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - bool importSpinnerVisible, int importCurrent, int importTotal)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _SettingsState() when $default != null: - return $default( - _that.importSpinnerVisible, _that.importCurrent, _that.importTotal); - case _: - return orElse(); - } - } +@optionalTypeArgs TResult maybeWhen(TResult Function( bool importSpinnerVisible, int importCurrent, int importTotal)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SettingsState() when $default != null: +return $default(_that.importSpinnerVisible,_that.importCurrent,_that.importTotal);case _: + return orElse(); - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` - @optionalTypeArgs - TResult when( - TResult Function( - bool importSpinnerVisible, int importCurrent, int importTotal) - $default, - ) { - final _that = this; - switch (_that) { - case _SettingsState(): - return $default( - _that.importSpinnerVisible, _that.importCurrent, _that.importTotal); - case _: - throw StateError('Unexpected subclass'); - } - } +@optionalTypeArgs TResult when(TResult Function( bool importSpinnerVisible, int importCurrent, int importTotal) $default,) {final _that = this; +switch (_that) { +case _SettingsState(): +return $default(_that.importSpinnerVisible,_that.importCurrent,_that.importTotal);case _: + throw StateError('Unexpected subclass'); - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` +} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull(TResult? Function( bool importSpinnerVisible, int importCurrent, int importTotal)? $default,) {final _that = this; +switch (_that) { +case _SettingsState() when $default != null: +return $default(_that.importSpinnerVisible,_that.importCurrent,_that.importTotal);case _: + return null; + +} +} - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - bool importSpinnerVisible, int importCurrent, int importTotal)? - $default, - ) { - final _that = this; - switch (_that) { - case _SettingsState() when $default != null: - return $default( - _that.importSpinnerVisible, _that.importCurrent, _that.importTotal); - case _: - return null; - } - } } /// @nodoc + class _SettingsState implements SettingsState { - _SettingsState( - {this.importSpinnerVisible = false, - this.importCurrent = 0, - this.importTotal = 0}); + _SettingsState({this.importSpinnerVisible = false, this.importCurrent = 0, this.importTotal = 0}); + - @override - @JsonKey() - final bool importSpinnerVisible; - @override - @JsonKey() - final int importCurrent; - @override - @JsonKey() - final int importTotal; +@override@JsonKey() final bool importSpinnerVisible; +@override@JsonKey() final int importCurrent; +@override@JsonKey() final int importTotal; - /// Create a copy of SettingsState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$SettingsStateCopyWith<_SettingsState> get copyWith => - __$SettingsStateCopyWithImpl<_SettingsState>(this, _$identity); +/// Create a copy of SettingsState +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SettingsStateCopyWith<_SettingsState> get copyWith => __$SettingsStateCopyWithImpl<_SettingsState>(this, _$identity); - @override - bool operator ==(Object 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)); - } - @override - int get hashCode => Object.hash( - runtimeType, importSpinnerVisible, importCurrent, importTotal); - @override - String toString() { - return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)'; - } +@override +bool operator ==(Object 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)); +} + + +@override +int get hashCode => Object.hash(runtimeType,importSpinnerVisible,importCurrent,importTotal); + +@override +String toString() { + return 'SettingsState(importSpinnerVisible: $importSpinnerVisible, importCurrent: $importCurrent, importTotal: $importTotal)'; +} + + } /// @nodoc -abstract mixin class _$SettingsStateCopyWith<$Res> - implements $SettingsStateCopyWith<$Res> { - factory _$SettingsStateCopyWith( - _SettingsState value, $Res Function(_SettingsState) _then) = - __$SettingsStateCopyWithImpl; - @override - @useResult - $Res call({bool importSpinnerVisible, int importCurrent, int importTotal}); -} +abstract mixin class _$SettingsStateCopyWith<$Res> implements $SettingsStateCopyWith<$Res> { + factory _$SettingsStateCopyWith(_SettingsState value, $Res Function(_SettingsState) _then) = __$SettingsStateCopyWithImpl; +@override @useResult +$Res call({ + bool importSpinnerVisible, int importCurrent, int importTotal +}); + + + +} /// @nodoc class __$SettingsStateCopyWithImpl<$Res> implements _$SettingsStateCopyWith<$Res> { @@ -326,30 +260,18 @@ class __$SettingsStateCopyWithImpl<$Res> final _SettingsState _self; final $Res Function(_SettingsState) _then; - /// Create a copy of SettingsState - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? importSpinnerVisible = null, - Object? importCurrent = null, - Object? importTotal = null, - }) { - return _then(_SettingsState( - importSpinnerVisible: null == importSpinnerVisible - ? _self.importSpinnerVisible - : importSpinnerVisible // 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, - )); - } +/// Create a copy of SettingsState +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? importSpinnerVisible = null,Object? importCurrent = null,Object? importTotal = null,}) { + return _then(_SettingsState( +importSpinnerVisible: null == importSpinnerVisible ? _self.importSpinnerVisible : importSpinnerVisible // 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, + )); +} + + } // dart format on diff --git a/lib/src/ui/pages/details.dart b/lib/src/ui/pages/details.dart index 5336177..f047d28 100644 --- a/lib/src/ui/pages/details.dart +++ b/lib/src/ui/pages/details.dart @@ -17,11 +17,11 @@ class DetailsPage extends StatelessWidget { }); static MaterialPageRoute get route => MaterialPageRoute( - builder: (_) => const DetailsPage(), - settings: const RouteSettings( - name: detailsRoute, - ), - ); + builder: (_) => const DetailsPage(), + settings: const RouteSettings( + name: detailsRoute, + ), + ); @override Widget build(BuildContext context) { @@ -56,66 +56,156 @@ class DetailsPage extends StatelessWidget { Text( state.data!.title, textAlign: TextAlign.left, - style: - Theme.of(context).textTheme.titleLarge, + style: Theme.of( + context, + ).textTheme.titleLarge, maxLines: 2, softWrap: true, overflow: TextOverflow.ellipsis, ), - ElevatedButton( - onPressed: () async { - final result = await showDialog( - context: context, - builder: (context) { - return AlertDialog( - title: Text( - t.details.removeTitle( - title: state.data!.title, - ), - ), - content: Text( - t.details.removeBody( - title: state.data!.title, - ), - ), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context) - .pop(true); - }, - style: TextButton.styleFrom( - foregroundColor: Colors.red, - ), - child: Text( - t.details.removeButton, - ), - ), - TextButton( - onPressed: () { - Navigator.of(context) - .pop(false); - }, - child: Text( - t.details.cancelButton, - ), - ), - ], - ); - }, - ); + Padding( + padding: const EdgeInsets.only( + top: 6, + ), + child: Row( + spacing: 8, + children: [ + ElevatedButton( + onPressed: () async { + final result = await showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text( + t.details.removeTitle( + title: state.data!.title, + ), + ), + content: Text( + t.details.removeBody( + title: state.data!.title, + ), + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of( + context, + ).pop(true); + }, + style: + TextButton.styleFrom( + foregroundColor: + Colors.red, + ), + child: Text( + t.details.removeButton, + ), + ), + TextButton( + onPressed: () { + Navigator.of( + context, + ).pop(false); + }, + child: Text( + t.details.cancelButton, + ), + ), + ], + ); + }, + ); - if (result != true) return; + if (result != true) return; - // ignore: use_build_context_synchronously - context.read().add( - ItemRemovedEvent( - state.data!.id, - state.trackingType, - ), - ); - }, - child: const Icon(Icons.delete), + // ignore: use_build_context_synchronously + context.read().add( + ItemRemovedEvent( + state.data!.id, + state.trackingType, + ), + ); + }, + child: const Icon( + Icons.delete, + color: Colors.redAccent, + ), + ), + ElevatedButton( + onPressed: () async { + await showModalBottomSheet( + 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, + ), + ), + ], + ), ), ], ), @@ -135,50 +225,53 @@ class DetailsPage extends StatelessWidget { if (state.trackingType == TrackingMediumType.anime) { context.read().add( - DetailsUpdatedEvent( - (state.data! as AnimeTrackingData) - .copyWith( - state: newState, - ), - ), - ); + DetailsUpdatedEvent( + (state.data! as AnimeTrackingData).copyWith( + state: newState, + ), + ), + ); } else if (state.trackingType == TrackingMediumType.manga) { context.read().add( - DetailsUpdatedEvent( - (state.data! as MangaTrackingData) - .copyWith( - state: newState, - ), - ), - ); + DetailsUpdatedEvent( + (state.data! as MangaTrackingData).copyWith( + state: newState, + ), + ), + ); } }, values: [ SelectorItem( MediumTrackingState.ongoing, - MediumTrackingState.ongoing - .getName(state.trackingType), + MediumTrackingState.ongoing.getName( + state.trackingType, + ), ), SelectorItem( MediumTrackingState.completed, - MediumTrackingState.completed - .getName(state.trackingType), + MediumTrackingState.completed.getName( + state.trackingType, + ), ), SelectorItem( MediumTrackingState.planned, - MediumTrackingState.planned - .getName(state.trackingType), + MediumTrackingState.planned.getName( + state.trackingType, + ), ), SelectorItem( MediumTrackingState.dropped, - MediumTrackingState.dropped - .getName(state.trackingType), + MediumTrackingState.dropped.getName( + state.trackingType, + ), ), SelectorItem( MediumTrackingState.paused, - MediumTrackingState.paused - .getName(state.trackingType), + MediumTrackingState.paused.getName( + state.trackingType, + ), ), ], initialValue: state.data!.state, @@ -191,36 +284,36 @@ class DetailsPage extends StatelessWidget { child: IntegerInput( labelText: state.trackingType == TrackingMediumType.anime - ? t.details.episodes - : t.details.chapters, + ? t.details.episodes + : t.details.chapters, onChanged: (value) { switch (state.trackingType) { case TrackingMediumType.anime: final data = state.data! as AnimeTrackingData; context.read().add( - DetailsUpdatedEvent( - data.copyWith( - episodesWatched: value, - ), - ), - ); + DetailsUpdatedEvent( + data.copyWith( + episodesWatched: value, + ), + ), + ); break; case TrackingMediumType.manga: final data = state.data! as MangaTrackingData; context.read().add( - DetailsUpdatedEvent( - data.copyWith( - chaptersRead: value, - ), - ), - ); + DetailsUpdatedEvent( + data.copyWith( + chaptersRead: value, + ), + ), + ); break; } }, - initialValue: state.trackingType == - TrackingMediumType.anime + initialValue: + state.trackingType == TrackingMediumType.anime ? (state.data! as AnimeTrackingData) - .episodesWatched + .episodesWatched : (state.data! as MangaTrackingData).chaptersRead, ), ), @@ -234,18 +327,17 @@ class DetailsPage extends StatelessWidget { onChanged: (value) { final data = state.data! as MangaTrackingData; context.read().add( - DetailsUpdatedEvent( - data.copyWith( - volumesOwned: value, - ), - ), - ); + DetailsUpdatedEvent( + data.copyWith( + volumesOwned: value, + ), + ), + ); }, - initialValue: (GetIt.I - .get() - .state - .data! as MangaTrackingData) - .volumesOwned, + initialValue: + (GetIt.I.get().state.data! + as MangaTrackingData) + .volumesOwned, ), ), ],