From 4d461d046bad4e65f38af1ac139a25ff00f71520 Mon Sep 17 00:00:00 2001 From: Ziedelth Date: Wed, 7 Aug 2024 14:30:31 +0200 Subject: [PATCH] Redesign calendar --- lib/components/animes/anime_component.dart | 11 +- .../animes/calendar_anime_component.dart | 75 +++-- lib/components/card_component.dart | 85 +++-- lib/controllers/anime_weekly_controller.dart | 5 +- lib/dtos/anime_dto.dart | 6 +- lib/dtos/anime_dto.freezed.dart | 117 ++++--- lib/dtos/anime_dto.g.dart | 13 +- lib/dtos/episode_mapping_dto.freezed.dart | 23 +- lib/dtos/episode_variant_dto.freezed.dart | 23 +- lib/dtos/member_dto.freezed.dart | 21 +- lib/dtos/missed_anime_dto.freezed.dart | 23 +- lib/dtos/pageable_dto.freezed.dart | 21 +- lib/dtos/platform_dto.freezed.dart | 21 +- lib/dtos/season_dto.freezed.dart | 21 +- lib/dtos/simulcast_dto.freezed.dart | 21 +- lib/dtos/week_day_dto.freezed.dart | 21 +- lib/dtos/week_day_release_dto.dart | 12 +- lib/dtos/week_day_release_dto.freezed.dart | 290 ++++++++++++++---- lib/dtos/week_day_release_dto.g.dart | 27 +- lib/views/anime_details_view.dart | 48 +-- pubspec.lock | 8 + pubspec.yaml | 1 + 22 files changed, 649 insertions(+), 244 deletions(-) diff --git a/lib/components/animes/anime_component.dart b/lib/components/animes/anime_component.dart index a7aae7d..1bc2a8b 100644 --- a/lib/components/animes/anime_component.dart +++ b/lib/components/animes/anime_component.dart @@ -86,11 +86,12 @@ class AnimeComponent extends StatelessWidget { maxLines: 2, ), ), - for (final langType in anime.langTypes) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: LangTypeComponent(langType: langType), - ), + if (anime.langTypes != null) + for (final langType in anime.langTypes!) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: LangTypeComponent(langType: langType), + ), const SizedBox(height: 8), ], ), diff --git a/lib/components/animes/calendar_anime_component.dart b/lib/components/animes/calendar_anime_component.dart index c4eaba3..9106530 100644 --- a/lib/components/animes/calendar_anime_component.dart +++ b/lib/components/animes/calendar_anime_component.dart @@ -5,10 +5,12 @@ import 'package:application/components/lang_type_component.dart'; import 'package:application/components/platforms/list_platform.dart'; import 'package:application/controllers/anime_controller.dart'; import 'package:application/dtos/week_day_release_dto.dart'; +import 'package:application/utils/constant.dart'; import 'package:application/views/anime_details_view.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:intl/intl.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:palette_generator/palette_generator.dart'; class CalendarAnimeComponent extends StatelessWidget { static const bookmarkColor = Colors.yellow; @@ -29,7 +31,25 @@ class CalendarAnimeComponent extends StatelessWidget { @override Widget build(BuildContext context) { + if (!release.isMultipleReleased) { + return buildCustomCard(context); + } + + return FutureBuilder( + future: _getDominantColor(), + builder: (context, snapshot) { + final layerColor = snapshot.connectionState == ConnectionState.waiting + ? null + : snapshot.data; + return buildCustomCard(context, layerColor: layerColor); + }, + ); + } + + CustomCard buildCustomCard(BuildContext context, {Color? layerColor}) { return CustomCard( + activateLayers: layerColor != null, + layerColor: layerColor, onTap: () { Navigator.of(context).push( MaterialPageRoute( @@ -45,8 +65,10 @@ class CalendarAnimeComponent extends StatelessWidget { Stack( children: [ ImageComponent( - uuid: release.anime.uuid, - type: 'banner', + uuid: release.isReleased + ? release.mappings.first + : release.anime.uuid, + type: release.isReleased ? 'image' : 'banner', borderRadius: const BorderRadius.only( topLeft: Radius.circular(16), topRight: Radius.circular(16), @@ -90,32 +112,25 @@ class CalendarAnimeComponent extends StatelessWidget { overflow: TextOverflow.ellipsis, maxLines: 2, ), + if (release.isReleased) + Text( + AppLocalizations.of(context)!.minInformation( + AppLocalizations.of(context)!.episodeType( + release.episodeType!.toLowerCase(), + ), + release.isMultipleReleased + ? '${release.minNumber} - ${release.maxNumber}' + : release.number!, + ), + style: Theme.of(context).textTheme.bodyMedium, + overflow: TextOverflow.ellipsis, + ), LangTypeComponent(langType: release.langType), ], ), ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - mainAxisSize: MainAxisSize.min, - children: [ - if (release.variant != null) - Padding( - padding: const EdgeInsets.symmetric(horizontal: 16), - child: GestureDetector( - onTap: () { - launchUrl( - Uri.parse(release.variant!.url), - mode: LaunchMode.externalNonBrowserApplication, - ); - }, - child: const Icon( - Icons.live_tv_outlined, - ), - ), - ), - WatchlistButton(anime: release.anime), - ], - ), + const SizedBox(width: 8), + WatchlistButton(anime: release.anime), ], ), ), @@ -124,4 +139,14 @@ class CalendarAnimeComponent extends StatelessWidget { ), ); } + + Future _getDominantColor() async { + return (await PaletteGenerator.fromImageProvider( + Image.network( + '${Constant.apiUrl}/v1/attachments?uuid=${release.mappings.first}&type=image', + ).image, + )) + .dominantColor! + .color; + } } diff --git a/lib/components/card_component.dart b/lib/components/card_component.dart index 6b131fd..01da157 100644 --- a/lib/components/card_component.dart +++ b/lib/components/card_component.dart @@ -5,6 +5,8 @@ class CustomCard extends StatefulWidget { final Color? backgroundColor; final Function()? onTap; final Function(TapDownDetails?)? onLongPress; + final bool activateLayers; + final Color? layerColor; const CustomCard({ super.key, @@ -12,6 +14,8 @@ class CustomCard extends StatefulWidget { this.backgroundColor, this.onTap, this.onLongPress, + this.activateLayers = false, + this.layerColor, }); @override @@ -28,29 +32,66 @@ class _CustomCardState extends State { return RepaintBoundary( child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), - child: DecoratedBox( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - color: widget.backgroundColor ?? withOpacity, - border: Border.all( - color: widget.backgroundColor ?? withOpacity, - width: 1, - ), - ), - child: GestureDetector( - onTap: widget.onTap, - onLongPress: () { - widget.onLongPress?.call(_tapDownDetails); - }, - onTapDown: (details) { - _tapDownDetails = details; - }, - child: Padding( - padding: const EdgeInsets.all(1), - child: widget.child, + padding: EdgeInsets.only( + left: 8, + right: 8, + top: widget.activateLayers ? 8 : 4, + bottom: 4, + ), + child: Stack( + fit: StackFit.passthrough, + clipBehavior: Clip.none, + children: [ + if (widget.activateLayers && widget.layerColor != null) ...[ + Positioned( + top: -8, + left: 12, + right: 12, + height: 100, + child: DecoratedBox( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + color: widget.layerColor!.withOpacity(0.5), + ), + ), + ), + Positioned( + top: -4, + left: 6, + right: 6, + height: 100, + child: DecoratedBox( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + color: widget.layerColor!, + ), + ), + ), + ], + DecoratedBox( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + color: widget.backgroundColor ?? withOpacity, + border: Border.all( + color: widget.backgroundColor ?? withOpacity, + width: 1, + ), + ), + child: GestureDetector( + onTap: widget.onTap, + onLongPress: () { + widget.onLongPress?.call(_tapDownDetails); + }, + onTapDown: (details) { + _tapDownDetails = details; + }, + child: Padding( + padding: const EdgeInsets.all(1), + child: widget.child, + ), + ), ), - ), + ], ), ), ); diff --git a/lib/controllers/anime_weekly_controller.dart b/lib/controllers/anime_weekly_controller.dart index 77fc70b..5136e3b 100644 --- a/lib/controllers/anime_weekly_controller.dart +++ b/lib/controllers/anime_weekly_controller.dart @@ -49,8 +49,9 @@ class AnimeWeeklyController { ); streamController.add(weekDays); - } catch (e) { - debugPrint(e.toString()); + } catch (exception, stackTrace) { + debugPrint(exception.toString()); + debugPrint(stackTrace.toString()); } finally { isLoading = false; } diff --git a/lib/dtos/anime_dto.dart b/lib/dtos/anime_dto.dart index b0e3177..e6cae97 100644 --- a/lib/dtos/anime_dto.dart +++ b/lib/dtos/anime_dto.dart @@ -19,9 +19,9 @@ class AnimeDto with _$AnimeDto { required String? banner, required String? description, required List? simulcasts, - required List audioLocales, - required List langTypes, - required List seasons, + required List? audioLocales, + required List? langTypes, + required List? seasons, required String? status, }) = _AnimeDto; diff --git a/lib/dtos/anime_dto.freezed.dart b/lib/dtos/anime_dto.freezed.dart index fe528e3..002d810 100644 --- a/lib/dtos/anime_dto.freezed.dart +++ b/lib/dtos/anime_dto.freezed.dart @@ -31,13 +31,17 @@ mixin _$AnimeDto { String? get banner => throw _privateConstructorUsedError; String? get description => throw _privateConstructorUsedError; List? get simulcasts => throw _privateConstructorUsedError; - List get audioLocales => throw _privateConstructorUsedError; - List get langTypes => throw _privateConstructorUsedError; - List get seasons => throw _privateConstructorUsedError; + List? get audioLocales => throw _privateConstructorUsedError; + List? get langTypes => throw _privateConstructorUsedError; + List? get seasons => throw _privateConstructorUsedError; String? get status => throw _privateConstructorUsedError; + /// Serializes this AnimeDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of AnimeDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $AnimeDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -59,9 +63,9 @@ abstract class $AnimeDtoCopyWith<$Res> { String? banner, String? description, List? simulcasts, - List audioLocales, - List langTypes, - List seasons, + List? audioLocales, + List? langTypes, + List? seasons, String? status}); } @@ -75,6 +79,8 @@ class _$AnimeDtoCopyWithImpl<$Res, $Val extends AnimeDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of AnimeDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -89,9 +95,9 @@ class _$AnimeDtoCopyWithImpl<$Res, $Val extends AnimeDto> Object? banner = freezed, Object? description = freezed, Object? simulcasts = freezed, - Object? audioLocales = null, - Object? langTypes = null, - Object? seasons = null, + Object? audioLocales = freezed, + Object? langTypes = freezed, + Object? seasons = freezed, Object? status = freezed, }) { return _then(_value.copyWith( @@ -139,18 +145,18 @@ class _$AnimeDtoCopyWithImpl<$Res, $Val extends AnimeDto> ? _value.simulcasts : simulcasts // ignore: cast_nullable_to_non_nullable as List?, - audioLocales: null == audioLocales + audioLocales: freezed == audioLocales ? _value.audioLocales : audioLocales // ignore: cast_nullable_to_non_nullable - as List, - langTypes: null == langTypes + as List?, + langTypes: freezed == langTypes ? _value.langTypes : langTypes // ignore: cast_nullable_to_non_nullable - as List, - seasons: null == seasons + as List?, + seasons: freezed == seasons ? _value.seasons : seasons // ignore: cast_nullable_to_non_nullable - as List, + as List?, status: freezed == status ? _value.status : status // ignore: cast_nullable_to_non_nullable @@ -179,9 +185,9 @@ abstract class _$$AnimeDtoImplCopyWith<$Res> String? banner, String? description, List? simulcasts, - List audioLocales, - List langTypes, - List seasons, + List? audioLocales, + List? langTypes, + List? seasons, String? status}); } @@ -193,6 +199,8 @@ class __$$AnimeDtoImplCopyWithImpl<$Res> _$AnimeDtoImpl _value, $Res Function(_$AnimeDtoImpl) _then) : super(_value, _then); + /// Create a copy of AnimeDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -207,9 +215,9 @@ class __$$AnimeDtoImplCopyWithImpl<$Res> Object? banner = freezed, Object? description = freezed, Object? simulcasts = freezed, - Object? audioLocales = null, - Object? langTypes = null, - Object? seasons = null, + Object? audioLocales = freezed, + Object? langTypes = freezed, + Object? seasons = freezed, Object? status = freezed, }) { return _then(_$AnimeDtoImpl( @@ -257,18 +265,18 @@ class __$$AnimeDtoImplCopyWithImpl<$Res> ? _value._simulcasts : simulcasts // ignore: cast_nullable_to_non_nullable as List?, - audioLocales: null == audioLocales + audioLocales: freezed == audioLocales ? _value._audioLocales : audioLocales // ignore: cast_nullable_to_non_nullable - as List, - langTypes: null == langTypes + as List?, + langTypes: freezed == langTypes ? _value._langTypes : langTypes // ignore: cast_nullable_to_non_nullable - as List, - seasons: null == seasons + as List?, + seasons: freezed == seasons ? _value._seasons : seasons // ignore: cast_nullable_to_non_nullable - as List, + as List?, status: freezed == status ? _value.status : status // ignore: cast_nullable_to_non_nullable @@ -292,9 +300,9 @@ class _$AnimeDtoImpl implements _AnimeDto { required this.banner, required this.description, required final List? simulcasts, - required final List audioLocales, - required final List langTypes, - required final List seasons, + required final List? audioLocales, + required final List? langTypes, + required final List? seasons, required this.status}) : _simulcasts = simulcasts, _audioLocales = audioLocales, @@ -334,28 +342,34 @@ class _$AnimeDtoImpl implements _AnimeDto { return EqualUnmodifiableListView(value); } - final List _audioLocales; + final List? _audioLocales; @override - List get audioLocales { + List? get audioLocales { + final value = _audioLocales; + if (value == null) return null; if (_audioLocales is EqualUnmodifiableListView) return _audioLocales; // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_audioLocales); + return EqualUnmodifiableListView(value); } - final List _langTypes; + final List? _langTypes; @override - List get langTypes { + List? get langTypes { + final value = _langTypes; + if (value == null) return null; if (_langTypes is EqualUnmodifiableListView) return _langTypes; // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_langTypes); + return EqualUnmodifiableListView(value); } - final List _seasons; + final List? _seasons; @override - List get seasons { + List? get seasons { + final value = _seasons; + if (value == null) return null; if (_seasons is EqualUnmodifiableListView) return _seasons; // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_seasons); + return EqualUnmodifiableListView(value); } @override @@ -396,7 +410,7 @@ class _$AnimeDtoImpl implements _AnimeDto { (identical(other.status, status) || other.status == status)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -416,7 +430,9 @@ class _$AnimeDtoImpl implements _AnimeDto { const DeepCollectionEquality().hash(_seasons), status); - @JsonKey(ignore: true) + /// Create a copy of AnimeDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$AnimeDtoImplCopyWith<_$AnimeDtoImpl> get copyWith => @@ -443,9 +459,9 @@ abstract class _AnimeDto implements AnimeDto { required final String? banner, required final String? description, required final List? simulcasts, - required final List audioLocales, - required final List langTypes, - required final List seasons, + required final List? audioLocales, + required final List? langTypes, + required final List? seasons, required final String? status}) = _$AnimeDtoImpl; factory _AnimeDto.fromJson(Map json) = @@ -474,15 +490,18 @@ abstract class _AnimeDto implements AnimeDto { @override List? get simulcasts; @override - List get audioLocales; + List? get audioLocales; @override - List get langTypes; + List? get langTypes; @override - List get seasons; + List? get seasons; @override String? get status; + + /// Create a copy of AnimeDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$AnimeDtoImplCopyWith<_$AnimeDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/anime_dto.g.dart b/lib/dtos/anime_dto.g.dart index 41805d3..4d00ca5 100644 --- a/lib/dtos/anime_dto.g.dart +++ b/lib/dtos/anime_dto.g.dart @@ -21,13 +21,14 @@ _$AnimeDtoImpl _$$AnimeDtoImplFromJson(Map json) => simulcasts: (json['simulcasts'] as List?) ?.map((e) => SimulcastDto.fromJson(e as Map)) .toList(), - audioLocales: (json['audioLocales'] as List) - .map((e) => e as String) + audioLocales: (json['audioLocales'] as List?) + ?.map((e) => e as String) .toList(), - langTypes: - (json['langTypes'] as List).map((e) => e as String).toList(), - seasons: (json['seasons'] as List) - .map((e) => SeasonDto.fromJson(e as Map)) + langTypes: (json['langTypes'] as List?) + ?.map((e) => e as String) + .toList(), + seasons: (json['seasons'] as List?) + ?.map((e) => SeasonDto.fromJson(e as Map)) .toList(), status: json['status'] as String?, ); diff --git a/lib/dtos/episode_mapping_dto.freezed.dart b/lib/dtos/episode_mapping_dto.freezed.dart index 1a48be6..5abcb84 100644 --- a/lib/dtos/episode_mapping_dto.freezed.dart +++ b/lib/dtos/episode_mapping_dto.freezed.dart @@ -37,8 +37,12 @@ mixin _$EpisodeMappingDto { List get langTypes => throw _privateConstructorUsedError; String get status => throw _privateConstructorUsedError; + /// Serializes this EpisodeMappingDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of EpisodeMappingDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $EpisodeMappingDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -80,6 +84,8 @@ class _$EpisodeMappingDtoCopyWithImpl<$Res, $Val extends EpisodeMappingDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of EpisodeMappingDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -168,6 +174,8 @@ class _$EpisodeMappingDtoCopyWithImpl<$Res, $Val extends EpisodeMappingDto> ) as $Val); } + /// Create a copy of EpisodeMappingDto + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $AnimeDtoCopyWith<$Res> get anime { @@ -215,6 +223,8 @@ class __$$EpisodeMappingDtoImplCopyWithImpl<$Res> $Res Function(_$EpisodeMappingDtoImpl) _then) : super(_value, _then); + /// Create a copy of EpisodeMappingDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -418,7 +428,7 @@ class _$EpisodeMappingDtoImpl implements _EpisodeMappingDto { (identical(other.status, status) || other.status == status)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -439,7 +449,9 @@ class _$EpisodeMappingDtoImpl implements _EpisodeMappingDto { const DeepCollectionEquality().hash(_langTypes), status); - @JsonKey(ignore: true) + /// Create a copy of EpisodeMappingDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$EpisodeMappingDtoImplCopyWith<_$EpisodeMappingDtoImpl> get copyWith => @@ -508,8 +520,11 @@ abstract class _EpisodeMappingDto implements EpisodeMappingDto { List get langTypes; @override String get status; + + /// Create a copy of EpisodeMappingDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$EpisodeMappingDtoImplCopyWith<_$EpisodeMappingDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/episode_variant_dto.freezed.dart b/lib/dtos/episode_variant_dto.freezed.dart index 1fb1d52..3acacae 100644 --- a/lib/dtos/episode_variant_dto.freezed.dart +++ b/lib/dtos/episode_variant_dto.freezed.dart @@ -28,8 +28,12 @@ mixin _$EpisodeVariantDto { String get url => throw _privateConstructorUsedError; bool get uncensored => throw _privateConstructorUsedError; + /// Serializes this EpisodeVariantDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of EpisodeVariantDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $EpisodeVariantDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -62,6 +66,8 @@ class _$EpisodeVariantDtoCopyWithImpl<$Res, $Val extends EpisodeVariantDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of EpisodeVariantDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -105,6 +111,8 @@ class _$EpisodeVariantDtoCopyWithImpl<$Res, $Val extends EpisodeVariantDto> ) as $Val); } + /// Create a copy of EpisodeVariantDto + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $PlatformDtoCopyWith<$Res> get platform { @@ -143,6 +151,8 @@ class __$$EpisodeVariantDtoImplCopyWithImpl<$Res> $Res Function(_$EpisodeVariantDtoImpl) _then) : super(_value, _then); + /// Create a copy of EpisodeVariantDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -241,12 +251,14 @@ class _$EpisodeVariantDtoImpl implements _EpisodeVariantDto { other.uncensored == uncensored)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, uuid, releaseDateTime, platform, audioLocale, identifier, url, uncensored); - @JsonKey(ignore: true) + /// Create a copy of EpisodeVariantDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$EpisodeVariantDtoImplCopyWith<_$EpisodeVariantDtoImpl> get copyWith => @@ -288,8 +300,11 @@ abstract class _EpisodeVariantDto implements EpisodeVariantDto { String get url; @override bool get uncensored; + + /// Create a copy of EpisodeVariantDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$EpisodeVariantDtoImplCopyWith<_$EpisodeVariantDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/member_dto.freezed.dart b/lib/dtos/member_dto.freezed.dart index 77aa972..8594023 100644 --- a/lib/dtos/member_dto.freezed.dart +++ b/lib/dtos/member_dto.freezed.dart @@ -30,8 +30,12 @@ mixin _$MemberDto { List get followedEpisodes => throw _privateConstructorUsedError; int get totalDuration => throw _privateConstructorUsedError; + /// Serializes this MemberDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of MemberDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $MemberDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -63,6 +67,8 @@ class _$MemberDtoCopyWithImpl<$Res, $Val extends MemberDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of MemberDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -145,6 +151,8 @@ class __$$MemberDtoImplCopyWithImpl<$Res> _$MemberDtoImpl _value, $Res Function(_$MemberDtoImpl) _then) : super(_value, _then); + /// Create a copy of MemberDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -262,7 +270,7 @@ class _$MemberDtoImpl implements _MemberDto { other.totalDuration == totalDuration)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -276,7 +284,9 @@ class _$MemberDtoImpl implements _MemberDto { const DeepCollectionEquality().hash(followedEpisodes), totalDuration); - @JsonKey(ignore: true) + /// Create a copy of MemberDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$MemberDtoImplCopyWith<_$MemberDtoImpl> get copyWith => @@ -323,8 +333,11 @@ abstract class _MemberDto implements MemberDto { List get followedEpisodes; @override int get totalDuration; + + /// Create a copy of MemberDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$MemberDtoImplCopyWith<_$MemberDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/missed_anime_dto.freezed.dart b/lib/dtos/missed_anime_dto.freezed.dart index 9bb922a..a0e684f 100644 --- a/lib/dtos/missed_anime_dto.freezed.dart +++ b/lib/dtos/missed_anime_dto.freezed.dart @@ -23,8 +23,12 @@ mixin _$MissedAnimeDto { AnimeDto get anime => throw _privateConstructorUsedError; int get episodeMissed => throw _privateConstructorUsedError; + /// Serializes this MissedAnimeDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of MissedAnimeDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $MissedAnimeDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -50,6 +54,8 @@ class _$MissedAnimeDtoCopyWithImpl<$Res, $Val extends MissedAnimeDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of MissedAnimeDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -68,6 +74,8 @@ class _$MissedAnimeDtoCopyWithImpl<$Res, $Val extends MissedAnimeDto> ) as $Val); } + /// Create a copy of MissedAnimeDto + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $AnimeDtoCopyWith<$Res> get anime { @@ -99,6 +107,8 @@ class __$$MissedAnimeDtoImplCopyWithImpl<$Res> _$MissedAnimeDtoImpl _value, $Res Function(_$MissedAnimeDtoImpl) _then) : super(_value, _then); + /// Create a copy of MissedAnimeDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -147,11 +157,13 @@ class _$MissedAnimeDtoImpl implements _MissedAnimeDto { other.episodeMissed == episodeMissed)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, anime, episodeMissed); - @JsonKey(ignore: true) + /// Create a copy of MissedAnimeDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$MissedAnimeDtoImplCopyWith<_$MissedAnimeDtoImpl> get copyWith => @@ -178,8 +190,11 @@ abstract class _MissedAnimeDto implements MissedAnimeDto { AnimeDto get anime; @override int get episodeMissed; + + /// Create a copy of MissedAnimeDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$MissedAnimeDtoImplCopyWith<_$MissedAnimeDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/pageable_dto.freezed.dart b/lib/dtos/pageable_dto.freezed.dart index 10dbcc0..649c1d5 100644 --- a/lib/dtos/pageable_dto.freezed.dart +++ b/lib/dtos/pageable_dto.freezed.dart @@ -25,8 +25,12 @@ mixin _$PageableDto { int get limit => throw _privateConstructorUsedError; int get total => throw _privateConstructorUsedError; + /// Serializes this PageableDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of PageableDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $PageableDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -50,6 +54,8 @@ class _$PageableDtoCopyWithImpl<$Res, $Val extends PageableDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of PageableDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -98,6 +104,8 @@ class __$$PageableDtoImplCopyWithImpl<$Res> _$PageableDtoImpl _value, $Res Function(_$PageableDtoImpl) _then) : super(_value, _then); + /// Create a copy of PageableDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -171,12 +179,14 @@ class _$PageableDtoImpl implements _PageableDto { (identical(other.total, total) || other.total == total)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(_data), page, limit, total); - @JsonKey(ignore: true) + /// Create a copy of PageableDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$PageableDtoImplCopyWith<_$PageableDtoImpl> get copyWith => @@ -208,8 +218,11 @@ abstract class _PageableDto implements PageableDto { int get limit; @override int get total; + + /// Create a copy of PageableDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$PageableDtoImplCopyWith<_$PageableDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/platform_dto.freezed.dart b/lib/dtos/platform_dto.freezed.dart index 6ece867..3512f7b 100644 --- a/lib/dtos/platform_dto.freezed.dart +++ b/lib/dtos/platform_dto.freezed.dart @@ -25,8 +25,12 @@ mixin _$PlatformDto { String get url => throw _privateConstructorUsedError; String get image => throw _privateConstructorUsedError; + /// Serializes this PlatformDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of PlatformDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $PlatformDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -50,6 +54,8 @@ class _$PlatformDtoCopyWithImpl<$Res, $Val extends PlatformDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of PlatformDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -98,6 +104,8 @@ class __$$PlatformDtoImplCopyWithImpl<$Res> _$PlatformDtoImpl _value, $Res Function(_$PlatformDtoImpl) _then) : super(_value, _then); + /// Create a copy of PlatformDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -164,11 +172,13 @@ class _$PlatformDtoImpl implements _PlatformDto { (identical(other.image, image) || other.image == image)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, id, name, url, image); - @JsonKey(ignore: true) + /// Create a copy of PlatformDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$PlatformDtoImplCopyWith<_$PlatformDtoImpl> get copyWith => @@ -200,8 +210,11 @@ abstract class _PlatformDto implements PlatformDto { String get url; @override String get image; + + /// Create a copy of PlatformDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$PlatformDtoImplCopyWith<_$PlatformDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/season_dto.freezed.dart b/lib/dtos/season_dto.freezed.dart index d1b81d6..2a922f5 100644 --- a/lib/dtos/season_dto.freezed.dart +++ b/lib/dtos/season_dto.freezed.dart @@ -23,8 +23,12 @@ mixin _$SeasonDto { int get number => throw _privateConstructorUsedError; String get lastReleaseDateTime => throw _privateConstructorUsedError; + /// Serializes this SeasonDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of SeasonDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $SeasonDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -47,6 +51,8 @@ class _$SeasonDtoCopyWithImpl<$Res, $Val extends SeasonDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of SeasonDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -85,6 +91,8 @@ class __$$SeasonDtoImplCopyWithImpl<$Res> _$SeasonDtoImpl _value, $Res Function(_$SeasonDtoImpl) _then) : super(_value, _then); + /// Create a copy of SeasonDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -133,11 +141,13 @@ class _$SeasonDtoImpl implements _SeasonDto { other.lastReleaseDateTime == lastReleaseDateTime)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, number, lastReleaseDateTime); - @JsonKey(ignore: true) + /// Create a copy of SeasonDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$SeasonDtoImplCopyWith<_$SeasonDtoImpl> get copyWith => @@ -163,8 +173,11 @@ abstract class _SeasonDto implements SeasonDto { int get number; @override String get lastReleaseDateTime; + + /// Create a copy of SeasonDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$SeasonDtoImplCopyWith<_$SeasonDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/simulcast_dto.freezed.dart b/lib/dtos/simulcast_dto.freezed.dart index 2722f83..ff394d7 100644 --- a/lib/dtos/simulcast_dto.freezed.dart +++ b/lib/dtos/simulcast_dto.freezed.dart @@ -26,8 +26,12 @@ mixin _$SimulcastDto { String get slug => throw _privateConstructorUsedError; String get label => throw _privateConstructorUsedError; + /// Serializes this SimulcastDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of SimulcastDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $SimulcastDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -51,6 +55,8 @@ class _$SimulcastDtoCopyWithImpl<$Res, $Val extends SimulcastDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of SimulcastDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -104,6 +110,8 @@ class __$$SimulcastDtoImplCopyWithImpl<$Res> _$SimulcastDtoImpl _value, $Res Function(_$SimulcastDtoImpl) _then) : super(_value, _then); + /// Create a copy of SimulcastDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -179,11 +187,13 @@ class _$SimulcastDtoImpl implements _SimulcastDto { (identical(other.label, label) || other.label == label)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, uuid, season, year, slug, label); - @JsonKey(ignore: true) + /// Create a copy of SimulcastDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$SimulcastDtoImplCopyWith<_$SimulcastDtoImpl> get copyWith => @@ -218,8 +228,11 @@ abstract class _SimulcastDto implements SimulcastDto { String get slug; @override String get label; + + /// Create a copy of SimulcastDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$SimulcastDtoImplCopyWith<_$SimulcastDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/week_day_dto.freezed.dart b/lib/dtos/week_day_dto.freezed.dart index 4a1df1c..ce63076 100644 --- a/lib/dtos/week_day_dto.freezed.dart +++ b/lib/dtos/week_day_dto.freezed.dart @@ -23,8 +23,12 @@ mixin _$WeekDayDto { String get dayOfWeek => throw _privateConstructorUsedError; List get releases => throw _privateConstructorUsedError; + /// Serializes this WeekDayDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of WeekDayDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $WeekDayDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -48,6 +52,8 @@ class _$WeekDayDtoCopyWithImpl<$Res, $Val extends WeekDayDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of WeekDayDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -86,6 +92,8 @@ class __$$WeekDayDtoImplCopyWithImpl<$Res> _$WeekDayDtoImpl _value, $Res Function(_$WeekDayDtoImpl) _then) : super(_value, _then); + /// Create a copy of WeekDayDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -141,12 +149,14 @@ class _$WeekDayDtoImpl implements _WeekDayDto { const DeepCollectionEquality().equals(other._releases, _releases)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, dayOfWeek, const DeepCollectionEquality().hash(_releases)); - @JsonKey(ignore: true) + /// Create a copy of WeekDayDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$WeekDayDtoImplCopyWith<_$WeekDayDtoImpl> get copyWith => @@ -172,8 +182,11 @@ abstract class _WeekDayDto implements WeekDayDto { String get dayOfWeek; @override List get releases; + + /// Create a copy of WeekDayDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$WeekDayDtoImplCopyWith<_$WeekDayDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/week_day_release_dto.dart b/lib/dtos/week_day_release_dto.dart index 8f35290..d1d7553 100644 --- a/lib/dtos/week_day_release_dto.dart +++ b/lib/dtos/week_day_release_dto.dart @@ -1,5 +1,4 @@ import 'package:application/dtos/anime_dto.dart'; -import 'package:application/dtos/episode_variant_dto.dart'; import 'package:application/dtos/platform_dto.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; @@ -10,10 +9,17 @@ part 'week_day_release_dto.g.dart'; class WeekDayReleaseDto with _$WeekDayReleaseDto { const factory WeekDayReleaseDto({ required AnimeDto anime, + required List platforms, required String releaseDateTime, + required String slug, required String langType, - required List platforms, - required EpisodeVariantDto? variant, + required bool isReleased, + required bool isMultipleReleased, + required List mappings, + required String? episodeType, + required int? minNumber, + required int? maxNumber, + required int? number, }) = _WeekDayReleaseDto; factory WeekDayReleaseDto.fromJson(Map json) => diff --git a/lib/dtos/week_day_release_dto.freezed.dart b/lib/dtos/week_day_release_dto.freezed.dart index c2c7f38..ed3e66e 100644 --- a/lib/dtos/week_day_release_dto.freezed.dart +++ b/lib/dtos/week_day_release_dto.freezed.dart @@ -21,13 +21,24 @@ WeekDayReleaseDto _$WeekDayReleaseDtoFromJson(Map json) { /// @nodoc mixin _$WeekDayReleaseDto { AnimeDto get anime => throw _privateConstructorUsedError; + List get platforms => throw _privateConstructorUsedError; String get releaseDateTime => throw _privateConstructorUsedError; + String get slug => throw _privateConstructorUsedError; String get langType => throw _privateConstructorUsedError; - List get platforms => throw _privateConstructorUsedError; - EpisodeVariantDto? get variant => throw _privateConstructorUsedError; + bool get isReleased => throw _privateConstructorUsedError; + bool get isMultipleReleased => throw _privateConstructorUsedError; + List get mappings => throw _privateConstructorUsedError; + String? get episodeType => throw _privateConstructorUsedError; + int? get minNumber => throw _privateConstructorUsedError; + int? get maxNumber => throw _privateConstructorUsedError; + int? get number => throw _privateConstructorUsedError; + /// Serializes this WeekDayReleaseDto to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of WeekDayReleaseDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $WeekDayReleaseDtoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -40,13 +51,19 @@ abstract class $WeekDayReleaseDtoCopyWith<$Res> { @useResult $Res call( {AnimeDto anime, + List platforms, String releaseDateTime, + String slug, String langType, - List platforms, - EpisodeVariantDto? variant}); + bool isReleased, + bool isMultipleReleased, + List mappings, + String? episodeType, + int? minNumber, + int? maxNumber, + int? number}); $AnimeDtoCopyWith<$Res> get anime; - $EpisodeVariantDtoCopyWith<$Res>? get variant; } /// @nodoc @@ -59,39 +76,78 @@ class _$WeekDayReleaseDtoCopyWithImpl<$Res, $Val extends WeekDayReleaseDto> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of WeekDayReleaseDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ Object? anime = null, + Object? platforms = null, Object? releaseDateTime = null, + Object? slug = null, Object? langType = null, - Object? platforms = null, - Object? variant = freezed, + Object? isReleased = null, + Object? isMultipleReleased = null, + Object? mappings = null, + Object? episodeType = freezed, + Object? minNumber = freezed, + Object? maxNumber = freezed, + Object? number = freezed, }) { return _then(_value.copyWith( anime: null == anime ? _value.anime : anime // ignore: cast_nullable_to_non_nullable as AnimeDto, + platforms: null == platforms + ? _value.platforms + : platforms // ignore: cast_nullable_to_non_nullable + as List, releaseDateTime: null == releaseDateTime ? _value.releaseDateTime : releaseDateTime // ignore: cast_nullable_to_non_nullable as String, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, langType: null == langType ? _value.langType : langType // ignore: cast_nullable_to_non_nullable as String, - platforms: null == platforms - ? _value.platforms - : platforms // ignore: cast_nullable_to_non_nullable - as List, - variant: freezed == variant - ? _value.variant - : variant // ignore: cast_nullable_to_non_nullable - as EpisodeVariantDto?, + isReleased: null == isReleased + ? _value.isReleased + : isReleased // ignore: cast_nullable_to_non_nullable + as bool, + isMultipleReleased: null == isMultipleReleased + ? _value.isMultipleReleased + : isMultipleReleased // ignore: cast_nullable_to_non_nullable + as bool, + mappings: null == mappings + ? _value.mappings + : mappings // ignore: cast_nullable_to_non_nullable + as List, + episodeType: freezed == episodeType + ? _value.episodeType + : episodeType // ignore: cast_nullable_to_non_nullable + as String?, + minNumber: freezed == minNumber + ? _value.minNumber + : minNumber // ignore: cast_nullable_to_non_nullable + as int?, + maxNumber: freezed == maxNumber + ? _value.maxNumber + : maxNumber // ignore: cast_nullable_to_non_nullable + as int?, + number: freezed == number + ? _value.number + : number // ignore: cast_nullable_to_non_nullable + as int?, ) as $Val); } + /// Create a copy of WeekDayReleaseDto + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $AnimeDtoCopyWith<$Res> get anime { @@ -99,18 +155,6 @@ class _$WeekDayReleaseDtoCopyWithImpl<$Res, $Val extends WeekDayReleaseDto> return _then(_value.copyWith(anime: value) as $Val); }); } - - @override - @pragma('vm:prefer-inline') - $EpisodeVariantDtoCopyWith<$Res>? get variant { - if (_value.variant == null) { - return null; - } - - return $EpisodeVariantDtoCopyWith<$Res>(_value.variant!, (value) { - return _then(_value.copyWith(variant: value) as $Val); - }); - } } /// @nodoc @@ -123,15 +167,20 @@ abstract class _$$WeekDayReleaseDtoImplCopyWith<$Res> @useResult $Res call( {AnimeDto anime, + List platforms, String releaseDateTime, + String slug, String langType, - List platforms, - EpisodeVariantDto? variant}); + bool isReleased, + bool isMultipleReleased, + List mappings, + String? episodeType, + int? minNumber, + int? maxNumber, + int? number}); @override $AnimeDtoCopyWith<$Res> get anime; - @override - $EpisodeVariantDtoCopyWith<$Res>? get variant; } /// @nodoc @@ -142,36 +191,73 @@ class __$$WeekDayReleaseDtoImplCopyWithImpl<$Res> $Res Function(_$WeekDayReleaseDtoImpl) _then) : super(_value, _then); + /// Create a copy of WeekDayReleaseDto + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ Object? anime = null, + Object? platforms = null, Object? releaseDateTime = null, + Object? slug = null, Object? langType = null, - Object? platforms = null, - Object? variant = freezed, + Object? isReleased = null, + Object? isMultipleReleased = null, + Object? mappings = null, + Object? episodeType = freezed, + Object? minNumber = freezed, + Object? maxNumber = freezed, + Object? number = freezed, }) { return _then(_$WeekDayReleaseDtoImpl( anime: null == anime ? _value.anime : anime // ignore: cast_nullable_to_non_nullable as AnimeDto, + platforms: null == platforms + ? _value._platforms + : platforms // ignore: cast_nullable_to_non_nullable + as List, releaseDateTime: null == releaseDateTime ? _value.releaseDateTime : releaseDateTime // ignore: cast_nullable_to_non_nullable as String, + slug: null == slug + ? _value.slug + : slug // ignore: cast_nullable_to_non_nullable + as String, langType: null == langType ? _value.langType : langType // ignore: cast_nullable_to_non_nullable as String, - platforms: null == platforms - ? _value._platforms - : platforms // ignore: cast_nullable_to_non_nullable - as List, - variant: freezed == variant - ? _value.variant - : variant // ignore: cast_nullable_to_non_nullable - as EpisodeVariantDto?, + isReleased: null == isReleased + ? _value.isReleased + : isReleased // ignore: cast_nullable_to_non_nullable + as bool, + isMultipleReleased: null == isMultipleReleased + ? _value.isMultipleReleased + : isMultipleReleased // ignore: cast_nullable_to_non_nullable + as bool, + mappings: null == mappings + ? _value._mappings + : mappings // ignore: cast_nullable_to_non_nullable + as List, + episodeType: freezed == episodeType + ? _value.episodeType + : episodeType // ignore: cast_nullable_to_non_nullable + as String?, + minNumber: freezed == minNumber + ? _value.minNumber + : minNumber // ignore: cast_nullable_to_non_nullable + as int?, + maxNumber: freezed == maxNumber + ? _value.maxNumber + : maxNumber // ignore: cast_nullable_to_non_nullable + as int?, + number: freezed == number + ? _value.number + : number // ignore: cast_nullable_to_non_nullable + as int?, )); } } @@ -181,21 +267,25 @@ class __$$WeekDayReleaseDtoImplCopyWithImpl<$Res> class _$WeekDayReleaseDtoImpl implements _WeekDayReleaseDto { const _$WeekDayReleaseDtoImpl( {required this.anime, + required final List platforms, required this.releaseDateTime, + required this.slug, required this.langType, - required final List platforms, - required this.variant}) - : _platforms = platforms; + required this.isReleased, + required this.isMultipleReleased, + required final List mappings, + required this.episodeType, + required this.minNumber, + required this.maxNumber, + required this.number}) + : _platforms = platforms, + _mappings = mappings; factory _$WeekDayReleaseDtoImpl.fromJson(Map json) => _$$WeekDayReleaseDtoImplFromJson(json); @override final AnimeDto anime; - @override - final String releaseDateTime; - @override - final String langType; final List _platforms; @override List get platforms { @@ -205,11 +295,35 @@ class _$WeekDayReleaseDtoImpl implements _WeekDayReleaseDto { } @override - final EpisodeVariantDto? variant; + final String releaseDateTime; + @override + final String slug; + @override + final String langType; + @override + final bool isReleased; + @override + final bool isMultipleReleased; + final List _mappings; + @override + List get mappings { + if (_mappings is EqualUnmodifiableListView) return _mappings; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_mappings); + } + + @override + final String? episodeType; + @override + final int? minNumber; + @override + final int? maxNumber; + @override + final int? number; @override String toString() { - return 'WeekDayReleaseDto(anime: $anime, releaseDateTime: $releaseDateTime, langType: $langType, platforms: $platforms, variant: $variant)'; + return 'WeekDayReleaseDto(anime: $anime, platforms: $platforms, releaseDateTime: $releaseDateTime, slug: $slug, langType: $langType, isReleased: $isReleased, isMultipleReleased: $isMultipleReleased, mappings: $mappings, episodeType: $episodeType, minNumber: $minNumber, maxNumber: $maxNumber, number: $number)'; } @override @@ -218,21 +332,47 @@ class _$WeekDayReleaseDtoImpl implements _WeekDayReleaseDto { (other.runtimeType == runtimeType && other is _$WeekDayReleaseDtoImpl && (identical(other.anime, anime) || other.anime == anime) && + const DeepCollectionEquality() + .equals(other._platforms, _platforms) && (identical(other.releaseDateTime, releaseDateTime) || other.releaseDateTime == releaseDateTime) && + (identical(other.slug, slug) || other.slug == slug) && (identical(other.langType, langType) || other.langType == langType) && - const DeepCollectionEquality() - .equals(other._platforms, _platforms) && - (identical(other.variant, variant) || other.variant == variant)); + (identical(other.isReleased, isReleased) || + other.isReleased == isReleased) && + (identical(other.isMultipleReleased, isMultipleReleased) || + other.isMultipleReleased == isMultipleReleased) && + const DeepCollectionEquality().equals(other._mappings, _mappings) && + (identical(other.episodeType, episodeType) || + other.episodeType == episodeType) && + (identical(other.minNumber, minNumber) || + other.minNumber == minNumber) && + (identical(other.maxNumber, maxNumber) || + other.maxNumber == maxNumber) && + (identical(other.number, number) || other.number == number)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash(runtimeType, anime, releaseDateTime, langType, - const DeepCollectionEquality().hash(_platforms), variant); + int get hashCode => Object.hash( + runtimeType, + anime, + const DeepCollectionEquality().hash(_platforms), + releaseDateTime, + slug, + langType, + isReleased, + isMultipleReleased, + const DeepCollectionEquality().hash(_mappings), + episodeType, + minNumber, + maxNumber, + number); - @JsonKey(ignore: true) + /// Create a copy of WeekDayReleaseDto + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$WeekDayReleaseDtoImplCopyWith<_$WeekDayReleaseDtoImpl> get copyWith => @@ -250,10 +390,17 @@ class _$WeekDayReleaseDtoImpl implements _WeekDayReleaseDto { abstract class _WeekDayReleaseDto implements WeekDayReleaseDto { const factory _WeekDayReleaseDto( {required final AnimeDto anime, + required final List platforms, required final String releaseDateTime, + required final String slug, required final String langType, - required final List platforms, - required final EpisodeVariantDto? variant}) = _$WeekDayReleaseDtoImpl; + required final bool isReleased, + required final bool isMultipleReleased, + required final List mappings, + required final String? episodeType, + required final int? minNumber, + required final int? maxNumber, + required final int? number}) = _$WeekDayReleaseDtoImpl; factory _WeekDayReleaseDto.fromJson(Map json) = _$WeekDayReleaseDtoImpl.fromJson; @@ -261,15 +408,32 @@ abstract class _WeekDayReleaseDto implements WeekDayReleaseDto { @override AnimeDto get anime; @override + List get platforms; + @override String get releaseDateTime; @override + String get slug; + @override String get langType; @override - List get platforms; + bool get isReleased; + @override + bool get isMultipleReleased; + @override + List get mappings; @override - EpisodeVariantDto? get variant; + String? get episodeType; + @override + int? get minNumber; + @override + int? get maxNumber; + @override + int? get number; + + /// Create a copy of WeekDayReleaseDto + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$WeekDayReleaseDtoImplCopyWith<_$WeekDayReleaseDtoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/dtos/week_day_release_dto.g.dart b/lib/dtos/week_day_release_dto.g.dart index 35bfcc7..afc1341 100644 --- a/lib/dtos/week_day_release_dto.g.dart +++ b/lib/dtos/week_day_release_dto.g.dart @@ -10,22 +10,35 @@ _$WeekDayReleaseDtoImpl _$$WeekDayReleaseDtoImplFromJson( Map json) => _$WeekDayReleaseDtoImpl( anime: AnimeDto.fromJson(json['anime'] as Map), - releaseDateTime: json['releaseDateTime'] as String, - langType: json['langType'] as String, platforms: (json['platforms'] as List) .map((e) => PlatformDto.fromJson(e as Map)) .toList(), - variant: json['variant'] == null - ? null - : EpisodeVariantDto.fromJson(json['variant'] as Map), + releaseDateTime: json['releaseDateTime'] as String, + slug: json['slug'] as String, + langType: json['langType'] as String, + isReleased: json['isReleased'] as bool, + isMultipleReleased: json['isMultipleReleased'] as bool, + mappings: + (json['mappings'] as List).map((e) => e as String).toList(), + episodeType: json['episodeType'] as String?, + minNumber: (json['minNumber'] as num?)?.toInt(), + maxNumber: (json['maxNumber'] as num?)?.toInt(), + number: (json['number'] as num?)?.toInt(), ); Map _$$WeekDayReleaseDtoImplToJson( _$WeekDayReleaseDtoImpl instance) => { 'anime': instance.anime, + 'platforms': instance.platforms, 'releaseDateTime': instance.releaseDateTime, + 'slug': instance.slug, 'langType': instance.langType, - 'platforms': instance.platforms, - 'variant': instance.variant, + 'isReleased': instance.isReleased, + 'isMultipleReleased': instance.isMultipleReleased, + 'mappings': instance.mappings, + 'episodeType': instance.episodeType, + 'minNumber': instance.minNumber, + 'maxNumber': instance.maxNumber, + 'number': instance.number, }; diff --git a/lib/views/anime_details_view.dart b/lib/views/anime_details_view.dart index 7e1bb0e..44c7811 100644 --- a/lib/views/anime_details_view.dart +++ b/lib/views/anime_details_view.dart @@ -34,9 +34,9 @@ class _AnimeDetailsViewState extends State { AnimeDetailsController.instance.anime = widget.anime; if (SortController.instance.sortType == SortType.oldest) { - AnimeDetailsController.instance.season = widget.anime.seasons.first; + AnimeDetailsController.instance.season = widget.anime.seasons?.first; } else { - AnimeDetailsController.instance.season = widget.anime.seasons.last; + AnimeDetailsController.instance.season = widget.anime.seasons?.last; } WidgetsBinding.instance.addPostFrameCallback((_) { @@ -148,8 +148,9 @@ class _AnimeDetailsViewState extends State { WatchlistButton(anime: widget.anime), ], ), - for (final langType in widget.anime.langTypes) - LangTypeComponent(langType: langType), + if (widget.anime.langTypes != null) + for (final langType in widget.anime.langTypes!) + LangTypeComponent(langType: langType), Padding( padding: const EdgeInsets.symmetric(vertical: 8), child: Text.rich( @@ -182,27 +183,28 @@ class _AnimeDetailsViewState extends State { ), Row( children: [ - ElevatedDropdownButton( - globalKey: GlobalKey(), - value: AnimeDetailsController.instance.season, - items: [ - for (final season in widget.anime.seasons) - ElevatedPopupMenuItem( - value: season, - child: Text( - AppLocalizations.of(context)!.season( - season.number, + if (widget.anime.seasons != null) + ElevatedDropdownButton( + globalKey: GlobalKey(), + value: AnimeDetailsController.instance.season, + items: [ + for (final season in widget.anime.seasons!) + ElevatedPopupMenuItem( + value: season, + child: Text( + AppLocalizations.of(context)!.season( + season.number, + ), ), ), - ), - ], - onChanged: (value) { - setState(() { - AnimeDetailsController.instance.season = value; - AnimeDetailsController.instance.refresh(); - }); - }, - ), + ], + onChanged: (value) { + setState(() { + AnimeDetailsController.instance.season = value; + AnimeDetailsController.instance.refresh(); + }); + }, + ), const Spacer(), ElevatedDropdownButton( globalKey: GlobalKey(), diff --git a/pubspec.lock b/pubspec.lock index 7c45fe4..4a1a7cb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -747,6 +747,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" + palette_generator: + dependency: "direct main" + description: + name: palette_generator + sha256: d50fbcd69abb80c5baec66d700033b1a320108b1aa17a5961866a12c0abb7c0c + url: "https://pub.dev" + source: hosted + version: "0.3.3+4" path: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 803d34b..52dec30 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,6 +23,7 @@ dependencies: intl: any json_annotation: ^4.9.0 like_button: ^2.0.5 + palette_generator: ^0.3.3+4 restart_app: git: url: https://github.com/Shikkanime/restart_app.git