refactor: profile model

This commit is contained in:
mso7nueh
2024-09-09 18:18:35 +03:00
parent 3ccf5b6d92
commit 8ea819c5bc
77 changed files with 2735 additions and 2950 deletions

View File

@@ -27,8 +27,12 @@ mixin _$CommentModel {
@JsonKey(name: "meta")
Meta get meta => throw _privateConstructorUsedError;
/// Serializes this CommentModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of CommentModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$CommentModelCopyWith<CommentModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -58,6 +62,8 @@ class _$CommentModelCopyWithImpl<$Res, $Val extends CommentModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CommentModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -81,6 +87,8 @@ class _$CommentModelCopyWithImpl<$Res, $Val extends CommentModel>
) as $Val);
}
/// Create a copy of CommentModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LinksCopyWith<$Res> get links {
@@ -89,6 +97,8 @@ class _$CommentModelCopyWithImpl<$Res, $Val extends CommentModel>
});
}
/// Create a copy of CommentModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MetaCopyWith<$Res> get meta {
@@ -125,6 +135,8 @@ class __$$CommentModelImplCopyWithImpl<$Res>
_$CommentModelImpl _value, $Res Function(_$CommentModelImpl) _then)
: super(_value, _then);
/// Create a copy of CommentModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -192,12 +204,14 @@ class _$CommentModelImpl implements _CommentModel {
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_data), links, meta);
@JsonKey(ignore: true)
/// Create a copy of CommentModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$CommentModelImplCopyWith<_$CommentModelImpl> get copyWith =>
@@ -229,8 +243,11 @@ abstract class _CommentModel implements CommentModel {
@override
@JsonKey(name: "meta")
Meta get meta;
/// Create a copy of CommentModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CommentModelImplCopyWith<_$CommentModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -254,8 +271,12 @@ mixin _$Comment {
@JsonKey(name: "created_at")
DateTime get createdAt => throw _privateConstructorUsedError;
/// Serializes this Comment to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$CommentCopyWith<Comment> get copyWith => throw _privateConstructorUsedError;
}
@@ -283,6 +304,8 @@ class _$CommentCopyWithImpl<$Res, $Val extends Comment>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -346,6 +369,8 @@ class __$$CommentImplCopyWithImpl<$Res>
_$CommentImpl _value, $Res Function(_$CommentImpl) _then)
: super(_value, _then);
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -449,7 +474,7 @@ class _$CommentImpl implements _Comment {
other.createdAt == createdAt));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -460,7 +485,9 @@ class _$CommentImpl implements _Comment {
const DeepCollectionEquality().hash(_childrenComments),
createdAt);
@JsonKey(ignore: true)
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$CommentImplCopyWith<_$CommentImpl> get copyWith =>
@@ -506,8 +533,11 @@ abstract class _Comment implements Comment {
@override
@JsonKey(name: "created_at")
DateTime get createdAt;
/// Create a copy of Comment
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CommentImplCopyWith<_$CommentImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -27,8 +27,12 @@ mixin _$DietsPagination {
@JsonKey(name: "meta")
Meta get meta => throw _privateConstructorUsedError;
/// Serializes this DietsPagination to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$DietsPaginationCopyWith<DietsPagination> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -58,6 +62,8 @@ class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -81,6 +87,8 @@ class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination>
) as $Val);
}
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LinksCopyWith<$Res> get links {
@@ -89,6 +97,8 @@ class _$DietsPaginationCopyWithImpl<$Res, $Val extends DietsPagination>
});
}
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MetaCopyWith<$Res> get meta {
@@ -125,6 +135,8 @@ class __$$DietsPaginationImplCopyWithImpl<$Res>
_$DietsPaginationImpl _value, $Res Function(_$DietsPaginationImpl) _then)
: super(_value, _then);
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -192,12 +204,14 @@ class _$DietsPaginationImpl implements _DietsPagination {
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_data), links, meta);
@JsonKey(ignore: true)
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DietsPaginationImplCopyWith<_$DietsPaginationImpl> get copyWith =>
@@ -230,8 +244,11 @@ abstract class _DietsPagination implements DietsPagination {
@override
@JsonKey(name: "meta")
Meta get meta;
/// Create a copy of DietsPagination
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DietsPaginationImplCopyWith<_$DietsPaginationImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -268,8 +285,12 @@ mixin _$Diet {
@JsonKey(name: "total_comments")
int get totalComments => throw _privateConstructorUsedError;
/// Serializes this Diet to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of Diet
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$DietCopyWith<Diet> get copyWith => throw _privateConstructorUsedError;
}
@@ -307,6 +328,8 @@ class _$DietCopyWithImpl<$Res, $Val extends Diet>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Diet
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -375,6 +398,8 @@ class _$DietCopyWithImpl<$Res, $Val extends Diet>
) as $Val);
}
/// Create a copy of Diet
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$DietTypeCopyWith<$Res> get type {
@@ -383,6 +408,8 @@ class _$DietCopyWithImpl<$Res, $Val extends Diet>
});
}
/// Create a copy of Diet
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AuthorCopyWith<$Res> get author {
@@ -427,6 +454,8 @@ class __$$DietImplCopyWithImpl<$Res>
__$$DietImplCopyWithImpl(_$DietImpl _value, $Res Function(_$DietImpl) _then)
: super(_value, _then);
/// Create a copy of Diet
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -590,7 +619,7 @@ class _$DietImpl implements _Diet {
other.totalComments == totalComments));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -607,7 +636,9 @@ class _$DietImpl implements _Diet {
totalViews,
totalComments);
@JsonKey(ignore: true)
/// Create a copy of Diet
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DietImplCopyWith<_$DietImpl> get copyWith =>
@@ -676,8 +707,11 @@ abstract class _Diet implements Diet {
@override
@JsonKey(name: "total_comments")
int get totalComments;
/// Create a copy of Diet
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DietImplCopyWith<_$DietImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -697,8 +731,12 @@ mixin _$Author {
@JsonKey(name: "author_is_me")
bool get authorIsMe => throw _privateConstructorUsedError;
/// Serializes this Author to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$AuthorCopyWith<Author> get copyWith => throw _privateConstructorUsedError;
}
@@ -724,6 +762,8 @@ class _$AuthorCopyWithImpl<$Res, $Val extends Author>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -775,6 +815,8 @@ class __$$AuthorImplCopyWithImpl<$Res>
_$AuthorImpl _value, $Res Function(_$AuthorImpl) _then)
: super(_value, _then);
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -849,12 +891,14 @@ class _$AuthorImpl implements _Author {
other.authorIsMe == authorIsMe));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, authorSlug, authorName, authorProfileIcon, authorIsMe);
@JsonKey(ignore: true)
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$AuthorImplCopyWith<_$AuthorImpl> get copyWith =>
@@ -891,8 +935,11 @@ abstract class _Author implements Author {
@override
@JsonKey(name: "author_is_me")
bool get authorIsMe;
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$AuthorImplCopyWith<_$AuthorImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -912,8 +959,12 @@ mixin _$DailySchedule {
@JsonKey(name: "quantity")
int get quantity => throw _privateConstructorUsedError;
/// Serializes this DailySchedule to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$DailyScheduleCopyWith<DailySchedule> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -941,6 +992,8 @@ class _$DailyScheduleCopyWithImpl<$Res, $Val extends DailySchedule>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -993,6 +1046,8 @@ class __$$DailyScheduleImplCopyWithImpl<$Res>
_$DailyScheduleImpl _value, $Res Function(_$DailyScheduleImpl) _then)
: super(_value, _then);
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1064,11 +1119,13 @@ class _$DailyScheduleImpl implements _DailySchedule {
other.quantity == quantity));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, name, uniq, portion, quantity);
@JsonKey(ignore: true)
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DailyScheduleImplCopyWith<_$DailyScheduleImpl> get copyWith =>
@@ -1105,8 +1162,11 @@ abstract class _DailySchedule implements DailySchedule {
@override
@JsonKey(name: "quantity")
int get quantity;
/// Create a copy of DailySchedule
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DailyScheduleImplCopyWith<_$DailyScheduleImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -1126,8 +1186,12 @@ mixin _$DietType {
@JsonKey(name: "meat")
bool? get meat => throw _privateConstructorUsedError;
/// Serializes this DietType to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of DietType
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$DietTypeCopyWith<DietType> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -1154,6 +1218,8 @@ class _$DietTypeCopyWithImpl<$Res, $Val extends DietType>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DietType
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1206,6 +1272,8 @@ class __$$DietTypeImplCopyWithImpl<$Res>
_$DietTypeImpl _value, $Res Function(_$DietTypeImpl) _then)
: super(_value, _then);
/// Create a copy of DietType
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -1276,11 +1344,13 @@ class _$DietTypeImpl implements _DietType {
(identical(other.meat, meat) || other.meat == meat));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, alko, veg, corb, meat);
@JsonKey(ignore: true)
/// Create a copy of DietType
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DietTypeImplCopyWith<_$DietTypeImpl> get copyWith =>
@@ -1316,8 +1386,11 @@ abstract class _DietType implements DietType {
@override
@JsonKey(name: "meat")
bool? get meat;
/// Create a copy of DietType
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DietTypeImplCopyWith<_$DietTypeImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -41,8 +41,12 @@ mixin _$FeedBlogPostModel {
@JsonKey(name: "was_liked_by_me")
bool get wasLikedByMe => throw _privateConstructorUsedError;
/// Serializes this FeedBlogPostModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$FeedBlogPostModelCopyWith<FeedBlogPostModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -81,6 +85,8 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -154,6 +160,8 @@ class _$FeedBlogPostModelCopyWithImpl<$Res, $Val extends FeedBlogPostModel>
) as $Val);
}
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AuthorCopyWith<$Res> get author {
@@ -198,6 +206,8 @@ class __$$FeedBlogPostModelImplCopyWithImpl<$Res>
$Res Function(_$FeedBlogPostModelImpl) _then)
: super(_value, _then);
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -360,7 +370,7 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel {
other.wasLikedByMe == wasLikedByMe));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -378,7 +388,9 @@ class _$FeedBlogPostModelImpl implements _FeedBlogPostModel {
totalComments,
wasLikedByMe);
@JsonKey(ignore: true)
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith =>
@@ -446,8 +458,11 @@ abstract class _FeedBlogPostModel implements FeedBlogPostModel {
@override
@JsonKey(name: "was_liked_by_me")
bool get wasLikedByMe;
/// Create a copy of FeedBlogPostModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$FeedBlogPostModelImplCopyWith<_$FeedBlogPostModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -26,8 +26,12 @@ mixin _$FeedBlogPostSettingsModel {
throw _privateConstructorUsedError;
Meta get meta => throw _privateConstructorUsedError;
/// Serializes this FeedBlogPostSettingsModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$FeedBlogPostSettingsModelCopyWith<FeedBlogPostSettingsModel> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -56,6 +60,8 @@ class _$FeedBlogPostSettingsModelCopyWithImpl<$Res,
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -74,6 +80,8 @@ class _$FeedBlogPostSettingsModelCopyWithImpl<$Res,
) as $Val);
}
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$MetaCopyWith<$Res> get meta {
@@ -110,6 +118,8 @@ class __$$FeedBlogPostSettingsModelImplCopyWithImpl<$Res>
$Res Function(_$FeedBlogPostSettingsModelImpl) _then)
: super(_value, _then);
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -169,12 +179,14 @@ class _$FeedBlogPostSettingsModelImpl implements _FeedBlogPostSettingsModel {
(identical(other.meta, meta) || other.meta == meta));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_feedBlogPostList), meta);
@JsonKey(ignore: true)
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl>
@@ -203,8 +215,11 @@ abstract class _FeedBlogPostSettingsModel implements FeedBlogPostSettingsModel {
List<FeedBlogPostModel> get feedBlogPostList;
@override
Meta get meta;
/// Create a copy of FeedBlogPostSettingsModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$FeedBlogPostSettingsModelImplCopyWith<_$FeedBlogPostSettingsModelImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -45,8 +45,12 @@ mixin _$Recipes {
int get viewsCount => throw _privateConstructorUsedError;
Author get author => throw _privateConstructorUsedError;
/// Serializes this Recipes to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$RecipesCopyWith<Recipes> get copyWith => throw _privateConstructorUsedError;
}
@@ -87,6 +91,8 @@ class _$RecipesCopyWithImpl<$Res, $Val extends Recipes>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -180,6 +186,8 @@ class _$RecipesCopyWithImpl<$Res, $Val extends Recipes>
) as $Val);
}
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AuthorCopyWith<$Res> get author {
@@ -227,6 +235,8 @@ class __$$RecipesImplCopyWithImpl<$Res>
_$RecipesImpl _value, $Res Function(_$RecipesImpl) _then)
: super(_value, _then);
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -440,7 +450,7 @@ class _$RecipesImpl implements _Recipes {
(identical(other.author, author) || other.author == author));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
@@ -462,7 +472,9 @@ class _$RecipesImpl implements _Recipes {
viewsCount,
author);
@JsonKey(ignore: true)
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$RecipesImplCopyWith<_$RecipesImpl> get copyWith =>
@@ -539,8 +551,11 @@ abstract class _Recipes implements Recipes {
int get viewsCount;
@override
Author get author;
/// Create a copy of Recipes
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$RecipesImplCopyWith<_$RecipesImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -555,8 +570,12 @@ mixin _$Ingredient {
String? get unit => throw _privateConstructorUsedError;
String get portion => throw _privateConstructorUsedError;
/// Serializes this Ingredient to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$IngredientCopyWith<Ingredient> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -580,6 +599,8 @@ class _$IngredientCopyWithImpl<$Res, $Val extends Ingredient>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -623,6 +644,8 @@ class __$$IngredientImplCopyWithImpl<$Res>
_$IngredientImpl _value, $Res Function(_$IngredientImpl) _then)
: super(_value, _then);
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -678,11 +701,13 @@ class _$IngredientImpl implements _Ingredient {
(identical(other.portion, portion) || other.portion == portion));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, name, unit, portion);
@JsonKey(ignore: true)
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$IngredientImplCopyWith<_$IngredientImpl> get copyWith =>
@@ -711,8 +736,11 @@ abstract class _Ingredient implements Ingredient {
String? get unit;
@override
String get portion;
/// Create a copy of Ingredient
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$IngredientImplCopyWith<_$IngredientImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -726,8 +754,12 @@ mixin _$Step {
String get image => throw _privateConstructorUsedError;
String get description => throw _privateConstructorUsedError;
/// Serializes this Step to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$StepCopyWith<Step> get copyWith => throw _privateConstructorUsedError;
}
@@ -749,6 +781,8 @@ class _$StepCopyWithImpl<$Res, $Val extends Step>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -785,6 +819,8 @@ class __$$StepImplCopyWithImpl<$Res>
__$$StepImplCopyWithImpl(_$StepImpl _value, $Res Function(_$StepImpl) _then)
: super(_value, _then);
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -832,11 +868,13 @@ class _$StepImpl implements _Step {
other.description == description));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, image, description);
@JsonKey(ignore: true)
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$StepImplCopyWith<_$StepImpl> get copyWith =>
@@ -861,8 +899,11 @@ abstract class _Step implements Step {
String get image;
@override
String get description;
/// Create a copy of Step
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$StepImplCopyWith<_$StepImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -23,8 +23,12 @@ mixin _$RecipesPagination {
@JsonKey(name: 'data')
List<Recipes> get recipesList => throw _privateConstructorUsedError;
/// Serializes this RecipesPagination to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$RecipesPaginationCopyWith<RecipesPagination> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -48,6 +52,8 @@ class _$RecipesPaginationCopyWithImpl<$Res, $Val extends RecipesPagination>
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -81,6 +87,8 @@ class __$$RecipesPaginationImplCopyWithImpl<$Res>
$Res Function(_$RecipesPaginationImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -128,12 +136,14 @@ class _$RecipesPaginationImpl implements _RecipesPagination {
.equals(other._recipesList, _recipesList));
}
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_recipesList));
@JsonKey(ignore: true)
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$RecipesPaginationImplCopyWith<_$RecipesPaginationImpl> get copyWith =>
@@ -159,8 +169,11 @@ abstract class _RecipesPagination implements RecipesPagination {
@override
@JsonKey(name: 'data')
List<Recipes> get recipesList;
/// Create a copy of RecipesPagination
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
_$$RecipesPaginationImplCopyWith<_$RecipesPaginationImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -84,6 +84,9 @@ class _$CommentsStateCopyWithImpl<$Res, $Val extends CommentsState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -100,6 +103,9 @@ class __$$CommentsStateImplCopyWithImpl<$Res>
__$$CommentsStateImplCopyWithImpl(
_$CommentsStateImpl _value, $Res Function(_$CommentsStateImpl) _then)
: super(_value, _then);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -214,6 +220,9 @@ class __$$CommentsStateLoadingImplCopyWithImpl<$Res>
__$$CommentsStateLoadingImplCopyWithImpl(_$CommentsStateLoadingImpl _value,
$Res Function(_$CommentsStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -334,6 +343,8 @@ class __$$CommentsStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$CommentsStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -352,6 +363,8 @@ class __$$CommentsStateLoadedImplCopyWithImpl<$Res>
));
}
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$CommentModelCopyWith<$Res> get comment {
@@ -388,7 +401,9 @@ class _$CommentsStateLoadedImpl implements CommentsStateLoaded {
@override
int get hashCode => Object.hash(runtimeType, comment, replyId);
@JsonKey(ignore: true)
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$CommentsStateLoadedImplCopyWith<_$CommentsStateLoadedImpl> get copyWith =>
@@ -477,7 +492,10 @@ abstract class CommentsStateLoaded implements CommentsState {
CommentModel get comment;
int? get replyId;
@JsonKey(ignore: true)
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CommentsStateLoadedImplCopyWith<_$CommentsStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -499,6 +517,8 @@ class __$$CommentsStateErrorImplCopyWithImpl<$Res>
$Res Function(_$CommentsStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -538,7 +558,9 @@ class _$CommentsStateErrorImpl implements CommentsStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
@JsonKey(ignore: true)
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$CommentsStateErrorImplCopyWith<_$CommentsStateErrorImpl> get copyWith =>
@@ -625,7 +647,10 @@ abstract class CommentsStateError implements CommentsState {
_$CommentsStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
/// Create a copy of CommentsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CommentsStateErrorImplCopyWith<_$CommentsStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -84,6 +84,9 @@ class _$DietsStateCopyWithImpl<$Res, $Val extends DietsState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -100,6 +103,9 @@ class __$$DietsStateImplCopyWithImpl<$Res>
__$$DietsStateImplCopyWithImpl(
_$DietsStateImpl _value, $Res Function(_$DietsStateImpl) _then)
: super(_value, _then);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -214,6 +220,9 @@ class __$$DietsStateLoadingImplCopyWithImpl<$Res>
__$$DietsStateLoadingImplCopyWithImpl(_$DietsStateLoadingImpl _value,
$Res Function(_$DietsStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -333,6 +342,8 @@ class __$$DietsStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$DietsStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -346,6 +357,8 @@ class __$$DietsStateLoadedImplCopyWithImpl<$Res>
));
}
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$DietsPaginationCopyWith<$Res> get diets {
@@ -379,7 +392,9 @@ class _$DietsStateLoadedImpl implements DietsStateLoaded {
@override
int get hashCode => Object.hash(runtimeType, diets);
@JsonKey(ignore: true)
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith =>
@@ -466,7 +481,10 @@ abstract class DietsStateLoaded implements DietsState {
_$DietsStateLoadedImpl;
DietsPagination get diets;
@JsonKey(ignore: true)
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DietsStateLoadedImplCopyWith<_$DietsStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -488,6 +506,8 @@ class __$$DietsStateErrorImplCopyWithImpl<$Res>
_$DietsStateErrorImpl _value, $Res Function(_$DietsStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -527,7 +547,9 @@ class _$DietsStateErrorImpl implements DietsStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
@JsonKey(ignore: true)
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith =>
@@ -614,7 +636,10 @@ abstract class DietsStateError implements DietsState {
_$DietsStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
/// Create a copy of DietsState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$DietsStateErrorImplCopyWith<_$DietsStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -87,6 +87,9 @@ class _$FeedStateCopyWithImpl<$Res, $Val extends FeedState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -103,6 +106,9 @@ class __$$FeedStateImplCopyWithImpl<$Res>
__$$FeedStateImplCopyWithImpl(
_$FeedStateImpl _value, $Res Function(_$FeedStateImpl) _then)
: super(_value, _then);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -221,6 +227,9 @@ class __$$FeedStateLoadingImplCopyWithImpl<$Res>
__$$FeedStateLoadingImplCopyWithImpl(_$FeedStateLoadingImpl _value,
$Res Function(_$FeedStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -342,6 +351,8 @@ class __$$FeedStateLoadedImplCopyWithImpl<$Res>
_$FeedStateLoadedImpl _value, $Res Function(_$FeedStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -401,7 +412,9 @@ class _$FeedStateLoadedImpl implements FeedStateLoaded {
int get hashCode => Object.hash(runtimeType,
const DeepCollectionEquality().hash(_feedBlogPostList), isLoading);
@JsonKey(ignore: true)
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith =>
@@ -494,7 +507,10 @@ abstract class FeedStateLoaded implements FeedState {
List<FeedBlogPostModel> get feedBlogPostList;
bool get isLoading;
@JsonKey(ignore: true)
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$FeedStateLoadedImplCopyWith<_$FeedStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -516,6 +532,8 @@ class __$$FeedStateErrorImplCopyWithImpl<$Res>
_$FeedStateErrorImpl _value, $Res Function(_$FeedStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -555,7 +573,9 @@ class _$FeedStateErrorImpl implements FeedStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
@JsonKey(ignore: true)
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith =>
@@ -646,7 +666,10 @@ abstract class FeedStateError implements FeedState {
_$FeedStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
/// Create a copy of FeedState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$FeedStateErrorImplCopyWith<_$FeedStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -8,6 +8,10 @@ class RecipesCubit extends Cubit<RecipesState> {
final FeedRepository feedRepository;
final RecipeRepository recipeRepository;
Set<int> _selectedTags = {};
int currentPage = 1;
late int lastPage;
bool isLoading = false;
String? _query;
RecipesCubit({
required this.feedRepository,
@@ -18,6 +22,7 @@ class RecipesCubit extends Cubit<RecipesState> {
String? query,
}) async {
try {
_query = query;
final recipesList = await feedRepository.getRecipes(
tags: _selectedTags.toList(),
query: query,
@@ -28,12 +33,42 @@ class RecipesCubit extends Cubit<RecipesState> {
recipesTags: recipesTags,
selectedTags: _selectedTags,
selectedTagsCounter: _selectedTags.length,
isLoading: isLoading,
));
} catch (e) {
emit(RecipesState.error(errorMessage: e.toString()));
}
}
loadNextPage() async {
if (currentPage < lastPage && !isLoading) {
isLoading = true;
emit((state as RecipesStateLoaded).copyWith(isLoading: isLoading));
try {
if (currentPage < lastPage) {
currentPage++;
final recipesList = await feedRepository.getRecipes(
page: currentPage,
tags: _selectedTags.toList(),
query: _query,
);
isLoading = false;
emit((state as RecipesStateLoaded).copyWith(
recipesList: [
...(state as RecipesStateLoaded).recipesList,
...recipesList,
],
isLoading: isLoading,
));
}
} catch (e) {
emit(RecipesState.error(errorMessage: e.toString()));
}
}
}
updateTags(RecipeTag tag) {
_selectedTags.contains(tag.id) ? _selectedTags.remove(tag.id) : _selectedTags.add(tag.id);
emit((state as RecipesStateLoaded).copyWith(

View File

@@ -15,6 +15,7 @@ abstract class RecipesState with _$RecipesState {
required List<RecipeTag> recipesTags,
required Set<int> selectedTags,
required int selectedTagsCounter,
required bool isLoading,
}) = RecipesStateLoaded;
const factory RecipesState.error({

View File

@@ -24,7 +24,8 @@ mixin _$RecipesState {
List<Recipes> recipesList,
List<RecipeTag> recipesTags,
Set<int> selectedTags,
int selectedTagsCounter)
int selectedTagsCounter,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) =>
@@ -34,7 +35,7 @@ mixin _$RecipesState {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) =>
@@ -44,7 +45,7 @@ mixin _$RecipesState {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
@@ -93,6 +94,9 @@ class _$RecipesStateCopyWithImpl<$Res, $Val extends RecipesState>
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -109,6 +113,9 @@ class __$$RecipesStateImplCopyWithImpl<$Res>
__$$RecipesStateImplCopyWithImpl(
_$RecipesStateImpl _value, $Res Function(_$RecipesStateImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -139,7 +146,8 @@ class _$RecipesStateImpl implements _RecipesState {
List<Recipes> recipesList,
List<RecipeTag> recipesTags,
Set<int> selectedTags,
int selectedTagsCounter)
int selectedTagsCounter,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
@@ -152,7 +160,7 @@ class _$RecipesStateImpl implements _RecipesState {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
@@ -165,7 +173,7 @@ class _$RecipesStateImpl implements _RecipesState {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
@@ -232,6 +240,9 @@ class __$$RecipesStateLoadingImplCopyWithImpl<$Res>
__$$RecipesStateLoadingImplCopyWithImpl(_$RecipesStateLoadingImpl _value,
$Res Function(_$RecipesStateLoadingImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
@@ -263,7 +274,8 @@ class _$RecipesStateLoadingImpl implements RecipesStateLoading {
List<Recipes> recipesList,
List<RecipeTag> recipesTags,
Set<int> selectedTags,
int selectedTagsCounter)
int selectedTagsCounter,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
@@ -276,7 +288,7 @@ class _$RecipesStateLoadingImpl implements RecipesStateLoading {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
@@ -289,7 +301,7 @@ class _$RecipesStateLoadingImpl implements RecipesStateLoading {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
@@ -352,7 +364,8 @@ abstract class _$$RecipesStateLoadedImplCopyWith<$Res> {
{List<Recipes> recipesList,
List<RecipeTag> recipesTags,
Set<int> selectedTags,
int selectedTagsCounter});
int selectedTagsCounter,
bool isLoading});
}
/// @nodoc
@@ -363,6 +376,8 @@ class __$$RecipesStateLoadedImplCopyWithImpl<$Res>
$Res Function(_$RecipesStateLoadedImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -370,6 +385,7 @@ class __$$RecipesStateLoadedImplCopyWithImpl<$Res>
Object? recipesTags = null,
Object? selectedTags = null,
Object? selectedTagsCounter = null,
Object? isLoading = null,
}) {
return _then(_$RecipesStateLoadedImpl(
recipesList: null == recipesList
@@ -388,6 +404,10 @@ class __$$RecipesStateLoadedImplCopyWithImpl<$Res>
? _value.selectedTagsCounter
: selectedTagsCounter // ignore: cast_nullable_to_non_nullable
as int,
isLoading: null == isLoading
? _value.isLoading
: isLoading // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
@@ -399,7 +419,8 @@ class _$RecipesStateLoadedImpl implements RecipesStateLoaded {
{required final List<Recipes> recipesList,
required final List<RecipeTag> recipesTags,
required final Set<int> selectedTags,
required this.selectedTagsCounter})
required this.selectedTagsCounter,
required this.isLoading})
: _recipesList = recipesList,
_recipesTags = recipesTags,
_selectedTags = selectedTags;
@@ -430,10 +451,12 @@ class _$RecipesStateLoadedImpl implements RecipesStateLoaded {
@override
final int selectedTagsCounter;
@override
final bool isLoading;
@override
String toString() {
return 'RecipesState.loaded(recipesList: $recipesList, recipesTags: $recipesTags, selectedTags: $selectedTags, selectedTagsCounter: $selectedTagsCounter)';
return 'RecipesState.loaded(recipesList: $recipesList, recipesTags: $recipesTags, selectedTags: $selectedTags, selectedTagsCounter: $selectedTagsCounter, isLoading: $isLoading)';
}
@override
@@ -448,7 +471,9 @@ class _$RecipesStateLoadedImpl implements RecipesStateLoaded {
const DeepCollectionEquality()
.equals(other._selectedTags, _selectedTags) &&
(identical(other.selectedTagsCounter, selectedTagsCounter) ||
other.selectedTagsCounter == selectedTagsCounter));
other.selectedTagsCounter == selectedTagsCounter) &&
(identical(other.isLoading, isLoading) ||
other.isLoading == isLoading));
}
@override
@@ -457,9 +482,12 @@ class _$RecipesStateLoadedImpl implements RecipesStateLoaded {
const DeepCollectionEquality().hash(_recipesList),
const DeepCollectionEquality().hash(_recipesTags),
const DeepCollectionEquality().hash(_selectedTags),
selectedTagsCounter);
selectedTagsCounter,
isLoading);
@JsonKey(ignore: true)
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$RecipesStateLoadedImplCopyWith<_$RecipesStateLoadedImpl> get copyWith =>
@@ -475,11 +503,13 @@ class _$RecipesStateLoadedImpl implements RecipesStateLoaded {
List<Recipes> recipesList,
List<RecipeTag> recipesTags,
Set<int> selectedTags,
int selectedTagsCounter)
int selectedTagsCounter,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
return loaded(recipesList, recipesTags, selectedTags, selectedTagsCounter);
return loaded(
recipesList, recipesTags, selectedTags, selectedTagsCounter, isLoading);
}
@override
@@ -488,12 +518,12 @@ class _$RecipesStateLoadedImpl implements RecipesStateLoaded {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
return loaded?.call(
recipesList, recipesTags, selectedTags, selectedTagsCounter);
recipesList, recipesTags, selectedTags, selectedTagsCounter, isLoading);
}
@override
@@ -502,14 +532,14 @@ class _$RecipesStateLoadedImpl implements RecipesStateLoaded {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(
recipesList, recipesTags, selectedTags, selectedTagsCounter);
return loaded(recipesList, recipesTags, selectedTags, selectedTagsCounter,
isLoading);
}
return orElse();
}
@@ -557,13 +587,18 @@ abstract class RecipesStateLoaded implements RecipesState {
{required final List<Recipes> recipesList,
required final List<RecipeTag> recipesTags,
required final Set<int> selectedTags,
required final int selectedTagsCounter}) = _$RecipesStateLoadedImpl;
required final int selectedTagsCounter,
required final bool isLoading}) = _$RecipesStateLoadedImpl;
List<Recipes> get recipesList;
List<RecipeTag> get recipesTags;
Set<int> get selectedTags;
int get selectedTagsCounter;
@JsonKey(ignore: true)
bool get isLoading;
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$RecipesStateLoadedImplCopyWith<_$RecipesStateLoadedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -585,6 +620,8 @@ class __$$RecipesStateErrorImplCopyWithImpl<$Res>
$Res Function(_$RecipesStateErrorImpl) _then)
: super(_value, _then);
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
@@ -624,7 +661,9 @@ class _$RecipesStateErrorImpl implements RecipesStateError {
@override
int get hashCode => Object.hash(runtimeType, errorMessage);
@JsonKey(ignore: true)
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$RecipesStateErrorImplCopyWith<_$RecipesStateErrorImpl> get copyWith =>
@@ -640,7 +679,8 @@ class _$RecipesStateErrorImpl implements RecipesStateError {
List<Recipes> recipesList,
List<RecipeTag> recipesTags,
Set<int> selectedTags,
int selectedTagsCounter)
int selectedTagsCounter,
bool isLoading)
loaded,
required TResult Function(String errorMessage) error,
}) {
@@ -653,7 +693,7 @@ class _$RecipesStateErrorImpl implements RecipesStateError {
TResult? Function()? $default, {
TResult? Function()? loading,
TResult? Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult? Function(String errorMessage)? error,
}) {
@@ -666,7 +706,7 @@ class _$RecipesStateErrorImpl implements RecipesStateError {
TResult Function()? $default, {
TResult Function()? loading,
TResult Function(List<Recipes> recipesList, List<RecipeTag> recipesTags,
Set<int> selectedTags, int selectedTagsCounter)?
Set<int> selectedTags, int selectedTagsCounter, bool isLoading)?
loaded,
TResult Function(String errorMessage)? error,
required TResult orElse(),
@@ -720,7 +760,10 @@ abstract class RecipesStateError implements RecipesState {
_$RecipesStateErrorImpl;
String get errorMessage;
@JsonKey(ignore: true)
/// Create a copy of RecipesState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$RecipesStateErrorImplCopyWith<_$RecipesStateErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -10,11 +10,12 @@ import 'package:eatvio_app/features/feed/presentation/widgets/diets_widget.dart'
import 'package:eatvio_app/features/feed/presentation/widgets/recipes_widget.dart';
import 'package:eatvio_app/features/feed/presentation/widgets/tags_modal_widget.dart';
import 'package:eatvio_app/theme/theme_helper.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
final bucket = PageStorageBucket();
class FeedScreen extends StatefulWidget {
const FeedScreen({super.key});
@@ -32,11 +33,25 @@ class _FeedScreenState extends State<FeedScreen> {
@override
void initState() {
blogPostsScrollController.addListener(_onScroll);
blogPostsScrollController.addListener(_onScrollBlogPosts);
recipesScrollController.addListener(_onScrollBlogRecipes);
dietsScrollController.addListener(_onScrollBlogDiets);
super.initState();
}
_onScroll() {
_onScrollBlogPosts() {
if (blogPostsScrollController.offset >= blogPostsScrollController.position.maxScrollExtent && !blogPostsScrollController.position.outOfRange) {
context.read<FeedCubit>().loadNextPage();
}
}
_onScrollBlogRecipes() {
if (blogPostsScrollController.offset >= blogPostsScrollController.position.maxScrollExtent && !blogPostsScrollController.position.outOfRange) {
context.read<FeedCubit>().loadNextPage();
}
}
_onScrollBlogDiets() {
if (blogPostsScrollController.offset >= blogPostsScrollController.position.maxScrollExtent && !blogPostsScrollController.position.outOfRange) {
context.read<FeedCubit>().loadNextPage();
}
@@ -45,6 +60,8 @@ class _FeedScreenState extends State<FeedScreen> {
@override
void dispose() {
blogPostsScrollController.dispose();
recipesScrollController.dispose();
dietsScrollController.dispose();
super.dispose();
}
@@ -89,7 +106,11 @@ class _FeedScreenState extends State<FeedScreen> {
),
backgroundColor: Colors.grey.shade200,
body: NestedScrollView(
controller: blogPostsScrollController,
controller: _selectedChipIndex == 0
? blogPostsScrollController
: _selectedChipIndex == 1
? recipesScrollController
: dietsScrollController,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
SliverAppBar(
@@ -139,10 +160,10 @@ class _FeedScreenState extends State<FeedScreen> {
return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 8),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) {
if (index == state.feedBlogPostList.length) {
return CupertinoActivityIndicator();
return CircularProgressIndicator();
}
return BlogPostWidget(feedBlogPostModel: state.feedBlogPostList[index]);
},
@@ -165,7 +186,7 @@ class _FeedScreenState extends State<FeedScreen> {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CupertinoActivityIndicator(),
child: CircularProgressIndicator(),
),
);
}
@@ -206,7 +227,7 @@ class _FeedScreenState extends State<FeedScreen> {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CupertinoActivityIndicator(),
child: CircularProgressIndicator(),
),
);
}
@@ -247,7 +268,7 @@ class _FeedScreenState extends State<FeedScreen> {
return Scaffold(
backgroundColor: Colors.grey.shade200,
body: Center(
child: CupertinoActivityIndicator(),
child: CircularProgressIndicator(),
),
);
}
@@ -319,6 +340,7 @@ class _FeedScreenState extends State<FeedScreen> {
switch (_selectedChipIndex) {
case 1:
context.read<RecipesCubit>().loadRecipesList(query: query);
break;
}
},
);

View File

@@ -11,7 +11,7 @@ class FeedRepository {
Future<FeedBlogPostSettingsModel> getFeedBlogPosts({int page = 1}) async {
try {
return (await feedService.getBlocPostList(page: page));
return (await feedService.getBlogPostList(page: page));
} catch (e) {
rethrow;
}
@@ -20,11 +20,13 @@ class FeedRepository {
Future<List<Recipes>> getRecipes({
String? query,
List<int>? tags,
int page = 1
}) async {
try {
return (await feedService.getRecipes(
query: query,
tags: tags,
page: page,
))
.recipesList;
} catch (e) {
@@ -32,9 +34,9 @@ class FeedRepository {
}
}
Future<DietsPagination> getDiets() async {
Future<DietsPagination> getDiets({int page = 1}) async {
try {
return (await feedService.getDiets());
return (await feedService.getDiets(page: page));
} catch (e) {
rethrow;
}

View File

@@ -12,18 +12,21 @@ abstract class FeedService {
factory FeedService(Dio dio, {String baseUrl}) = _FeedService;
@GET('/api/blogPosts/index?page={page}')
Future<FeedBlogPostSettingsModel> getBlocPostList({
Future<FeedBlogPostSettingsModel> getBlogPostList({
@Path() required int page,
});
@GET('/api/recipes/index')
Future<RecipesPagination> getRecipes({
@Path() required int page,
@Query('filters[tags][tags.id][\$in][]') required List<int>? tags,
@Query('filters[title][\$contains]') required String? query,
});
@GET('/api/diets/index')
Future<DietsPagination> getDiets();
Future<DietsPagination> getDiets({
@Path() required int page,
});
@GET('/api/blogPosts/{id}/comments/show')
Future<CommentModel> getBlogPostComments({

View File

@@ -22,7 +22,7 @@ class _FeedService implements FeedService {
final ParseErrorLogger? errorLogger;
@override
Future<FeedBlogPostSettingsModel> getBlocPostList({required int page}) async {
Future<FeedBlogPostSettingsModel> getBlogPostList({required int page}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
@@ -56,6 +56,7 @@ class _FeedService implements FeedService {
@override
Future<RecipesPagination> getRecipes({
required int page,
List<int>? tags,
String? query,
}) async {
@@ -95,7 +96,7 @@ class _FeedService implements FeedService {
}
@override
Future<DietsPagination> getDiets() async {
Future<DietsPagination> getDiets({required int page}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};