Compare commits

..
8 Commits
26 changed files with 1335 additions and 1319 deletions

No files matched your search

+691 -1171
View File
File diff suppressed because it is too large. Load diff
+4
View File
@@ -1,4 +1,5 @@
import 'package:anitrack/src/data/data_base.dart'; import 'package:anitrack/src/data/data_base.dart';
import 'package:anitrack/src/data/other_titles.dart';
import 'package:anitrack/src/data/source.dart'; import 'package:anitrack/src/data/source.dart';
import 'package:anitrack/src/data/type.dart'; import 'package:anitrack/src/data/type.dart';
import 'package:anitrack/src/service/database.dart'; import 'package:anitrack/src/service/database.dart';
@@ -47,6 +48,9 @@ abstract class AnimeTrackingData
/// The day of the week the anime is airing /// The day of the week the anime is airing
String? broadcastDay, String? broadcastDay,
/// Other titles
@OtherTitlesConverter() OtherTitles otherTitles,
/// The source where we got the data from. /// The source where we got the data from.
@TrackingDataSourceConverter() TrackingDataSource source, @TrackingDataSourceConverter() TrackingDataSource source,
) = _AnimeTrackingData; ) = _AnimeTrackingData;
+45 -22
View File
@@ -23,7 +23,8 @@ mixin _$AnimeTrackingData {
int? get episodesTotal;/// URL to the thumbnail/cover art for the anime. int? get episodesTotal;/// URL to the thumbnail/cover art for the anime.
String get thumbnailUrl;/// Flag whether the anime is airing String get thumbnailUrl;/// Flag whether the anime is airing
@BoolConverter() bool get airing;/// The day of the week the anime is airing @BoolConverter() bool get airing;/// The day of the week the anime is airing
String? get broadcastDay;/// The source where we got the data from. String? get broadcastDay;/// Other titles
@OtherTitlesConverter() OtherTitles get otherTitles;/// The source where we got the data from.
@TrackingDataSourceConverter() TrackingDataSource get source; @TrackingDataSourceConverter() TrackingDataSource get source;
/// Create a copy of AnimeTrackingData /// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@@ -37,16 +38,16 @@ $AnimeTrackingDataCopyWith<AnimeTrackingData> get copyWith => _$AnimeTrackingDat
@override @override
bool operator ==(Object other) { 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)&&(identical(other.source, source) || other.source == source)); 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)&&(identical(other.otherTitles, otherTitles) || other.otherTitles == otherTitles)&&(identical(other.source, source) || other.source == source));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,id,state,title,episodesWatched,episodesTotal,thumbnailUrl,airing,broadcastDay,source); int get hashCode => Object.hash(runtimeType,id,state,title,episodesWatched,episodesTotal,thumbnailUrl,airing,broadcastDay,otherTitles,source);
@override @override
String toString() { String toString() {
return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay, source: $source)'; return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay, otherTitles: $otherTitles, source: $source)';
} }
@@ -57,11 +58,11 @@ abstract mixin class $AnimeTrackingDataCopyWith<$Res> {
factory $AnimeTrackingDataCopyWith(AnimeTrackingData value, $Res Function(AnimeTrackingData) _then) = _$AnimeTrackingDataCopyWithImpl; factory $AnimeTrackingDataCopyWith(AnimeTrackingData value, $Res Function(AnimeTrackingData) _then) = _$AnimeTrackingDataCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl,@BoolConverter() bool airing, String? broadcastDay,@TrackingDataSourceConverter() TrackingDataSource source String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl,@BoolConverter() bool airing, String? broadcastDay,@OtherTitlesConverter() OtherTitles otherTitles,@TrackingDataSourceConverter() TrackingDataSource source
}); });
$OtherTitlesCopyWith<$Res> get otherTitles;
} }
/// @nodoc /// @nodoc
@@ -74,7 +75,7 @@ class _$AnimeTrackingDataCopyWithImpl<$Res>
/// Create a copy of AnimeTrackingData /// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @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,Object? source = null,}) { @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,Object? otherTitles = null,Object? source = null,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable 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 String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
@@ -84,11 +85,21 @@ as int,episodesTotal: freezed == episodesTotal ? _self.episodesTotal : episodesT
as int?,thumbnailUrl: null == thumbnailUrl ? _self.thumbnailUrl : thumbnailUrl // 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 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 bool,broadcastDay: freezed == broadcastDay ? _self.broadcastDay : broadcastDay // ignore: cast_nullable_to_non_nullable
as String?,source: null == source ? _self.source : source // ignore: cast_nullable_to_non_nullable as String?,otherTitles: null == otherTitles ? _self.otherTitles : otherTitles // ignore: cast_nullable_to_non_nullable
as OtherTitles,source: null == source ? _self.source : source // ignore: cast_nullable_to_non_nullable
as TrackingDataSource, as TrackingDataSource,
)); ));
} }
/// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OtherTitlesCopyWith<$Res> get otherTitles {
return $OtherTitlesCopyWith<$Res>(_self.otherTitles, (value) {
return _then(_self.copyWith(otherTitles: value));
});
}
} }
@@ -170,10 +181,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl, @BoolConverter() bool airing, String? broadcastDay, @TrackingDataSourceConverter() TrackingDataSource source)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl, @BoolConverter() bool airing, String? broadcastDay, @OtherTitlesConverter() OtherTitles otherTitles, @TrackingDataSourceConverter() TrackingDataSource source)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _AnimeTrackingData() when $default != null: case _AnimeTrackingData() when $default != null:
return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay,_that.source);case _: return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay,_that.otherTitles,_that.source);case _:
return orElse(); return orElse();
} }
@@ -191,10 +202,10 @@ return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.epi
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl, @BoolConverter() bool airing, String? broadcastDay, @TrackingDataSourceConverter() TrackingDataSource source) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl, @BoolConverter() bool airing, String? broadcastDay, @OtherTitlesConverter() OtherTitles otherTitles, @TrackingDataSourceConverter() TrackingDataSource source) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _AnimeTrackingData(): case _AnimeTrackingData():
return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay,_that.source);case _: return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay,_that.otherTitles,_that.source);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -211,10 +222,10 @@ return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.epi
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl, @BoolConverter() bool airing, String? broadcastDay, @TrackingDataSourceConverter() TrackingDataSource source)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl, @BoolConverter() bool airing, String? broadcastDay, @OtherTitlesConverter() OtherTitles otherTitles, @TrackingDataSourceConverter() TrackingDataSource source)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _AnimeTrackingData() when $default != null: case _AnimeTrackingData() when $default != null:
return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay,_that.source);case _: return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.episodesTotal,_that.thumbnailUrl,_that.airing,_that.broadcastDay,_that.otherTitles,_that.source);case _:
return null; return null;
} }
@@ -226,7 +237,7 @@ return $default(_that.id,_that.state,_that.title,_that.episodesWatched,_that.epi
@JsonSerializable() @JsonSerializable()
class _AnimeTrackingData extends AnimeTrackingData { class _AnimeTrackingData extends AnimeTrackingData {
_AnimeTrackingData(this.id, @MediumTrackingStateConverter() this.state, this.title, this.episodesWatched, this.episodesTotal, this.thumbnailUrl, @BoolConverter() this.airing, this.broadcastDay, @TrackingDataSourceConverter() this.source): super._(); _AnimeTrackingData(this.id, @MediumTrackingStateConverter() this.state, this.title, this.episodesWatched, this.episodesTotal, this.thumbnailUrl, @BoolConverter() this.airing, this.broadcastDay, @OtherTitlesConverter() this.otherTitles, @TrackingDataSourceConverter() this.source): super._();
factory _AnimeTrackingData.fromJson(Map<String, dynamic> json) => _$AnimeTrackingDataFromJson(json); factory _AnimeTrackingData.fromJson(Map<String, dynamic> json) => _$AnimeTrackingDataFromJson(json);
/// The ID of the anime /// The ID of the anime
@@ -245,6 +256,8 @@ class _AnimeTrackingData extends AnimeTrackingData {
@override@BoolConverter() final bool airing; @override@BoolConverter() final bool airing;
/// The day of the week the anime is airing /// The day of the week the anime is airing
@override final String? broadcastDay; @override final String? broadcastDay;
/// Other titles
@override@OtherTitlesConverter() final OtherTitles otherTitles;
/// The source where we got the data from. /// The source where we got the data from.
@override@TrackingDataSourceConverter() final TrackingDataSource source; @override@TrackingDataSourceConverter() final TrackingDataSource source;
@@ -261,16 +274,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { 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)&&(identical(other.source, source) || other.source == source)); 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)&&(identical(other.otherTitles, otherTitles) || other.otherTitles == otherTitles)&&(identical(other.source, source) || other.source == source));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,id,state,title,episodesWatched,episodesTotal,thumbnailUrl,airing,broadcastDay,source); int get hashCode => Object.hash(runtimeType,id,state,title,episodesWatched,episodesTotal,thumbnailUrl,airing,broadcastDay,otherTitles,source);
@override @override
String toString() { String toString() {
return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay, source: $source)'; return 'AnimeTrackingData(id: $id, state: $state, title: $title, episodesWatched: $episodesWatched, episodesTotal: $episodesTotal, thumbnailUrl: $thumbnailUrl, airing: $airing, broadcastDay: $broadcastDay, otherTitles: $otherTitles, source: $source)';
} }
@@ -281,11 +294,11 @@ abstract mixin class _$AnimeTrackingDataCopyWith<$Res> implements $AnimeTracking
factory _$AnimeTrackingDataCopyWith(_AnimeTrackingData value, $Res Function(_AnimeTrackingData) _then) = __$AnimeTrackingDataCopyWithImpl; factory _$AnimeTrackingDataCopyWith(_AnimeTrackingData value, $Res Function(_AnimeTrackingData) _then) = __$AnimeTrackingDataCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl,@BoolConverter() bool airing, String? broadcastDay,@TrackingDataSourceConverter() TrackingDataSource source String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int episodesWatched, int? episodesTotal, String thumbnailUrl,@BoolConverter() bool airing, String? broadcastDay,@OtherTitlesConverter() OtherTitles otherTitles,@TrackingDataSourceConverter() TrackingDataSource source
}); });
@override $OtherTitlesCopyWith<$Res> get otherTitles;
} }
/// @nodoc /// @nodoc
@@ -298,7 +311,7 @@ class __$AnimeTrackingDataCopyWithImpl<$Res>
/// Create a copy of AnimeTrackingData /// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @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,Object? source = null,}) { @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,Object? otherTitles = null,Object? source = null,}) {
return _then(_AnimeTrackingData( return _then(_AnimeTrackingData(
null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable 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 String,null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
@@ -308,12 +321,22 @@ as int,freezed == episodesTotal ? _self.episodesTotal : episodesTotal // ignore:
as int?,null == thumbnailUrl ? _self.thumbnailUrl : thumbnailUrl // 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 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 bool,freezed == broadcastDay ? _self.broadcastDay : broadcastDay // ignore: cast_nullable_to_non_nullable
as String?,null == source ? _self.source : source // ignore: cast_nullable_to_non_nullable as String?,null == otherTitles ? _self.otherTitles : otherTitles // ignore: cast_nullable_to_non_nullable
as OtherTitles,null == source ? _self.source : source // ignore: cast_nullable_to_non_nullable
as TrackingDataSource, as TrackingDataSource,
)); ));
} }
/// Create a copy of AnimeTrackingData
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OtherTitlesCopyWith<$Res> get otherTitles {
return $OtherTitlesCopyWith<$Res>(_self.otherTitles, (value) {
return _then(_self.copyWith(otherTitles: value));
});
}
} }
// dart format on // dart format on
+2
View File
@@ -18,6 +18,7 @@ _AnimeTrackingData _$AnimeTrackingDataFromJson(Map<String, dynamic> json) =>
json['thumbnailUrl'] as String, json['thumbnailUrl'] as String,
const BoolConverter().fromJson((json['airing'] as num).toInt()), const BoolConverter().fromJson((json['airing'] as num).toInt()),
json['broadcastDay'] as String?, json['broadcastDay'] as String?,
const OtherTitlesConverter().fromJson(json['otherTitles'] as String),
const TrackingDataSourceConverter().fromJson(json['source'] as String), const TrackingDataSourceConverter().fromJson(json['source'] as String),
); );
@@ -31,5 +32,6 @@ Map<String, dynamic> _$AnimeTrackingDataToJson(_AnimeTrackingData instance) =>
'thumbnailUrl': instance.thumbnailUrl, 'thumbnailUrl': instance.thumbnailUrl,
'airing': const BoolConverter().toJson(instance.airing), 'airing': const BoolConverter().toJson(instance.airing),
'broadcastDay': instance.broadcastDay, 'broadcastDay': instance.broadcastDay,
'otherTitles': const OtherTitlesConverter().toJson(instance.otherTitles),
'source': const TrackingDataSourceConverter().toJson(instance.source), 'source': const TrackingDataSourceConverter().toJson(instance.source),
}; };
+4
View File
@@ -1,4 +1,5 @@
import 'package:anitrack/src/data/data_base.dart'; import 'package:anitrack/src/data/data_base.dart';
import 'package:anitrack/src/data/other_titles.dart';
import 'package:anitrack/src/data/source.dart'; import 'package:anitrack/src/data/source.dart';
import 'package:anitrack/src/data/type.dart'; import 'package:anitrack/src/data/type.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
@@ -33,6 +34,9 @@ abstract class MangaTrackingData
/// URL to the thumbnail/cover art for the manga. /// URL to the thumbnail/cover art for the manga.
String thumbnailUrl, String thumbnailUrl,
/// Other titles the manga can have.
@OtherTitlesConverter() OtherTitles otherTitles,
/// The source where we got the data from. /// The source where we got the data from.
@TrackingDataSourceConverter() TrackingDataSource source, @TrackingDataSourceConverter() TrackingDataSource source,
) = _MangaTrackingData; ) = _MangaTrackingData;
+45 -22
View File
@@ -22,7 +22,8 @@ mixin _$MangaTrackingData {
int get chaptersRead;/// Chapters read. int get chaptersRead;/// Chapters read.
int get volumesOwned;/// Episodes watched. int get volumesOwned;/// Episodes watched.
int? get chaptersTotal;/// URL to the thumbnail/cover art for the manga. int? get chaptersTotal;/// URL to the thumbnail/cover art for the manga.
String get thumbnailUrl;/// The source where we got the data from. String get thumbnailUrl;/// Other titles the manga can have.
@OtherTitlesConverter() OtherTitles get otherTitles;/// The source where we got the data from.
@TrackingDataSourceConverter() TrackingDataSource get source; @TrackingDataSourceConverter() TrackingDataSource get source;
/// Create a copy of MangaTrackingData /// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@@ -36,16 +37,16 @@ $MangaTrackingDataCopyWith<MangaTrackingData> get copyWith => _$MangaTrackingDat
@override @override
bool operator ==(Object other) { 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)&&(identical(other.source, source) || other.source == source)); 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)&&(identical(other.otherTitles, otherTitles) || other.otherTitles == otherTitles)&&(identical(other.source, source) || other.source == source));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,id,state,title,chaptersRead,volumesOwned,chaptersTotal,thumbnailUrl,source); int get hashCode => Object.hash(runtimeType,id,state,title,chaptersRead,volumesOwned,chaptersTotal,thumbnailUrl,otherTitles,source);
@override @override
String toString() { String toString() {
return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl, source: $source)'; return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl, otherTitles: $otherTitles, source: $source)';
} }
@@ -56,11 +57,11 @@ abstract mixin class $MangaTrackingDataCopyWith<$Res> {
factory $MangaTrackingDataCopyWith(MangaTrackingData value, $Res Function(MangaTrackingData) _then) = _$MangaTrackingDataCopyWithImpl; factory $MangaTrackingDataCopyWith(MangaTrackingData value, $Res Function(MangaTrackingData) _then) = _$MangaTrackingDataCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl,@TrackingDataSourceConverter() TrackingDataSource source String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl,@OtherTitlesConverter() OtherTitles otherTitles,@TrackingDataSourceConverter() TrackingDataSource source
}); });
$OtherTitlesCopyWith<$Res> get otherTitles;
} }
/// @nodoc /// @nodoc
@@ -73,7 +74,7 @@ class _$MangaTrackingDataCopyWithImpl<$Res>
/// Create a copy of MangaTrackingData /// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? state = null,Object? title = null,Object? chaptersRead = null,Object? volumesOwned = null,Object? chaptersTotal = freezed,Object? thumbnailUrl = null,Object? source = null,}) { @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,Object? otherTitles = null,Object? source = null,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable 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 String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
@@ -82,11 +83,21 @@ as String,chaptersRead: null == chaptersRead ? _self.chaptersRead : chaptersRead
as int,volumesOwned: null == volumesOwned ? _self.volumesOwned : volumesOwned // 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,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 int?,thumbnailUrl: null == thumbnailUrl ? _self.thumbnailUrl : thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,source: null == source ? _self.source : source // ignore: cast_nullable_to_non_nullable as String,otherTitles: null == otherTitles ? _self.otherTitles : otherTitles // ignore: cast_nullable_to_non_nullable
as OtherTitles,source: null == source ? _self.source : source // ignore: cast_nullable_to_non_nullable
as TrackingDataSource, as TrackingDataSource,
)); ));
} }
/// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OtherTitlesCopyWith<$Res> get otherTitles {
return $OtherTitlesCopyWith<$Res>(_self.otherTitles, (value) {
return _then(_self.copyWith(otherTitles: value));
});
}
} }
@@ -168,10 +179,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl, @TrackingDataSourceConverter() TrackingDataSource source)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl, @OtherTitlesConverter() OtherTitles otherTitles, @TrackingDataSourceConverter() TrackingDataSource source)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _MangaTrackingData() when $default != null: case _MangaTrackingData() when $default != null:
return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl,_that.source);case _: return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl,_that.otherTitles,_that.source);case _:
return orElse(); return orElse();
} }
@@ -189,10 +200,10 @@ return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volume
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl, @TrackingDataSourceConverter() TrackingDataSource source) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl, @OtherTitlesConverter() OtherTitles otherTitles, @TrackingDataSourceConverter() TrackingDataSource source) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _MangaTrackingData(): case _MangaTrackingData():
return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl,_that.source);case _: return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl,_that.otherTitles,_that.source);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -209,10 +220,10 @@ return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volume
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl, @TrackingDataSourceConverter() TrackingDataSource source)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, @MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl, @OtherTitlesConverter() OtherTitles otherTitles, @TrackingDataSourceConverter() TrackingDataSource source)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _MangaTrackingData() when $default != null: case _MangaTrackingData() when $default != null:
return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl,_that.source);case _: return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volumesOwned,_that.chaptersTotal,_that.thumbnailUrl,_that.otherTitles,_that.source);case _:
return null; return null;
} }
@@ -224,7 +235,7 @@ return $default(_that.id,_that.state,_that.title,_that.chaptersRead,_that.volume
@JsonSerializable() @JsonSerializable()
class _MangaTrackingData extends MangaTrackingData { class _MangaTrackingData extends MangaTrackingData {
_MangaTrackingData(this.id, @MediumTrackingStateConverter() this.state, this.title, this.chaptersRead, this.volumesOwned, this.chaptersTotal, this.thumbnailUrl, @TrackingDataSourceConverter() this.source): super._(); _MangaTrackingData(this.id, @MediumTrackingStateConverter() this.state, this.title, this.chaptersRead, this.volumesOwned, this.chaptersTotal, this.thumbnailUrl, @OtherTitlesConverter() this.otherTitles, @TrackingDataSourceConverter() this.source): super._();
factory _MangaTrackingData.fromJson(Map<String, dynamic> json) => _$MangaTrackingDataFromJson(json); factory _MangaTrackingData.fromJson(Map<String, dynamic> json) => _$MangaTrackingDataFromJson(json);
/// The ID of the manga /// The ID of the manga
@@ -241,6 +252,8 @@ class _MangaTrackingData extends MangaTrackingData {
@override final int? chaptersTotal; @override final int? chaptersTotal;
/// URL to the thumbnail/cover art for the manga. /// URL to the thumbnail/cover art for the manga.
@override final String thumbnailUrl; @override final String thumbnailUrl;
/// Other titles the manga can have.
@override@OtherTitlesConverter() final OtherTitles otherTitles;
/// The source where we got the data from. /// The source where we got the data from.
@override@TrackingDataSourceConverter() final TrackingDataSource source; @override@TrackingDataSourceConverter() final TrackingDataSource source;
@@ -257,16 +270,16 @@ Map<String, dynamic> toJson() {
@override @override
bool operator ==(Object other) { 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)&&(identical(other.source, source) || other.source == source)); 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)&&(identical(other.otherTitles, otherTitles) || other.otherTitles == otherTitles)&&(identical(other.source, source) || other.source == source));
} }
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@override @override
int get hashCode => Object.hash(runtimeType,id,state,title,chaptersRead,volumesOwned,chaptersTotal,thumbnailUrl,source); int get hashCode => Object.hash(runtimeType,id,state,title,chaptersRead,volumesOwned,chaptersTotal,thumbnailUrl,otherTitles,source);
@override @override
String toString() { String toString() {
return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl, source: $source)'; return 'MangaTrackingData(id: $id, state: $state, title: $title, chaptersRead: $chaptersRead, volumesOwned: $volumesOwned, chaptersTotal: $chaptersTotal, thumbnailUrl: $thumbnailUrl, otherTitles: $otherTitles, source: $source)';
} }
@@ -277,11 +290,11 @@ abstract mixin class _$MangaTrackingDataCopyWith<$Res> implements $MangaTracking
factory _$MangaTrackingDataCopyWith(_MangaTrackingData value, $Res Function(_MangaTrackingData) _then) = __$MangaTrackingDataCopyWithImpl; factory _$MangaTrackingDataCopyWith(_MangaTrackingData value, $Res Function(_MangaTrackingData) _then) = __$MangaTrackingDataCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl,@TrackingDataSourceConverter() TrackingDataSource source String id,@MediumTrackingStateConverter() MediumTrackingState state, String title, int chaptersRead, int volumesOwned, int? chaptersTotal, String thumbnailUrl,@OtherTitlesConverter() OtherTitles otherTitles,@TrackingDataSourceConverter() TrackingDataSource source
}); });
@override $OtherTitlesCopyWith<$Res> get otherTitles;
} }
/// @nodoc /// @nodoc
@@ -294,7 +307,7 @@ class __$MangaTrackingDataCopyWithImpl<$Res>
/// Create a copy of MangaTrackingData /// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @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,Object? source = null,}) { @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,Object? otherTitles = null,Object? source = null,}) {
return _then(_MangaTrackingData( return _then(_MangaTrackingData(
null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable 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 String,null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
@@ -303,12 +316,22 @@ as String,null == chaptersRead ? _self.chaptersRead : chaptersRead // ignore: ca
as int,null == volumesOwned ? _self.volumesOwned : volumesOwned // 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,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 int?,null == thumbnailUrl ? _self.thumbnailUrl : thumbnailUrl // ignore: cast_nullable_to_non_nullable
as String,null == source ? _self.source : source // ignore: cast_nullable_to_non_nullable as String,null == otherTitles ? _self.otherTitles : otherTitles // ignore: cast_nullable_to_non_nullable
as OtherTitles,null == source ? _self.source : source // ignore: cast_nullable_to_non_nullable
as TrackingDataSource, as TrackingDataSource,
)); ));
} }
/// Create a copy of MangaTrackingData
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OtherTitlesCopyWith<$Res> get otherTitles {
return $OtherTitlesCopyWith<$Res>(_self.otherTitles, (value) {
return _then(_self.copyWith(otherTitles: value));
});
}
} }
// dart format on // dart format on
+2
View File
@@ -17,6 +17,7 @@ _MangaTrackingData _$MangaTrackingDataFromJson(Map<String, dynamic> json) =>
(json['volumesOwned'] as num).toInt(), (json['volumesOwned'] as num).toInt(),
(json['chaptersTotal'] as num?)?.toInt(), (json['chaptersTotal'] as num?)?.toInt(),
json['thumbnailUrl'] as String, json['thumbnailUrl'] as String,
const OtherTitlesConverter().fromJson(json['otherTitles'] as String),
const TrackingDataSourceConverter().fromJson(json['source'] as String), const TrackingDataSourceConverter().fromJson(json['source'] as String),
); );
@@ -29,5 +30,6 @@ Map<String, dynamic> _$MangaTrackingDataToJson(_MangaTrackingData instance) =>
'volumesOwned': instance.volumesOwned, 'volumesOwned': instance.volumesOwned,
'chaptersTotal': instance.chaptersTotal, 'chaptersTotal': instance.chaptersTotal,
'thumbnailUrl': instance.thumbnailUrl, 'thumbnailUrl': instance.thumbnailUrl,
'otherTitles': const OtherTitlesConverter().toJson(instance.otherTitles),
'source': const TrackingDataSourceConverter().toJson(instance.source), 'source': const TrackingDataSourceConverter().toJson(instance.source),
}; };
+30
View File
@@ -0,0 +1,30 @@
import 'dart:convert';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'other_titles.freezed.dart';
part 'other_titles.g.dart';
class OtherTitlesConverter implements JsonConverter<OtherTitles, String> {
const OtherTitlesConverter();
@override
OtherTitles fromJson(String json) =>
OtherTitles.fromJson(jsonDecode(json) as Map<String, dynamic>);
@override
String toJson(OtherTitles object) => jsonEncode(object.toJson());
}
@freezed
abstract class OtherTitles with _$OtherTitles {
factory OtherTitles({
String? english,
String? japanese,
@Default([]) List<String> others,
}) = _OtherTitles;
/// JSON
factory OtherTitles.fromJson(Map<String, dynamic> json) =>
_$OtherTitlesFromJson(json);
}
+289
View File
@@ -0,0 +1,289 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'other_titles.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$OtherTitles {
String? get english; String? get japanese; List<String> get others;
/// Create a copy of OtherTitles
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$OtherTitlesCopyWith<OtherTitles> get copyWith => _$OtherTitlesCopyWithImpl<OtherTitles>(this as OtherTitles, _$identity);
/// Serializes this OtherTitles to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is OtherTitles&&(identical(other.english, english) || other.english == english)&&(identical(other.japanese, japanese) || other.japanese == japanese)&&const DeepCollectionEquality().equals(other.others, others));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,english,japanese,const DeepCollectionEquality().hash(others));
@override
String toString() {
return 'OtherTitles(english: $english, japanese: $japanese, others: $others)';
}
}
/// @nodoc
abstract mixin class $OtherTitlesCopyWith<$Res> {
factory $OtherTitlesCopyWith(OtherTitles value, $Res Function(OtherTitles) _then) = _$OtherTitlesCopyWithImpl;
@useResult
$Res call({
String? english, String? japanese, List<String> others
});
}
/// @nodoc
class _$OtherTitlesCopyWithImpl<$Res>
implements $OtherTitlesCopyWith<$Res> {
_$OtherTitlesCopyWithImpl(this._self, this._then);
final OtherTitles _self;
final $Res Function(OtherTitles) _then;
/// Create a copy of OtherTitles
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? english = freezed,Object? japanese = freezed,Object? others = null,}) {
return _then(_self.copyWith(
english: freezed == english ? _self.english : english // ignore: cast_nullable_to_non_nullable
as String?,japanese: freezed == japanese ? _self.japanese : japanese // ignore: cast_nullable_to_non_nullable
as String?,others: null == others ? _self.others : others // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// Adds pattern-matching-related methods to [OtherTitles].
extension OtherTitlesPatterns on OtherTitles {
/// 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 extends Object?>(TResult Function( _OtherTitles value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _OtherTitles() 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 ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _OtherTitles value) $default,){
final _that = this;
switch (_that) {
case _OtherTitles():
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;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _OtherTitles value)? $default,){
final _that = this;
switch (_that) {
case _OtherTitles() 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();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? english, String? japanese, List<String> others)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _OtherTitles() when $default != null:
return $default(_that.english,_that.japanese,_that.others);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 ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? english, String? japanese, List<String> others) $default,) {final _that = this;
switch (_that) {
case _OtherTitles():
return $default(_that.english,_that.japanese,_that.others);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;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? english, String? japanese, List<String> others)? $default,) {final _that = this;
switch (_that) {
case _OtherTitles() when $default != null:
return $default(_that.english,_that.japanese,_that.others);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _OtherTitles implements OtherTitles {
_OtherTitles({this.english, this.japanese, final List<String> others = const []}): _others = others;
factory _OtherTitles.fromJson(Map<String, dynamic> json) => _$OtherTitlesFromJson(json);
@override final String? english;
@override final String? japanese;
final List<String> _others;
@override@JsonKey() List<String> get others {
if (_others is EqualUnmodifiableListView) return _others;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_others);
}
/// Create a copy of OtherTitles
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$OtherTitlesCopyWith<_OtherTitles> get copyWith => __$OtherTitlesCopyWithImpl<_OtherTitles>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$OtherTitlesToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _OtherTitles&&(identical(other.english, english) || other.english == english)&&(identical(other.japanese, japanese) || other.japanese == japanese)&&const DeepCollectionEquality().equals(other._others, _others));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,english,japanese,const DeepCollectionEquality().hash(_others));
@override
String toString() {
return 'OtherTitles(english: $english, japanese: $japanese, others: $others)';
}
}
/// @nodoc
abstract mixin class _$OtherTitlesCopyWith<$Res> implements $OtherTitlesCopyWith<$Res> {
factory _$OtherTitlesCopyWith(_OtherTitles value, $Res Function(_OtherTitles) _then) = __$OtherTitlesCopyWithImpl;
@override @useResult
$Res call({
String? english, String? japanese, List<String> others
});
}
/// @nodoc
class __$OtherTitlesCopyWithImpl<$Res>
implements _$OtherTitlesCopyWith<$Res> {
__$OtherTitlesCopyWithImpl(this._self, this._then);
final _OtherTitles _self;
final $Res Function(_OtherTitles) _then;
/// Create a copy of OtherTitles
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? english = freezed,Object? japanese = freezed,Object? others = null,}) {
return _then(_OtherTitles(
english: freezed == english ? _self.english : english // ignore: cast_nullable_to_non_nullable
as String?,japanese: freezed == japanese ? _self.japanese : japanese // ignore: cast_nullable_to_non_nullable
as String?,others: null == others ? _self._others : others // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
// dart format on
+22
View File
@@ -0,0 +1,22 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'other_titles.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_OtherTitles _$OtherTitlesFromJson(Map<String, dynamic> json) => _OtherTitles(
english: json['english'] as String?,
japanese: json['japanese'] as String?,
others:
(json['others'] as List<dynamic>?)?.map((e) => e as String).toList() ??
const [],
);
Map<String, dynamic> _$OtherTitlesToJson(_OtherTitles instance) =>
<String, dynamic>{
'english': instance.english,
'japanese': instance.japanese,
'others': instance.others,
};
+8
View File
@@ -1,6 +1,8 @@
class SearchResult { class SearchResult {
const SearchResult( const SearchResult(
this.title, this.title,
this.titleEnglish,
this.titleJapanese,
this.id, this.id,
this.total, this.total,
this.thumbnailUrl, this.thumbnailUrl,
@@ -12,6 +14,12 @@ class SearchResult {
/// The title of the anime. /// The title of the anime.
final String title; final String title;
/// The English title.
final String? titleEnglish;
/// The original Japanese title.
final String? titleJapanese;
/// The id of the anime. /// The id of the anime.
final String id; final String id;
+2 -2
View File
@@ -16,7 +16,7 @@ class AniListClient {
id id
status status
coverImage { coverImage {
medium large
} }
episodes episodes
description description
@@ -60,7 +60,7 @@ class AniListClient {
id id
status status
coverImage { coverImage {
medium large
} }
chapters chapters
description description
+14 -2
View File
@@ -7,6 +7,8 @@ part 'model.freezed.dart';
abstract class AnimeSearchResult with _$AnimeSearchResult { abstract class AnimeSearchResult with _$AnimeSearchResult {
const factory AnimeSearchResult({ const factory AnimeSearchResult({
required String title, required String title,
required String? titleEnglish,
required String? titleJapanese,
required String id, required String id,
required int? episodes, required int? episodes,
required String imageUrl, required String imageUrl,
@@ -24,10 +26,14 @@ abstract class AnimeSearchResult with _$AnimeSearchResult {
); );
return AnimeSearchResult( return AnimeSearchResult(
title: (json['title']! as Map<String, dynamic>)['romaji']! as String, title: (json['title']! as Map<String, dynamic>)['romaji']! as String,
titleEnglish:
(json['title']! as Map<String, dynamic>)['english'] as String?,
titleJapanese:
(json['title']! as Map<String, dynamic>)['native'] as String?,
id: (json['id']! as int).toString(), id: (json['id']! as int).toString(),
episodes: json['episodes'] as int?, episodes: json['episodes'] as int?,
imageUrl: imageUrl:
(json['coverImage']! as Map<String, dynamic>)['medium']! as String, (json['coverImage']! as Map<String, dynamic>)['large']! as String,
description: json['description'] as String?, description: json['description'] as String?,
isAiring: json['status'] == 'RELEASING', isAiring: json['status'] == 'RELEASING',
broadcastDay: airingDayOfTheWeek, broadcastDay: airingDayOfTheWeek,
@@ -39,6 +45,8 @@ abstract class AnimeSearchResult with _$AnimeSearchResult {
abstract class MangaSearchResult with _$MangaSearchResult { abstract class MangaSearchResult with _$MangaSearchResult {
const factory MangaSearchResult({ const factory MangaSearchResult({
required String title, required String title,
required String? titleEnglish,
required String? titleJapanese,
required String id, required String id,
required int? chapters, required int? chapters,
required String imageUrl, required String imageUrl,
@@ -48,10 +56,14 @@ abstract class MangaSearchResult with _$MangaSearchResult {
factory MangaSearchResult.fromJson(Map<String, Object?> json) { factory MangaSearchResult.fromJson(Map<String, Object?> json) {
return MangaSearchResult( return MangaSearchResult(
title: (json['title']! as Map<String, dynamic>)['romaji']! as String, title: (json['title']! as Map<String, dynamic>)['romaji']! as String,
titleEnglish:
(json['title']! as Map<String, dynamic>)['english'] as String?,
titleJapanese:
(json['title']! as Map<String, dynamic>)['native'] as String?,
id: (json['id']! as int).toString(), id: (json['id']! as int).toString(),
chapters: json['chapters'] as int?, chapters: json['chapters'] as int?,
imageUrl: imageUrl:
(json['coverImage']! as Map<String, dynamic>)['medium']! as String, (json['coverImage']! as Map<String, dynamic>)['large']! as String,
description: json['description'] as String?, description: json['description'] as String?,
); );
} }
+52 -40
View File
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc /// @nodoc
mixin _$AnimeSearchResult { mixin _$AnimeSearchResult {
String get title; String get id; int? get episodes; String get imageUrl; String? get description; bool get isAiring; String? get broadcastDay; String get title; String? get titleEnglish; String? get titleJapanese; String get id; int? get episodes; String get imageUrl; String? get description; bool get isAiring; String? get broadcastDay;
/// Create a copy of AnimeSearchResult /// Create a copy of AnimeSearchResult
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $AnimeSearchResultCopyWith<AnimeSearchResult> get copyWith => _$AnimeSearchResul
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AnimeSearchResult&&(identical(other.title, title) || other.title == title)&&(identical(other.id, id) || other.id == id)&&(identical(other.episodes, episodes) || other.episodes == episodes)&&(identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl)&&(identical(other.description, description) || other.description == description)&&(identical(other.isAiring, isAiring) || other.isAiring == isAiring)&&(identical(other.broadcastDay, broadcastDay) || other.broadcastDay == broadcastDay)); return identical(this, other) || (other.runtimeType == runtimeType&&other is AnimeSearchResult&&(identical(other.title, title) || other.title == title)&&(identical(other.titleEnglish, titleEnglish) || other.titleEnglish == titleEnglish)&&(identical(other.titleJapanese, titleJapanese) || other.titleJapanese == titleJapanese)&&(identical(other.id, id) || other.id == id)&&(identical(other.episodes, episodes) || other.episodes == episodes)&&(identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl)&&(identical(other.description, description) || other.description == description)&&(identical(other.isAiring, isAiring) || other.isAiring == isAiring)&&(identical(other.broadcastDay, broadcastDay) || other.broadcastDay == broadcastDay));
} }
@override @override
int get hashCode => Object.hash(runtimeType,title,id,episodes,imageUrl,description,isAiring,broadcastDay); int get hashCode => Object.hash(runtimeType,title,titleEnglish,titleJapanese,id,episodes,imageUrl,description,isAiring,broadcastDay);
@override @override
String toString() { String toString() {
return 'AnimeSearchResult(title: $title, id: $id, episodes: $episodes, imageUrl: $imageUrl, description: $description, isAiring: $isAiring, broadcastDay: $broadcastDay)'; return 'AnimeSearchResult(title: $title, titleEnglish: $titleEnglish, titleJapanese: $titleJapanese, id: $id, episodes: $episodes, imageUrl: $imageUrl, description: $description, isAiring: $isAiring, broadcastDay: $broadcastDay)';
} }
@@ -45,7 +45,7 @@ abstract mixin class $AnimeSearchResultCopyWith<$Res> {
factory $AnimeSearchResultCopyWith(AnimeSearchResult value, $Res Function(AnimeSearchResult) _then) = _$AnimeSearchResultCopyWithImpl; factory $AnimeSearchResultCopyWith(AnimeSearchResult value, $Res Function(AnimeSearchResult) _then) = _$AnimeSearchResultCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String title, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay String title, String? titleEnglish, String? titleJapanese, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay
}); });
@@ -62,10 +62,12 @@ class _$AnimeSearchResultCopyWithImpl<$Res>
/// Create a copy of AnimeSearchResult /// Create a copy of AnimeSearchResult
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? id = null,Object? episodes = freezed,Object? imageUrl = null,Object? description = freezed,Object? isAiring = null,Object? broadcastDay = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? titleEnglish = freezed,Object? titleJapanese = freezed,Object? id = null,Object? episodes = freezed,Object? imageUrl = null,Object? description = freezed,Object? isAiring = null,Object? broadcastDay = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,titleEnglish: freezed == titleEnglish ? _self.titleEnglish : titleEnglish // ignore: cast_nullable_to_non_nullable
as String?,titleJapanese: freezed == titleJapanese ? _self.titleJapanese : titleJapanese // ignore: cast_nullable_to_non_nullable
as String?,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,episodes: freezed == episodes ? _self.episodes : episodes // ignore: cast_nullable_to_non_nullable as String,episodes: freezed == episodes ? _self.episodes : episodes // ignore: cast_nullable_to_non_nullable
as int?,imageUrl: null == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable as int?,imageUrl: null == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
@@ -156,10 +158,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String title, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String title, String? titleEnglish, String? titleJapanese, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _AnimeSearchResult() when $default != null: case _AnimeSearchResult() when $default != null:
return $default(_that.title,_that.id,_that.episodes,_that.imageUrl,_that.description,_that.isAiring,_that.broadcastDay);case _: return $default(_that.title,_that.titleEnglish,_that.titleJapanese,_that.id,_that.episodes,_that.imageUrl,_that.description,_that.isAiring,_that.broadcastDay);case _:
return orElse(); return orElse();
} }
@@ -177,10 +179,10 @@ return $default(_that.title,_that.id,_that.episodes,_that.imageUrl,_that.descrip
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String title, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String title, String? titleEnglish, String? titleJapanese, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _AnimeSearchResult(): case _AnimeSearchResult():
return $default(_that.title,_that.id,_that.episodes,_that.imageUrl,_that.description,_that.isAiring,_that.broadcastDay);case _: return $default(_that.title,_that.titleEnglish,_that.titleJapanese,_that.id,_that.episodes,_that.imageUrl,_that.description,_that.isAiring,_that.broadcastDay);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -197,10 +199,10 @@ return $default(_that.title,_that.id,_that.episodes,_that.imageUrl,_that.descrip
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String title, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String title, String? titleEnglish, String? titleJapanese, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _AnimeSearchResult() when $default != null: case _AnimeSearchResult() when $default != null:
return $default(_that.title,_that.id,_that.episodes,_that.imageUrl,_that.description,_that.isAiring,_that.broadcastDay);case _: return $default(_that.title,_that.titleEnglish,_that.titleJapanese,_that.id,_that.episodes,_that.imageUrl,_that.description,_that.isAiring,_that.broadcastDay);case _:
return null; return null;
} }
@@ -212,10 +214,12 @@ return $default(_that.title,_that.id,_that.episodes,_that.imageUrl,_that.descrip
class _AnimeSearchResult implements AnimeSearchResult { class _AnimeSearchResult implements AnimeSearchResult {
const _AnimeSearchResult({required this.title, required this.id, required this.episodes, required this.imageUrl, required this.description, required this.isAiring, required this.broadcastDay}); const _AnimeSearchResult({required this.title, required this.titleEnglish, required this.titleJapanese, required this.id, required this.episodes, required this.imageUrl, required this.description, required this.isAiring, required this.broadcastDay});
@override final String title; @override final String title;
@override final String? titleEnglish;
@override final String? titleJapanese;
@override final String id; @override final String id;
@override final int? episodes; @override final int? episodes;
@override final String imageUrl; @override final String imageUrl;
@@ -233,16 +237,16 @@ _$AnimeSearchResultCopyWith<_AnimeSearchResult> get copyWith => __$AnimeSearchRe
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AnimeSearchResult&&(identical(other.title, title) || other.title == title)&&(identical(other.id, id) || other.id == id)&&(identical(other.episodes, episodes) || other.episodes == episodes)&&(identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl)&&(identical(other.description, description) || other.description == description)&&(identical(other.isAiring, isAiring) || other.isAiring == isAiring)&&(identical(other.broadcastDay, broadcastDay) || other.broadcastDay == broadcastDay)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _AnimeSearchResult&&(identical(other.title, title) || other.title == title)&&(identical(other.titleEnglish, titleEnglish) || other.titleEnglish == titleEnglish)&&(identical(other.titleJapanese, titleJapanese) || other.titleJapanese == titleJapanese)&&(identical(other.id, id) || other.id == id)&&(identical(other.episodes, episodes) || other.episodes == episodes)&&(identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl)&&(identical(other.description, description) || other.description == description)&&(identical(other.isAiring, isAiring) || other.isAiring == isAiring)&&(identical(other.broadcastDay, broadcastDay) || other.broadcastDay == broadcastDay));
} }
@override @override
int get hashCode => Object.hash(runtimeType,title,id,episodes,imageUrl,description,isAiring,broadcastDay); int get hashCode => Object.hash(runtimeType,title,titleEnglish,titleJapanese,id,episodes,imageUrl,description,isAiring,broadcastDay);
@override @override
String toString() { String toString() {
return 'AnimeSearchResult(title: $title, id: $id, episodes: $episodes, imageUrl: $imageUrl, description: $description, isAiring: $isAiring, broadcastDay: $broadcastDay)'; return 'AnimeSearchResult(title: $title, titleEnglish: $titleEnglish, titleJapanese: $titleJapanese, id: $id, episodes: $episodes, imageUrl: $imageUrl, description: $description, isAiring: $isAiring, broadcastDay: $broadcastDay)';
} }
@@ -253,7 +257,7 @@ abstract mixin class _$AnimeSearchResultCopyWith<$Res> implements $AnimeSearchRe
factory _$AnimeSearchResultCopyWith(_AnimeSearchResult value, $Res Function(_AnimeSearchResult) _then) = __$AnimeSearchResultCopyWithImpl; factory _$AnimeSearchResultCopyWith(_AnimeSearchResult value, $Res Function(_AnimeSearchResult) _then) = __$AnimeSearchResultCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String title, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay String title, String? titleEnglish, String? titleJapanese, String id, int? episodes, String imageUrl, String? description, bool isAiring, String? broadcastDay
}); });
@@ -270,10 +274,12 @@ class __$AnimeSearchResultCopyWithImpl<$Res>
/// Create a copy of AnimeSearchResult /// Create a copy of AnimeSearchResult
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? title = null,Object? id = null,Object? episodes = freezed,Object? imageUrl = null,Object? description = freezed,Object? isAiring = null,Object? broadcastDay = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? title = null,Object? titleEnglish = freezed,Object? titleJapanese = freezed,Object? id = null,Object? episodes = freezed,Object? imageUrl = null,Object? description = freezed,Object? isAiring = null,Object? broadcastDay = freezed,}) {
return _then(_AnimeSearchResult( return _then(_AnimeSearchResult(
title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,titleEnglish: freezed == titleEnglish ? _self.titleEnglish : titleEnglish // ignore: cast_nullable_to_non_nullable
as String?,titleJapanese: freezed == titleJapanese ? _self.titleJapanese : titleJapanese // ignore: cast_nullable_to_non_nullable
as String?,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,episodes: freezed == episodes ? _self.episodes : episodes // ignore: cast_nullable_to_non_nullable as String,episodes: freezed == episodes ? _self.episodes : episodes // ignore: cast_nullable_to_non_nullable
as int?,imageUrl: null == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable as int?,imageUrl: null == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
@@ -289,7 +295,7 @@ as String?,
/// @nodoc /// @nodoc
mixin _$MangaSearchResult { mixin _$MangaSearchResult {
String get title; String get id; int? get chapters; String get imageUrl; String? get description; String get title; String? get titleEnglish; String? get titleJapanese; String get id; int? get chapters; String get imageUrl; String? get description;
/// Create a copy of MangaSearchResult /// Create a copy of MangaSearchResult
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false) @JsonKey(includeFromJson: false, includeToJson: false)
@@ -300,16 +306,16 @@ $MangaSearchResultCopyWith<MangaSearchResult> get copyWith => _$MangaSearchResul
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is MangaSearchResult&&(identical(other.title, title) || other.title == title)&&(identical(other.id, id) || other.id == id)&&(identical(other.chapters, chapters) || other.chapters == chapters)&&(identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl)&&(identical(other.description, description) || other.description == description)); return identical(this, other) || (other.runtimeType == runtimeType&&other is MangaSearchResult&&(identical(other.title, title) || other.title == title)&&(identical(other.titleEnglish, titleEnglish) || other.titleEnglish == titleEnglish)&&(identical(other.titleJapanese, titleJapanese) || other.titleJapanese == titleJapanese)&&(identical(other.id, id) || other.id == id)&&(identical(other.chapters, chapters) || other.chapters == chapters)&&(identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl)&&(identical(other.description, description) || other.description == description));
} }
@override @override
int get hashCode => Object.hash(runtimeType,title,id,chapters,imageUrl,description); int get hashCode => Object.hash(runtimeType,title,titleEnglish,titleJapanese,id,chapters,imageUrl,description);
@override @override
String toString() { String toString() {
return 'MangaSearchResult(title: $title, id: $id, chapters: $chapters, imageUrl: $imageUrl, description: $description)'; return 'MangaSearchResult(title: $title, titleEnglish: $titleEnglish, titleJapanese: $titleJapanese, id: $id, chapters: $chapters, imageUrl: $imageUrl, description: $description)';
} }
@@ -320,7 +326,7 @@ abstract mixin class $MangaSearchResultCopyWith<$Res> {
factory $MangaSearchResultCopyWith(MangaSearchResult value, $Res Function(MangaSearchResult) _then) = _$MangaSearchResultCopyWithImpl; factory $MangaSearchResultCopyWith(MangaSearchResult value, $Res Function(MangaSearchResult) _then) = _$MangaSearchResultCopyWithImpl;
@useResult @useResult
$Res call({ $Res call({
String title, String id, int? chapters, String imageUrl, String? description String title, String? titleEnglish, String? titleJapanese, String id, int? chapters, String imageUrl, String? description
}); });
@@ -337,10 +343,12 @@ class _$MangaSearchResultCopyWithImpl<$Res>
/// Create a copy of MangaSearchResult /// Create a copy of MangaSearchResult
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? id = null,Object? chapters = freezed,Object? imageUrl = null,Object? description = freezed,}) { @pragma('vm:prefer-inline') @override $Res call({Object? title = null,Object? titleEnglish = freezed,Object? titleJapanese = freezed,Object? id = null,Object? chapters = freezed,Object? imageUrl = null,Object? description = freezed,}) {
return _then(_self.copyWith( return _then(_self.copyWith(
title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,titleEnglish: freezed == titleEnglish ? _self.titleEnglish : titleEnglish // ignore: cast_nullable_to_non_nullable
as String?,titleJapanese: freezed == titleJapanese ? _self.titleJapanese : titleJapanese // ignore: cast_nullable_to_non_nullable
as String?,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,chapters: freezed == chapters ? _self.chapters : chapters // ignore: cast_nullable_to_non_nullable as String,chapters: freezed == chapters ? _self.chapters : chapters // ignore: cast_nullable_to_non_nullable
as int?,imageUrl: null == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable as int?,imageUrl: null == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
@@ -429,10 +437,10 @@ return $default(_that);case _:
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String title, String id, int? chapters, String imageUrl, String? description)? $default,{required TResult orElse(),}) {final _that = this; @optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String title, String? titleEnglish, String? titleJapanese, String id, int? chapters, String imageUrl, String? description)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) { switch (_that) {
case _MangaSearchResult() when $default != null: case _MangaSearchResult() when $default != null:
return $default(_that.title,_that.id,_that.chapters,_that.imageUrl,_that.description);case _: return $default(_that.title,_that.titleEnglish,_that.titleJapanese,_that.id,_that.chapters,_that.imageUrl,_that.description);case _:
return orElse(); return orElse();
} }
@@ -450,10 +458,10 @@ return $default(_that.title,_that.id,_that.chapters,_that.imageUrl,_that.descrip
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String title, String id, int? chapters, String imageUrl, String? description) $default,) {final _that = this; @optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String title, String? titleEnglish, String? titleJapanese, String id, int? chapters, String imageUrl, String? description) $default,) {final _that = this;
switch (_that) { switch (_that) {
case _MangaSearchResult(): case _MangaSearchResult():
return $default(_that.title,_that.id,_that.chapters,_that.imageUrl,_that.description);case _: return $default(_that.title,_that.titleEnglish,_that.titleJapanese,_that.id,_that.chapters,_that.imageUrl,_that.description);case _:
throw StateError('Unexpected subclass'); throw StateError('Unexpected subclass');
} }
@@ -470,10 +478,10 @@ return $default(_that.title,_that.id,_that.chapters,_that.imageUrl,_that.descrip
/// } /// }
/// ``` /// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String title, String id, int? chapters, String imageUrl, String? description)? $default,) {final _that = this; @optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String title, String? titleEnglish, String? titleJapanese, String id, int? chapters, String imageUrl, String? description)? $default,) {final _that = this;
switch (_that) { switch (_that) {
case _MangaSearchResult() when $default != null: case _MangaSearchResult() when $default != null:
return $default(_that.title,_that.id,_that.chapters,_that.imageUrl,_that.description);case _: return $default(_that.title,_that.titleEnglish,_that.titleJapanese,_that.id,_that.chapters,_that.imageUrl,_that.description);case _:
return null; return null;
} }
@@ -485,10 +493,12 @@ return $default(_that.title,_that.id,_that.chapters,_that.imageUrl,_that.descrip
class _MangaSearchResult implements MangaSearchResult { class _MangaSearchResult implements MangaSearchResult {
const _MangaSearchResult({required this.title, required this.id, required this.chapters, required this.imageUrl, required this.description}); const _MangaSearchResult({required this.title, required this.titleEnglish, required this.titleJapanese, required this.id, required this.chapters, required this.imageUrl, required this.description});
@override final String title; @override final String title;
@override final String? titleEnglish;
@override final String? titleJapanese;
@override final String id; @override final String id;
@override final int? chapters; @override final int? chapters;
@override final String imageUrl; @override final String imageUrl;
@@ -504,16 +514,16 @@ _$MangaSearchResultCopyWith<_MangaSearchResult> get copyWith => __$MangaSearchRe
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _MangaSearchResult&&(identical(other.title, title) || other.title == title)&&(identical(other.id, id) || other.id == id)&&(identical(other.chapters, chapters) || other.chapters == chapters)&&(identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl)&&(identical(other.description, description) || other.description == description)); return identical(this, other) || (other.runtimeType == runtimeType&&other is _MangaSearchResult&&(identical(other.title, title) || other.title == title)&&(identical(other.titleEnglish, titleEnglish) || other.titleEnglish == titleEnglish)&&(identical(other.titleJapanese, titleJapanese) || other.titleJapanese == titleJapanese)&&(identical(other.id, id) || other.id == id)&&(identical(other.chapters, chapters) || other.chapters == chapters)&&(identical(other.imageUrl, imageUrl) || other.imageUrl == imageUrl)&&(identical(other.description, description) || other.description == description));
} }
@override @override
int get hashCode => Object.hash(runtimeType,title,id,chapters,imageUrl,description); int get hashCode => Object.hash(runtimeType,title,titleEnglish,titleJapanese,id,chapters,imageUrl,description);
@override @override
String toString() { String toString() {
return 'MangaSearchResult(title: $title, id: $id, chapters: $chapters, imageUrl: $imageUrl, description: $description)'; return 'MangaSearchResult(title: $title, titleEnglish: $titleEnglish, titleJapanese: $titleJapanese, id: $id, chapters: $chapters, imageUrl: $imageUrl, description: $description)';
} }
@@ -524,7 +534,7 @@ abstract mixin class _$MangaSearchResultCopyWith<$Res> implements $MangaSearchRe
factory _$MangaSearchResultCopyWith(_MangaSearchResult value, $Res Function(_MangaSearchResult) _then) = __$MangaSearchResultCopyWithImpl; factory _$MangaSearchResultCopyWith(_MangaSearchResult value, $Res Function(_MangaSearchResult) _then) = __$MangaSearchResultCopyWithImpl;
@override @useResult @override @useResult
$Res call({ $Res call({
String title, String id, int? chapters, String imageUrl, String? description String title, String? titleEnglish, String? titleJapanese, String id, int? chapters, String imageUrl, String? description
}); });
@@ -541,10 +551,12 @@ class __$MangaSearchResultCopyWithImpl<$Res>
/// Create a copy of MangaSearchResult /// Create a copy of MangaSearchResult
/// with the given fields replaced by the non-null parameter values. /// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? title = null,Object? id = null,Object? chapters = freezed,Object? imageUrl = null,Object? description = freezed,}) { @override @pragma('vm:prefer-inline') $Res call({Object? title = null,Object? titleEnglish = freezed,Object? titleJapanese = freezed,Object? id = null,Object? chapters = freezed,Object? imageUrl = null,Object? description = freezed,}) {
return _then(_MangaSearchResult( return _then(_MangaSearchResult(
title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable as String,titleEnglish: freezed == titleEnglish ? _self.titleEnglish : titleEnglish // ignore: cast_nullable_to_non_nullable
as String?,titleJapanese: freezed == titleJapanese ? _self.titleJapanese : titleJapanese // ignore: cast_nullable_to_non_nullable
as String?,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,chapters: freezed == chapters ? _self.chapters : chapters // ignore: cast_nullable_to_non_nullable as String,chapters: freezed == chapters ? _self.chapters : chapters // ignore: cast_nullable_to_non_nullable
as int?,imageUrl: null == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable as int?,imageUrl: null == imageUrl ? _self.imageUrl : imageUrl // ignore: cast_nullable_to_non_nullable
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
+19 -4
View File
@@ -7,6 +7,9 @@ import 'package:anitrack/src/service/migrations/0000_airing.dart';
import 'package:anitrack/src/service/migrations/0000_score.dart'; import 'package:anitrack/src/service/migrations/0000_score.dart';
import 'package:anitrack/src/service/migrations/0001_anime_watcher.dart'; import 'package:anitrack/src/service/migrations/0001_anime_watcher.dart';
import 'package:anitrack/src/service/migrations/0002_anilist.dart'; import 'package:anitrack/src/service/migrations/0002_anilist.dart';
import 'package:anitrack/src/service/migrations/0003_other_titles.dart';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart'; import 'package:sqflite_common_ffi/sqflite_ffi.dart';
const animeTable = 'Anime'; const animeTable = 'Anime';
@@ -83,6 +86,15 @@ class DatabaseService {
/// Cached AnimeWatchers. /// Cached AnimeWatchers.
List<AnimeWatcher>? _watcherCache; List<AnimeWatcher>? _watcherCache;
Future<String> _getDatabasePath() async {
if (Platform.isAndroid || Platform.isIOS) {
return 'anitrack.db';
}
final supportDir = await getApplicationSupportDirectory();
return p.join(supportDir.path, 'anitrack.db');
}
Future<void> initialize() async { Future<void> initialize() async {
// Allow initializing the database on Windows and Linux as well. // Allow initializing the database on Windows and Linux as well.
if (Platform.isLinux || Platform.isWindows) { if (Platform.isLinux || Platform.isWindows) {
@@ -90,9 +102,11 @@ class DatabaseService {
databaseFactory = databaseFactoryFfi; databaseFactory = databaseFactoryFfi;
} }
final databasePath = await _getDatabasePath();
print('Opening database at $databasePath');
_db = await openDatabase( _db = await openDatabase(
'anitrack.db', databasePath,
version: 5, version: 6,
onConfigure: (db) async { onConfigure: (db) async {
// In order to do schema changes during database upgrades, we disable foreign // In order to do schema changes during database upgrades, we disable foreign
// keys in the onConfigure phase, but re-enable them here. // keys in the onConfigure phase, but re-enable them here.
@@ -117,9 +131,11 @@ class DatabaseService {
if (oldVersion < 5) { if (oldVersion < 5) {
await migrateFromV4ToV5(db); await migrateFromV4ToV5(db);
} }
if (oldVersion < 6) {
await migrateFromV5ToV6(db);
}
}, },
); );
print(_db.path);
} }
Future<List<AnimeTrackingData>> loadAnimes() async { Future<List<AnimeTrackingData>> loadAnimes() async {
@@ -144,7 +160,6 @@ class DatabaseService {
await _db.insert( await _db.insert(
animeTable, animeTable,
data.toJson(), data.toJson(),
conflictAlgorithm: ConflictAlgorithm.ignore,
); );
} }
@@ -0,0 +1,15 @@
import 'package:anitrack/src/service/database.dart';
import 'package:sqflite/sqflite.dart';
Future<void> migrateFromV5ToV6(Database db) async {
await db.execute(
'''
ALTER TABLE $animeTable ADD COLUMN otherTitles TEXT NOT NULL DEFAULT '{}';
''',
);
await db.execute(
'''
ALTER TABLE $mangaTable ADD COLUMN otherTitles TEXT NOT NULL DEFAULT '{}';
''',
);
}
+22
View File
@@ -2,6 +2,8 @@ import 'package:anitrack/src/data/anime.dart';
import 'package:anitrack/src/data/manga.dart'; import 'package:anitrack/src/data/manga.dart';
import 'package:anitrack/src/data/type.dart'; import 'package:anitrack/src/data/type.dart';
import 'package:anitrack/src/service/database.dart'; import 'package:anitrack/src/service/database.dart';
import 'package:anitrack/src/ui/bloc/navigation_bloc.dart';
import 'package:anitrack/src/ui/constants.dart';
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
@@ -28,6 +30,7 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
on<AnimeRemovedEvent>(_onAnimeRemoved); on<AnimeRemovedEvent>(_onAnimeRemoved);
on<MangaRemovedEvent>(_onMangaRemoved); on<MangaRemovedEvent>(_onMangaRemoved);
on<AddButtonVisibilitySetEvent>(_onButtonVisibilityToggled); on<AddButtonVisibilitySetEvent>(_onButtonVisibilityToggled);
on<AnimeListRequestedEvent>(_onAnimeListSummoned);
} }
/// Internal anime state /// Internal anime state
@@ -356,4 +359,23 @@ class AnimeListBloc extends Bloc<AnimeListEvent, AnimeListState> {
), ),
); );
} }
Future<void> _onAnimeListSummoned(
AnimeListRequestedEvent event,
Emitter<AnimeListState> emit,
) async {
emit(
state.copyWith(
trackingType: TrackingMediumType.anime,
animeFilterState: MediumTrackingState.ongoing,
mangaFilterState: MediumTrackingState.ongoing,
),
);
GetIt.I.get<NavigationBloc>().add(
PushedNamedAndRemoveUntilEvent(
const NavigationDestination(animeListRoute),
(_) => false,
),
);
}
} }
+3
View File
@@ -114,3 +114,6 @@ class AddButtonVisibilitySetEvent extends AnimeListEvent {
/// The visibility of the button /// The visibility of the button
final bool state; final bool state;
} }
/// Triggered by the UI when the anime list is supposed to be summoned.
class AnimeListRequestedEvent extends AnimeListEvent {}
+13
View File
@@ -1,5 +1,6 @@
import 'package:anitrack/src/data/anime.dart'; import 'package:anitrack/src/data/anime.dart';
import 'package:anitrack/src/data/manga.dart'; import 'package:anitrack/src/data/manga.dart';
import 'package:anitrack/src/data/other_titles.dart';
import 'package:anitrack/src/data/search_result.dart'; import 'package:anitrack/src/data/search_result.dart';
import 'package:anitrack/src/data/source.dart'; import 'package:anitrack/src/data/source.dart';
import 'package:anitrack/src/data/type.dart'; import 'package:anitrack/src/data/type.dart';
@@ -82,6 +83,8 @@ class AnimeSearchBloc extends Bloc<AnimeSearchEvent, AnimeSearchState> {
.map( .map(
(anime) => SearchResult( (anime) => SearchResult(
anime.title, anime.title,
anime.titleEnglish,
anime.titleJapanese,
anime.id, anime.id,
anime.episodes, anime.episodes,
anime.imageUrl, anime.imageUrl,
@@ -104,6 +107,8 @@ class AnimeSearchBloc extends Bloc<AnimeSearchEvent, AnimeSearchState> {
.map( .map(
(manga) => SearchResult( (manga) => SearchResult(
manga.title, manga.title,
null,
null,
manga.id, manga.id,
manga.chapters, manga.chapters,
manga.imageUrl, manga.imageUrl,
@@ -135,6 +140,10 @@ class AnimeSearchBloc extends Bloc<AnimeSearchEvent, AnimeSearchState> {
event.result.thumbnailUrl, event.result.thumbnailUrl,
event.result.isAiring, event.result.isAiring,
event.result.broadcastDay, event.result.broadcastDay,
OtherTitles(
english: event.result.titleEnglish,
japanese: event.result.titleJapanese,
),
TrackingDataSource.anilist, TrackingDataSource.anilist,
), ),
) )
@@ -147,6 +156,10 @@ class AnimeSearchBloc extends Bloc<AnimeSearchEvent, AnimeSearchState> {
0, 0,
event.result.total, event.result.total,
event.result.thumbnailUrl, event.result.thumbnailUrl,
OtherTitles(
english: event.result.titleEnglish,
japanese: event.result.titleJapanese,
),
TrackingDataSource.anilist, TrackingDataSource.anilist,
), ),
), ),
+3
View File
@@ -4,6 +4,7 @@ import 'dart:io';
import 'package:anitrack/i18n/strings.g.dart'; import 'package:anitrack/i18n/strings.g.dart';
import 'package:anitrack/src/data/anime.dart'; import 'package:anitrack/src/data/anime.dart';
import 'package:anitrack/src/data/manga.dart'; import 'package:anitrack/src/data/manga.dart';
import 'package:anitrack/src/data/other_titles.dart';
import 'package:anitrack/src/data/source.dart'; import 'package:anitrack/src/data/source.dart';
import 'package:anitrack/src/data/type.dart'; import 'package:anitrack/src/data/type.dart';
import 'package:anitrack/src/service/database.dart'; import 'package:anitrack/src/service/database.dart';
@@ -132,6 +133,7 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
// NOTE: When the calendar gets refreshed, this should also get cleared // NOTE: When the calendar gets refreshed, this should also get cleared
true, true,
null, null,
OtherTitles(),
TrackingDataSource.mal, TrackingDataSource.mal,
), ),
); );
@@ -209,6 +211,7 @@ class SettingsBloc extends Bloc<SettingsEvent, SettingsState> {
// 0 means that MAL does not know // 0 means that MAL does not know
totalChapters == 0 ? null : totalChapters, totalChapters == 0 ? null : totalChapters,
data.imageUrl, data.imageUrl,
OtherTitles(),
TrackingDataSource.mal, TrackingDataSource.mal,
), ),
); );
+4 -3
View File
@@ -1,6 +1,8 @@
import 'package:anitrack/i18n/strings.g.dart'; import 'package:anitrack/i18n/strings.g.dart';
import 'package:anitrack/src/ui/bloc/anime_list_bloc.dart';
import 'package:anitrack/src/ui/constants.dart'; import 'package:anitrack/src/ui/constants.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
Widget getDrawer(BuildContext context) { Widget getDrawer(BuildContext context) {
return Drawer( return Drawer(
@@ -22,9 +24,8 @@ Widget getDrawer(BuildContext context) {
leading: const Icon(Icons.list), leading: const Icon(Icons.list),
title: Text(t.content.list), title: Text(t.content.list),
onTap: () { onTap: () {
Navigator.of(context).pushNamedAndRemoveUntil( GetIt.I.get<AnimeListBloc>().add(
animeListRoute, AnimeListRequestedEvent(),
(_) => false,
); );
}, },
), ),
+1 -1
View File
@@ -236,7 +236,7 @@ class AnimeListPageState extends State<AnimeListPage> {
context.read<DetailsBloc>().add( context.read<DetailsBloc>().add(
MangaDetailsRequestedEvent( MangaDetailsRequestedEvent(
manga, manga,
heroImagePrefix: 'grid_' heroImagePrefix: 'grid_',
), ),
); );
}, },
@@ -80,6 +80,7 @@ class DetailsWatcherSheetState extends State<DetailsWatcherSheet> {
child: TextField( child: TextField(
controller: _controller, controller: _controller,
decoration: InputDecoration( decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: t.details.watchingWith.name, labelText: t.details.watchingWith.name,
), ),
), ),
+4 -5
View File
@@ -43,7 +43,7 @@ class SettingsPage extends StatelessWidget {
subtitle: Text(t.settings.importAnimeDesc), subtitle: Text(t.settings.importAnimeDesc),
onTap: () async { onTap: () async {
// Pick the file // Pick the file
final result = await FilePicker.platform.pickFiles(); final result = await FilePicker.pickFiles();
if (result == null) return; if (result == null) return;
if (!result.files.first.path!.endsWith('.xml.gz')) { if (!result.files.first.path!.endsWith('.xml.gz')) {
@@ -70,7 +70,7 @@ class SettingsPage extends StatelessWidget {
subtitle: Text(t.settings.importMangaDesc), subtitle: Text(t.settings.importMangaDesc),
onTap: () async { onTap: () async {
// Pick the file // Pick the file
final result = await FilePicker.platform.pickFiles(); final result = await FilePicker.pickFiles();
if (result == null) return; if (result == null) return;
if (!result.files.first.path!.endsWith('.xml.gz')) { if (!result.files.first.path!.endsWith('.xml.gz')) {
@@ -96,8 +96,7 @@ class SettingsPage extends StatelessWidget {
title: Text(t.settings.exportData), title: Text(t.settings.exportData),
onTap: () async { onTap: () async {
// Pick the file // Pick the file
final result = await FilePicker.platform final result = await FilePicker.getDirectoryPath();
.getDirectoryPath();
if (result == null) return; if (result == null) return;
if (!(await Permission.manageExternalStorage if (!(await Permission.manageExternalStorage
@@ -116,7 +115,7 @@ class SettingsPage extends StatelessWidget {
title: Text(t.settings.importData), title: Text(t.settings.importData),
onTap: () async { onTap: () async {
// Pick the file // Pick the file
final result = await FilePicker.platform.pickFiles(); final result = await FilePicker.pickFiles();
if (result == null) return; if (result == null) return;
if (!result.files.first.path!.endsWith('.json.gz')) { if (!result.files.first.path!.endsWith('.json.gz')) {
+34 -42
View File
@@ -5,18 +5,18 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: _fe_analyzer_shared name: _fe_analyzer_shared
sha256: "8d7ff3948166b8ec5da0fbb5962000926b8e02f2ed9b3e51d1738905fbd4c98d" sha256: "3b19a47f6ea7c2632760777c78174f47f6aec1e05f0cd611380d4593b8af1dbc"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "93.0.0" version: "96.0.0"
analyzer: analyzer:
dependency: transitive dependency: transitive
description: description:
name: analyzer name: analyzer
sha256: de7148ed2fcec579b19f122c1800933dfa028f6d9fd38a152b04b1516cec120b sha256: "0c516bc4ad36a1a75759e54d5047cb9d15cded4459df01aa35a0b5ec7db2c2a0"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "10.0.1" version: "10.2.0"
archive: archive:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -242,7 +242,7 @@ packages:
source: hosted source: hosted
version: "1.0.9" version: "1.0.9"
dart_pubspec_licenses: dart_pubspec_licenses:
dependency: transitive dependency: "direct dev"
description: description:
name: dart_pubspec_licenses name: dart_pubspec_licenses
sha256: "3d579e1aa3ad3b6519f08fce6980799c0a8375bf41e0b8d58ca21f1be64032c9" sha256: "3d579e1aa3ad3b6519f08fce6980799c0a8375bf41e0b8d58ca21f1be64032c9"
@@ -261,10 +261,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: dbus name: dbus
sha256: "0ce9b0a839e6dee59a37a623d2fc26a35bbbe6404213e419b0d6411023d62645" sha256: "792974a4007974fbc5c1b5433eb2330a9db3e368c3f906253af4c007d0f49a91"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.7.14" version: "0.7.13"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@@ -293,10 +293,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: file_picker name: file_picker
sha256: "57d9a1dd5063f85fa3107fb42d1faffda52fdc948cefd5fe5ea85267a5fc7343" sha256: f13a03000d942e476bc1ff0a736d2e9de711d2f89a95cd4c1d88f861c3348387
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "10.3.10" version: "11.0.2"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
@@ -347,14 +347,6 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_oss_licenses:
dependency: "direct dev"
description:
name: flutter_oss_licenses
sha256: "80f5d879f1760f90020692db0d4b58b5a475df23573df567e12757a71ce59628"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
flutter_plugin_android_lifecycle: flutter_plugin_android_lifecycle:
dependency: transitive dependency: transitive
description: description:
@@ -545,10 +537,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: image name: image
sha256: f9881ff4998044947ec38d098bc7c8316ae1186fa786eddffdb867b9bc94dfce sha256: "6300175e00616bbc832e2fc91bfa4d776af5402c81c7151bee6905bb08473c52"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.8.0" version: "4.9.1"
intl: intl:
dependency: transitive dependency: transitive
description: description:
@@ -766,7 +758,7 @@ packages:
source: hosted source: hosted
version: "1.9.1" version: "1.9.1"
path_provider: path_provider:
dependency: transitive dependency: "direct main"
description: description:
name: path_provider name: path_provider
sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825 sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825
@@ -1070,50 +1062,50 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: sqflite name: sqflite
sha256: "564cfed0746fe53140c23b70b308e045c3b31f17778f2f326ccb7d804ea0250a" sha256: "58a799e6ac17dd32fbab93813d39ed835a75ccc0f8f85b8955fe318c6712b082"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.2+1" version: "2.4.3"
sqflite_android: sqflite_android:
dependency: transitive dependency: transitive
description: description:
name: sqflite_android name: sqflite_android
sha256: "881e28efdcc9950fd8e9bb42713dcf1103e62a2e7168f23c9338d82db13dec40" sha256: d0548f9d7422a2dae99ec6f8b0a3074463b132d216fa5ba0d230eeefc901983b
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.2+3" version: "2.4.3"
sqflite_common: sqflite_common:
dependency: transitive dependency: transitive
description: description:
name: sqflite_common name: sqflite_common
sha256: "1581ffbf7a0e333b380d6a30737d78516b826cb35beb7fb0bf8a3ea0c678b465" sha256: "5bf6a55c166e73bf651ba7ec3ed486e577620e3dc8f3a9c6a258a8031b624590"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.5.8" version: "2.5.11"
sqflite_common_ffi: sqflite_common_ffi:
dependency: "direct main" dependency: "direct main"
description: description:
name: sqflite_common_ffi name: sqflite_common_ffi
sha256: cd0c7f7de39a08f2d54ef144d9058c46eca8461879aaa648025643455c1e5a20 sha256: "5ccd38136edb9beb3213f6927775d52db70dfdadcdb28dad1f625ca9f2b9824f"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.0+3" version: "2.4.2"
sqflite_darwin: sqflite_darwin:
dependency: transitive dependency: transitive
description: description:
name: sqflite_darwin name: sqflite_darwin
sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" sha256: c86ca18b8f666bbf903924687fe21cc16fc385d086005067e26619ca530bef9f
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.2" version: "2.4.3+1"
sqflite_platform_interface: sqflite_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: sqflite_platform_interface name: sqflite_platform_interface
sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" sha256: f84939f84350d92d04416f8bc4dc52d3896aec7716cc9e80cf0146342139dc50
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.4.0" version: "2.4.1"
sqlite3: sqlite3:
dependency: transitive dependency: transitive
description: description:
@@ -1166,10 +1158,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: synchronized name: synchronized
sha256: "63896c27e81b28f8cb4e69ead0d3e8f03f1d1e5fc531a3e579cabed6a2c7c9e5" sha256: "61894a1956de6b4fc1aefd0892e109514a1a706cbece3ac59decd90ff5a7a423"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.4.0+1" version: "3.4.1+1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@@ -1222,10 +1214,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_android name: url_launcher_android
sha256: "17bc677f0b301615530dd1d67e0a9828cafa2d0b6b6eae4cd3679b7eac4a273c" sha256: b413d49b73867ac08dd2f9890efd3cc11f2a0e577618d50843440a1fb3776c32
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.3.30" version: "6.3.32"
url_launcher_ios: url_launcher_ios:
dependency: transitive dependency: transitive
description: description:
@@ -1294,10 +1286,10 @@ packages:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: very_good_analysis name: very_good_analysis
sha256: d1cb1d66a5aae2c702d68caca6c8347306d35e728fd94555fa21fa0448a972e0 sha256: "481af67ab5877af20325251dc215a4ebac7666a1c8cf09198ffd457bc612b33d"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "10.2.0" version: "10.3.0"
vm_service: vm_service:
dependency: transitive dependency: transitive
description: description:
@@ -1366,10 +1358,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: xml name: xml
sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" sha256: "67f0aff7be013d107995e9b75bf4e7f2c3ef2dfdb2c8e68024bba0a7fd5756a4"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.6.1" version: "7.0.1"
yaml: yaml:
dependency: transitive dependency: transitive
description: description:
@@ -1379,5 +1371,5 @@ packages:
source: hosted source: hosted
version: "3.1.3" version: "3.1.3"
sdks: sdks:
dart: ">=3.11.0 <4.0.0" dart: ">=3.12.0 <4.0.0"
flutter: ">=3.41.0" flutter: ">=3.44.0"
+6 -5
View File
@@ -2,7 +2,7 @@ name: anitrack
description: An anime and manga tracker description: An anime and manga tracker
publish_to: "none" publish_to: "none"
version: 0.2.0+2016 version: 0.2.1+2018
environment: environment:
sdk: ^3.8.0 sdk: ^3.8.0
@@ -14,7 +14,7 @@ dependencies:
cached_network_image: ^3.4.1 cached_network_image: ^3.4.1
collection: ^1.18.0 collection: ^1.18.0
cupertino_icons: ^1.0.8 cupertino_icons: ^1.0.8
file_picker: ^10.3.10 file_picker: ^11.0.2
flutter: flutter:
sdk: flutter sdk: flutter
flutter_bloc: ^9.1.1 flutter_bloc: ^9.1.1
@@ -24,7 +24,8 @@ dependencies:
graphql: ^5.2.4 graphql: ^5.2.4
jikan_api: ^2.2.1 jikan_api: ^2.2.1
json_annotation: ^4.11.0 json_annotation: ^4.11.0
path: ^1.9.0 path: ^1.9.1
path_provider: ^2.1.6
permission_handler: ^12.0.1 permission_handler: ^12.0.1
slang: ^4.13.0 slang: ^4.13.0
slang_flutter: ^4.13.0 slang_flutter: ^4.13.0
@@ -32,13 +33,13 @@ dependencies:
sqflite_common_ffi: sqflite_common_ffi:
swipeable_tile: ^2.0.1 swipeable_tile: ^2.0.1
url_launcher: ^6.3.0 url_launcher: ^6.3.0
xml: ^6.5.0 xml: ^7.0.1
dev_dependencies: dev_dependencies:
build_runner: ^2.4.12 build_runner: ^2.4.12
flutter_launcher_icons: ^0.14.1 flutter_launcher_icons: ^0.14.1
flutter_lints: ^6.0.0 flutter_lints: ^6.0.0
flutter_oss_licenses: ^3.0.2 dart_pubspec_licenses: ^3.2.0
flutter_test: flutter_test:
sdk: flutter sdk: flutter
freezed: ^3.2.5 freezed: ^3.2.5