diet creation scrren is done

This commit is contained in:
Username1548
2024-12-11 19:15:25 +07:00
parent 2e0a8c559f
commit 2f168a2f35
63 changed files with 3113 additions and 633 deletions

View File

@@ -39,6 +39,23 @@ class Diet with _$Diet {
factory Diet.fromJson(Map<String, dynamic> json) => _$DietFromJson(json);
}
@freezed
class CreatedDiet with _$CreatedDiet {
const factory CreatedDiet({
@JsonKey(name: "id") required int id,
}) = _CreatedDiet;
factory CreatedDiet.fromJson(Map<String, dynamic> json) => _$CreatedDietFromJson(json);
}
int parseDuration(dynamic duration) {
if (duration is String) {
return int.parse(duration);
}else {
return duration;
}
}
@freezed
class Author with _$Author {
const factory Author({
@@ -46,7 +63,8 @@ class Author with _$Author {
@JsonKey(name: "author_name") required String authorName,
@JsonKey(name: "author_profile_icon") required String authorProfileIcon,
@JsonKey(name: "author_is_me") required bool authorIsMe,
@JsonKey(name: "is_entity_subscribed_by_me") required bool isEntitySubscribedByMe,
@JsonKey(name: "is_entity_subscribed_by_me") bool? isEntitySubscribedByMe,
@JsonKey(name: "author_place_in_rating") int? authorPlaceInRating,
}) = _Author;
factory Author.fromJson(Map<String, dynamic> json) => _$AuthorFromJson(json);
@@ -60,7 +78,7 @@ class DailySchedule with _$DailySchedule {
@JsonKey(name: "portion") required Portion portion,
@JsonKey(name: "quantity") required int quantity,
@JsonKey(includeToJson: false, includeFromJson: false) DailyNutrition? dailyNutrition,
@JsonKey(name: 'product_nutritional_value_id', includeFromJson: false, includeIfNull: false) String? productNutritionalValueId,
@JsonKey(name: 'product_nutritional_value_id', includeToJson: true, includeFromJson: false, includeIfNull: false) String? productNutritionalValueId,
}) = _DailySchedule;
factory DailySchedule.fromJson(Map<String, dynamic> json) => _$DailyScheduleFromJson(json);
@@ -79,6 +97,7 @@ final portionValues = EnumValues({"grams": Portion.GRAMS, "milliliters": Portion
@freezed
class DietType with _$DietType {
const DietType._();
const factory DietType({
@JsonKey(name: "light") bool? light,
@JsonKey(name: "veg") bool? veg,
@@ -87,6 +106,10 @@ class DietType with _$DietType {
}) = _DietType;
factory DietType.fromJson(Map<String, dynamic> json) => _$DietTypeFromJson(json);
bool hasAtLeastOneType() {
return light ?? false || (veg ?? false) || (carb ?? false) || (meat ?? false);
}
}
class EnumValues<T> {

View File

@@ -798,6 +798,159 @@ abstract class _Diet implements Diet {
throw _privateConstructorUsedError;
}
CreatedDiet _$CreatedDietFromJson(Map<String, dynamic> json) {
return _CreatedDiet.fromJson(json);
}
/// @nodoc
mixin _$CreatedDiet {
@JsonKey(name: "id")
int get id => throw _privateConstructorUsedError;
/// Serializes this CreatedDiet to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of CreatedDiet
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$CreatedDietCopyWith<CreatedDiet> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $CreatedDietCopyWith<$Res> {
factory $CreatedDietCopyWith(
CreatedDiet value, $Res Function(CreatedDiet) then) =
_$CreatedDietCopyWithImpl<$Res, CreatedDiet>;
@useResult
$Res call({@JsonKey(name: "id") int id});
}
/// @nodoc
class _$CreatedDietCopyWithImpl<$Res, $Val extends CreatedDiet>
implements $CreatedDietCopyWith<$Res> {
_$CreatedDietCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of CreatedDiet
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
) as $Val);
}
}
/// @nodoc
abstract class _$$CreatedDietImplCopyWith<$Res>
implements $CreatedDietCopyWith<$Res> {
factory _$$CreatedDietImplCopyWith(
_$CreatedDietImpl value, $Res Function(_$CreatedDietImpl) then) =
__$$CreatedDietImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({@JsonKey(name: "id") int id});
}
/// @nodoc
class __$$CreatedDietImplCopyWithImpl<$Res>
extends _$CreatedDietCopyWithImpl<$Res, _$CreatedDietImpl>
implements _$$CreatedDietImplCopyWith<$Res> {
__$$CreatedDietImplCopyWithImpl(
_$CreatedDietImpl _value, $Res Function(_$CreatedDietImpl) _then)
: super(_value, _then);
/// Create a copy of CreatedDiet
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
}) {
return _then(_$CreatedDietImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// @nodoc
@JsonSerializable()
class _$CreatedDietImpl implements _CreatedDiet {
const _$CreatedDietImpl({@JsonKey(name: "id") required this.id});
factory _$CreatedDietImpl.fromJson(Map<String, dynamic> json) =>
_$$CreatedDietImplFromJson(json);
@override
@JsonKey(name: "id")
final int id;
@override
String toString() {
return 'CreatedDiet(id: $id)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CreatedDietImpl &&
(identical(other.id, id) || other.id == id));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, id);
/// Create a copy of CreatedDiet
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$CreatedDietImplCopyWith<_$CreatedDietImpl> get copyWith =>
__$$CreatedDietImplCopyWithImpl<_$CreatedDietImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$CreatedDietImplToJson(
this,
);
}
}
abstract class _CreatedDiet implements CreatedDiet {
const factory _CreatedDiet({@JsonKey(name: "id") required final int id}) =
_$CreatedDietImpl;
factory _CreatedDiet.fromJson(Map<String, dynamic> json) =
_$CreatedDietImpl.fromJson;
@override
@JsonKey(name: "id")
int get id;
/// Create a copy of CreatedDiet
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$CreatedDietImplCopyWith<_$CreatedDietImpl> get copyWith =>
throw _privateConstructorUsedError;
}
Author _$AuthorFromJson(Map<String, dynamic> json) {
return _Author.fromJson(json);
}
@@ -813,7 +966,9 @@ mixin _$Author {
@JsonKey(name: "author_is_me")
bool get authorIsMe => throw _privateConstructorUsedError;
@JsonKey(name: "is_entity_subscribed_by_me")
bool get isEntitySubscribedByMe => throw _privateConstructorUsedError;
bool? get isEntitySubscribedByMe => throw _privateConstructorUsedError;
@JsonKey(name: "author_place_in_rating")
int? get authorPlaceInRating => throw _privateConstructorUsedError;
/// Serializes this Author to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -834,8 +989,8 @@ abstract class $AuthorCopyWith<$Res> {
@JsonKey(name: "author_name") String authorName,
@JsonKey(name: "author_profile_icon") String authorProfileIcon,
@JsonKey(name: "author_is_me") bool authorIsMe,
@JsonKey(name: "is_entity_subscribed_by_me")
bool isEntitySubscribedByMe});
@JsonKey(name: "is_entity_subscribed_by_me") bool? isEntitySubscribedByMe,
@JsonKey(name: "author_place_in_rating") int? authorPlaceInRating});
}
/// @nodoc
@@ -857,7 +1012,8 @@ class _$AuthorCopyWithImpl<$Res, $Val extends Author>
Object? authorName = null,
Object? authorProfileIcon = null,
Object? authorIsMe = null,
Object? isEntitySubscribedByMe = null,
Object? isEntitySubscribedByMe = freezed,
Object? authorPlaceInRating = freezed,
}) {
return _then(_value.copyWith(
authorSlug: null == authorSlug
@@ -876,10 +1032,14 @@ class _$AuthorCopyWithImpl<$Res, $Val extends Author>
? _value.authorIsMe
: authorIsMe // ignore: cast_nullable_to_non_nullable
as bool,
isEntitySubscribedByMe: null == isEntitySubscribedByMe
isEntitySubscribedByMe: freezed == isEntitySubscribedByMe
? _value.isEntitySubscribedByMe
: isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable
as bool,
as bool?,
authorPlaceInRating: freezed == authorPlaceInRating
? _value.authorPlaceInRating
: authorPlaceInRating // ignore: cast_nullable_to_non_nullable
as int?,
) as $Val);
}
}
@@ -896,8 +1056,8 @@ abstract class _$$AuthorImplCopyWith<$Res> implements $AuthorCopyWith<$Res> {
@JsonKey(name: "author_name") String authorName,
@JsonKey(name: "author_profile_icon") String authorProfileIcon,
@JsonKey(name: "author_is_me") bool authorIsMe,
@JsonKey(name: "is_entity_subscribed_by_me")
bool isEntitySubscribedByMe});
@JsonKey(name: "is_entity_subscribed_by_me") bool? isEntitySubscribedByMe,
@JsonKey(name: "author_place_in_rating") int? authorPlaceInRating});
}
/// @nodoc
@@ -917,7 +1077,8 @@ class __$$AuthorImplCopyWithImpl<$Res>
Object? authorName = null,
Object? authorProfileIcon = null,
Object? authorIsMe = null,
Object? isEntitySubscribedByMe = null,
Object? isEntitySubscribedByMe = freezed,
Object? authorPlaceInRating = freezed,
}) {
return _then(_$AuthorImpl(
authorSlug: null == authorSlug
@@ -936,10 +1097,14 @@ class __$$AuthorImplCopyWithImpl<$Res>
? _value.authorIsMe
: authorIsMe // ignore: cast_nullable_to_non_nullable
as bool,
isEntitySubscribedByMe: null == isEntitySubscribedByMe
isEntitySubscribedByMe: freezed == isEntitySubscribedByMe
? _value.isEntitySubscribedByMe
: isEntitySubscribedByMe // ignore: cast_nullable_to_non_nullable
as bool,
as bool?,
authorPlaceInRating: freezed == authorPlaceInRating
? _value.authorPlaceInRating
: authorPlaceInRating // ignore: cast_nullable_to_non_nullable
as int?,
));
}
}
@@ -952,8 +1117,8 @@ class _$AuthorImpl implements _Author {
@JsonKey(name: "author_name") required this.authorName,
@JsonKey(name: "author_profile_icon") required this.authorProfileIcon,
@JsonKey(name: "author_is_me") required this.authorIsMe,
@JsonKey(name: "is_entity_subscribed_by_me")
required this.isEntitySubscribedByMe});
@JsonKey(name: "is_entity_subscribed_by_me") this.isEntitySubscribedByMe,
@JsonKey(name: "author_place_in_rating") this.authorPlaceInRating});
factory _$AuthorImpl.fromJson(Map<String, dynamic> json) =>
_$$AuthorImplFromJson(json);
@@ -972,11 +1137,14 @@ class _$AuthorImpl implements _Author {
final bool authorIsMe;
@override
@JsonKey(name: "is_entity_subscribed_by_me")
final bool isEntitySubscribedByMe;
final bool? isEntitySubscribedByMe;
@override
@JsonKey(name: "author_place_in_rating")
final int? authorPlaceInRating;
@override
String toString() {
return 'Author(authorSlug: $authorSlug, authorName: $authorName, authorProfileIcon: $authorProfileIcon, authorIsMe: $authorIsMe, isEntitySubscribedByMe: $isEntitySubscribedByMe)';
return 'Author(authorSlug: $authorSlug, authorName: $authorName, authorProfileIcon: $authorProfileIcon, authorIsMe: $authorIsMe, isEntitySubscribedByMe: $isEntitySubscribedByMe, authorPlaceInRating: $authorPlaceInRating)';
}
@override
@@ -993,13 +1161,21 @@ class _$AuthorImpl implements _Author {
(identical(other.authorIsMe, authorIsMe) ||
other.authorIsMe == authorIsMe) &&
(identical(other.isEntitySubscribedByMe, isEntitySubscribedByMe) ||
other.isEntitySubscribedByMe == isEntitySubscribedByMe));
other.isEntitySubscribedByMe == isEntitySubscribedByMe) &&
(identical(other.authorPlaceInRating, authorPlaceInRating) ||
other.authorPlaceInRating == authorPlaceInRating));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, authorSlug, authorName,
authorProfileIcon, authorIsMe, isEntitySubscribedByMe);
int get hashCode => Object.hash(
runtimeType,
authorSlug,
authorName,
authorProfileIcon,
authorIsMe,
isEntitySubscribedByMe,
authorPlaceInRating);
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@@ -1025,7 +1201,9 @@ abstract class _Author implements Author {
required final String authorProfileIcon,
@JsonKey(name: "author_is_me") required final bool authorIsMe,
@JsonKey(name: "is_entity_subscribed_by_me")
required final bool isEntitySubscribedByMe}) = _$AuthorImpl;
final bool? isEntitySubscribedByMe,
@JsonKey(name: "author_place_in_rating")
final int? authorPlaceInRating}) = _$AuthorImpl;
factory _Author.fromJson(Map<String, dynamic> json) = _$AuthorImpl.fromJson;
@@ -1043,7 +1221,10 @@ abstract class _Author implements Author {
bool get authorIsMe;
@override
@JsonKey(name: "is_entity_subscribed_by_me")
bool get isEntitySubscribedByMe;
bool? get isEntitySubscribedByMe;
@override
@JsonKey(name: "author_place_in_rating")
int? get authorPlaceInRating;
/// Create a copy of Author
/// with the given fields replaced by the non-null parameter values.
@@ -1071,6 +1252,7 @@ mixin _$DailySchedule {
DailyNutrition? get dailyNutrition => throw _privateConstructorUsedError;
@JsonKey(
name: 'product_nutritional_value_id',
includeToJson: true,
includeFromJson: false,
includeIfNull: false)
String? get productNutritionalValueId => throw _privateConstructorUsedError;
@@ -1100,6 +1282,7 @@ abstract class $DailyScheduleCopyWith<$Res> {
DailyNutrition? dailyNutrition,
@JsonKey(
name: 'product_nutritional_value_id',
includeToJson: true,
includeFromJson: false,
includeIfNull: false)
String? productNutritionalValueId});
@@ -1189,6 +1372,7 @@ abstract class _$$DailyScheduleImplCopyWith<$Res>
DailyNutrition? dailyNutrition,
@JsonKey(
name: 'product_nutritional_value_id',
includeToJson: true,
includeFromJson: false,
includeIfNull: false)
String? productNutritionalValueId});
@@ -1258,6 +1442,7 @@ class _$DailyScheduleImpl implements _DailySchedule {
this.dailyNutrition,
@JsonKey(
name: 'product_nutritional_value_id',
includeToJson: true,
includeFromJson: false,
includeIfNull: false)
this.productNutritionalValueId});
@@ -1283,6 +1468,7 @@ class _$DailyScheduleImpl implements _DailySchedule {
@override
@JsonKey(
name: 'product_nutritional_value_id',
includeToJson: true,
includeFromJson: false,
includeIfNull: false)
final String? productNutritionalValueId;
@@ -1340,6 +1526,7 @@ abstract class _DailySchedule implements DailySchedule {
final DailyNutrition? dailyNutrition,
@JsonKey(
name: 'product_nutritional_value_id',
includeToJson: true,
includeFromJson: false,
includeIfNull: false)
final String? productNutritionalValueId}) = _$DailyScheduleImpl;
@@ -1365,6 +1552,7 @@ abstract class _DailySchedule implements DailySchedule {
@override
@JsonKey(
name: 'product_nutritional_value_id',
includeToJson: true,
includeFromJson: false,
includeIfNull: false)
String? get productNutritionalValueId;
@@ -1511,12 +1699,13 @@ class __$$DietTypeImplCopyWithImpl<$Res>
/// @nodoc
@JsonSerializable()
class _$DietTypeImpl implements _DietType {
class _$DietTypeImpl extends _DietType {
const _$DietTypeImpl(
{@JsonKey(name: "light") this.light,
@JsonKey(name: "veg") this.veg,
@JsonKey(name: "carb") this.carb,
@JsonKey(name: "meat") this.meat});
@JsonKey(name: "meat") this.meat})
: super._();
factory _$DietTypeImpl.fromJson(Map<String, dynamic> json) =>
_$$DietTypeImplFromJson(json);
@@ -1570,12 +1759,13 @@ class _$DietTypeImpl implements _DietType {
}
}
abstract class _DietType implements DietType {
abstract class _DietType extends DietType {
const factory _DietType(
{@JsonKey(name: "light") final bool? light,
@JsonKey(name: "veg") final bool? veg,
@JsonKey(name: "carb") final bool? carb,
@JsonKey(name: "meat") final bool? meat}) = _$DietTypeImpl;
const _DietType._() : super._();
factory _DietType.fromJson(Map<String, dynamic> json) =
_$DietTypeImpl.fromJson;

View File

@@ -69,12 +69,23 @@ Map<String, dynamic> _$$DietImplToJson(_$DietImpl instance) =>
'daily_nutrition': instance.dailyNutrition,
};
_$CreatedDietImpl _$$CreatedDietImplFromJson(Map<String, dynamic> json) =>
_$CreatedDietImpl(
id: (json['id'] as num).toInt(),
);
Map<String, dynamic> _$$CreatedDietImplToJson(_$CreatedDietImpl instance) =>
<String, dynamic>{
'id': instance.id,
};
_$AuthorImpl _$$AuthorImplFromJson(Map<String, dynamic> json) => _$AuthorImpl(
authorSlug: json['author_slug'] as String,
authorName: json['author_name'] as String,
authorProfileIcon: json['author_profile_icon'] as String,
authorIsMe: json['author_is_me'] as bool,
isEntitySubscribedByMe: json['is_entity_subscribed_by_me'] as bool,
isEntitySubscribedByMe: json['is_entity_subscribed_by_me'] as bool?,
authorPlaceInRating: (json['author_place_in_rating'] as num?)?.toInt(),
);
Map<String, dynamic> _$$AuthorImplToJson(_$AuthorImpl instance) =>
@@ -84,6 +95,7 @@ Map<String, dynamic> _$$AuthorImplToJson(_$AuthorImpl instance) =>
'author_profile_icon': instance.authorProfileIcon,
'author_is_me': instance.authorIsMe,
'is_entity_subscribed_by_me': instance.isEntitySubscribedByMe,
'author_place_in_rating': instance.authorPlaceInRating,
};
_$DailyScheduleImpl _$$DailyScheduleImplFromJson(Map<String, dynamic> json) =>
@@ -99,6 +111,8 @@ Map<String, dynamic> _$$DailyScheduleImplToJson(_$DailyScheduleImpl instance) =>
'name': instance.name,
'portion': _$PortionEnumMap[instance.portion]!,
'quantity': instance.quantity,
if (instance.productNutritionalValueId case final value?)
'product_nutritional_value_id': value,
};
const _$PortionEnumMap = {

View File

@@ -21,6 +21,7 @@ class PlanPaginationModel with _$PlanPaginationModel {
class PlanModel with _$PlanModel {
const factory PlanModel({
@JsonKey(name: "id") required int id,
@JsonKey(name: "slug") required String slug,
@JsonKey(name: "name") required String name,
@JsonKey(name: "image") required String image,
@JsonKey(name: "duration") required int duration,
@@ -28,13 +29,14 @@ class PlanModel with _$PlanModel {
@JsonKey(name: "type") required PlanType type,
@JsonKey(name: "details") required String details,
@JsonKey(name: "packets_count") required int packetsCount,
@JsonKey(name: "packet1_options") dynamic packet1Options,
@JsonKey(name: "packet2_options") dynamic packet2Options,
@JsonKey(name: "packet3_options") dynamic packet3Options,
@JsonKey(name: "packet1_options") PacketOptions? packet1Options,
@JsonKey(name: "packet2_options") PacketOptions? packet2Options,
@JsonKey(name: "packet3_options") PacketOptions? packet3Options,
@JsonKey(name: "author") required Author author,
@JsonKey(name: "total_likes") required int totalLikes,
@JsonKey(name: "total_views") required int totalViews,
@JsonKey(name: "total_comments") required int totalComments,
@JsonKey(name: "total_comments") required int totalComments,
@JsonKey(name: "is_favorite") required bool isFavorite,
}) = _PlanModel;
factory PlanModel.fromJson(Map<String, dynamic> json) => _$PlanModelFromJson(json);
@@ -56,12 +58,17 @@ class PacketOptions with _$PacketOptions {
@freezed
class PlanType with _$PlanType {
const PlanType._();
const factory PlanType({
@JsonKey(name: "fit") required bool fit,
@JsonKey(name: "slim") required bool slim,
@JsonKey(name: "behavior") required bool behavior,
@JsonKey(name: "wellness") required bool wellness,
@JsonKey(name: "fit") required bool? fit,
@JsonKey(name: "slim") required bool? slim,
@JsonKey(name: "behavior") required bool? behavior,
@JsonKey(name: "wellness") required bool? wellness,
}) = _PlanType;
factory PlanType.fromJson(Map<String, dynamic> json) => _$PlanTypeFromJson(json);
bool hasAtLeastOneType() {
return (fit ?? false) || (slim ?? false) || (behavior ?? false) || (wellness ?? false);
}
}

View File

@@ -262,6 +262,8 @@ PlanModel _$PlanModelFromJson(Map<String, dynamic> json) {
mixin _$PlanModel {
@JsonKey(name: "id")
int get id => throw _privateConstructorUsedError;
@JsonKey(name: "slug")
String get slug => throw _privateConstructorUsedError;
@JsonKey(name: "name")
String get name => throw _privateConstructorUsedError;
@JsonKey(name: "image")
@@ -277,11 +279,11 @@ mixin _$PlanModel {
@JsonKey(name: "packets_count")
int get packetsCount => throw _privateConstructorUsedError;
@JsonKey(name: "packet1_options")
dynamic get packet1Options => throw _privateConstructorUsedError;
PacketOptions? get packet1Options => throw _privateConstructorUsedError;
@JsonKey(name: "packet2_options")
dynamic get packet2Options => throw _privateConstructorUsedError;
PacketOptions? get packet2Options => throw _privateConstructorUsedError;
@JsonKey(name: "packet3_options")
dynamic get packet3Options => throw _privateConstructorUsedError;
PacketOptions? get packet3Options => throw _privateConstructorUsedError;
@JsonKey(name: "author")
Author get author => throw _privateConstructorUsedError;
@JsonKey(name: "total_likes")
@@ -290,6 +292,8 @@ mixin _$PlanModel {
int get totalViews => throw _privateConstructorUsedError;
@JsonKey(name: "total_comments")
int get totalComments => throw _privateConstructorUsedError;
@JsonKey(name: "is_favorite")
bool get isFavorite => throw _privateConstructorUsedError;
/// Serializes this PlanModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -308,6 +312,7 @@ abstract class $PlanModelCopyWith<$Res> {
@useResult
$Res call(
{@JsonKey(name: "id") int id,
@JsonKey(name: "slug") String slug,
@JsonKey(name: "name") String name,
@JsonKey(name: "image") String image,
@JsonKey(name: "duration") int duration,
@@ -315,15 +320,19 @@ abstract class $PlanModelCopyWith<$Res> {
@JsonKey(name: "type") PlanType type,
@JsonKey(name: "details") String details,
@JsonKey(name: "packets_count") int packetsCount,
@JsonKey(name: "packet1_options") dynamic packet1Options,
@JsonKey(name: "packet2_options") dynamic packet2Options,
@JsonKey(name: "packet3_options") dynamic packet3Options,
@JsonKey(name: "packet1_options") PacketOptions? packet1Options,
@JsonKey(name: "packet2_options") PacketOptions? packet2Options,
@JsonKey(name: "packet3_options") PacketOptions? packet3Options,
@JsonKey(name: "author") Author author,
@JsonKey(name: "total_likes") int totalLikes,
@JsonKey(name: "total_views") int totalViews,
@JsonKey(name: "total_comments") int totalComments});
@JsonKey(name: "total_comments") int totalComments,
@JsonKey(name: "is_favorite") bool isFavorite});
$PlanTypeCopyWith<$Res> get type;
$PacketOptionsCopyWith<$Res>? get packet1Options;
$PacketOptionsCopyWith<$Res>? get packet2Options;
$PacketOptionsCopyWith<$Res>? get packet3Options;
$AuthorCopyWith<$Res> get author;
}
@@ -343,6 +352,7 @@ class _$PlanModelCopyWithImpl<$Res, $Val extends PlanModel>
@override
$Res call({
Object? id = null,
Object? slug = null,
Object? name = null,
Object? image = null,
Object? duration = null,
@@ -357,12 +367,17 @@ class _$PlanModelCopyWithImpl<$Res, $Val extends PlanModel>
Object? totalLikes = null,
Object? totalViews = null,
Object? totalComments = null,
Object? isFavorite = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
slug: null == slug
? _value.slug
: slug // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
@@ -394,15 +409,15 @@ class _$PlanModelCopyWithImpl<$Res, $Val extends PlanModel>
packet1Options: freezed == packet1Options
? _value.packet1Options
: packet1Options // ignore: cast_nullable_to_non_nullable
as dynamic,
as PacketOptions?,
packet2Options: freezed == packet2Options
? _value.packet2Options
: packet2Options // ignore: cast_nullable_to_non_nullable
as dynamic,
as PacketOptions?,
packet3Options: freezed == packet3Options
? _value.packet3Options
: packet3Options // ignore: cast_nullable_to_non_nullable
as dynamic,
as PacketOptions?,
author: null == author
? _value.author
: author // ignore: cast_nullable_to_non_nullable
@@ -419,6 +434,10 @@ class _$PlanModelCopyWithImpl<$Res, $Val extends PlanModel>
? _value.totalComments
: totalComments // ignore: cast_nullable_to_non_nullable
as int,
isFavorite: null == isFavorite
? _value.isFavorite
: isFavorite // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
@@ -432,6 +451,48 @@ class _$PlanModelCopyWithImpl<$Res, $Val extends PlanModel>
});
}
/// Create a copy of PlanModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$PacketOptionsCopyWith<$Res>? get packet1Options {
if (_value.packet1Options == null) {
return null;
}
return $PacketOptionsCopyWith<$Res>(_value.packet1Options!, (value) {
return _then(_value.copyWith(packet1Options: value) as $Val);
});
}
/// Create a copy of PlanModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$PacketOptionsCopyWith<$Res>? get packet2Options {
if (_value.packet2Options == null) {
return null;
}
return $PacketOptionsCopyWith<$Res>(_value.packet2Options!, (value) {
return _then(_value.copyWith(packet2Options: value) as $Val);
});
}
/// Create a copy of PlanModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$PacketOptionsCopyWith<$Res>? get packet3Options {
if (_value.packet3Options == null) {
return null;
}
return $PacketOptionsCopyWith<$Res>(_value.packet3Options!, (value) {
return _then(_value.copyWith(packet3Options: value) as $Val);
});
}
/// Create a copy of PlanModel
/// with the given fields replaced by the non-null parameter values.
@override
@@ -453,6 +514,7 @@ abstract class _$$PlanModelImplCopyWith<$Res>
@useResult
$Res call(
{@JsonKey(name: "id") int id,
@JsonKey(name: "slug") String slug,
@JsonKey(name: "name") String name,
@JsonKey(name: "image") String image,
@JsonKey(name: "duration") int duration,
@@ -460,17 +522,24 @@ abstract class _$$PlanModelImplCopyWith<$Res>
@JsonKey(name: "type") PlanType type,
@JsonKey(name: "details") String details,
@JsonKey(name: "packets_count") int packetsCount,
@JsonKey(name: "packet1_options") dynamic packet1Options,
@JsonKey(name: "packet2_options") dynamic packet2Options,
@JsonKey(name: "packet3_options") dynamic packet3Options,
@JsonKey(name: "packet1_options") PacketOptions? packet1Options,
@JsonKey(name: "packet2_options") PacketOptions? packet2Options,
@JsonKey(name: "packet3_options") PacketOptions? packet3Options,
@JsonKey(name: "author") Author author,
@JsonKey(name: "total_likes") int totalLikes,
@JsonKey(name: "total_views") int totalViews,
@JsonKey(name: "total_comments") int totalComments});
@JsonKey(name: "total_comments") int totalComments,
@JsonKey(name: "is_favorite") bool isFavorite});
@override
$PlanTypeCopyWith<$Res> get type;
@override
$PacketOptionsCopyWith<$Res>? get packet1Options;
@override
$PacketOptionsCopyWith<$Res>? get packet2Options;
@override
$PacketOptionsCopyWith<$Res>? get packet3Options;
@override
$AuthorCopyWith<$Res> get author;
}
@@ -488,6 +557,7 @@ class __$$PlanModelImplCopyWithImpl<$Res>
@override
$Res call({
Object? id = null,
Object? slug = null,
Object? name = null,
Object? image = null,
Object? duration = null,
@@ -502,12 +572,17 @@ class __$$PlanModelImplCopyWithImpl<$Res>
Object? totalLikes = null,
Object? totalViews = null,
Object? totalComments = null,
Object? isFavorite = null,
}) {
return _then(_$PlanModelImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
slug: null == slug
? _value.slug
: slug // ignore: cast_nullable_to_non_nullable
as String,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
@@ -539,15 +614,15 @@ class __$$PlanModelImplCopyWithImpl<$Res>
packet1Options: freezed == packet1Options
? _value.packet1Options
: packet1Options // ignore: cast_nullable_to_non_nullable
as dynamic,
as PacketOptions?,
packet2Options: freezed == packet2Options
? _value.packet2Options
: packet2Options // ignore: cast_nullable_to_non_nullable
as dynamic,
as PacketOptions?,
packet3Options: freezed == packet3Options
? _value.packet3Options
: packet3Options // ignore: cast_nullable_to_non_nullable
as dynamic,
as PacketOptions?,
author: null == author
? _value.author
: author // ignore: cast_nullable_to_non_nullable
@@ -564,6 +639,10 @@ class __$$PlanModelImplCopyWithImpl<$Res>
? _value.totalComments
: totalComments // ignore: cast_nullable_to_non_nullable
as int,
isFavorite: null == isFavorite
? _value.isFavorite
: isFavorite // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
@@ -573,6 +652,7 @@ class __$$PlanModelImplCopyWithImpl<$Res>
class _$PlanModelImpl implements _PlanModel {
const _$PlanModelImpl(
{@JsonKey(name: "id") required this.id,
@JsonKey(name: "slug") required this.slug,
@JsonKey(name: "name") required this.name,
@JsonKey(name: "image") required this.image,
@JsonKey(name: "duration") required this.duration,
@@ -586,7 +666,8 @@ class _$PlanModelImpl implements _PlanModel {
@JsonKey(name: "author") required this.author,
@JsonKey(name: "total_likes") required this.totalLikes,
@JsonKey(name: "total_views") required this.totalViews,
@JsonKey(name: "total_comments") required this.totalComments});
@JsonKey(name: "total_comments") required this.totalComments,
@JsonKey(name: "is_favorite") required this.isFavorite});
factory _$PlanModelImpl.fromJson(Map<String, dynamic> json) =>
_$$PlanModelImplFromJson(json);
@@ -595,6 +676,9 @@ class _$PlanModelImpl implements _PlanModel {
@JsonKey(name: "id")
final int id;
@override
@JsonKey(name: "slug")
final String slug;
@override
@JsonKey(name: "name")
final String name;
@override
@@ -617,13 +701,13 @@ class _$PlanModelImpl implements _PlanModel {
final int packetsCount;
@override
@JsonKey(name: "packet1_options")
final dynamic packet1Options;
final PacketOptions? packet1Options;
@override
@JsonKey(name: "packet2_options")
final dynamic packet2Options;
final PacketOptions? packet2Options;
@override
@JsonKey(name: "packet3_options")
final dynamic packet3Options;
final PacketOptions? packet3Options;
@override
@JsonKey(name: "author")
final Author author;
@@ -636,10 +720,13 @@ class _$PlanModelImpl implements _PlanModel {
@override
@JsonKey(name: "total_comments")
final int totalComments;
@override
@JsonKey(name: "is_favorite")
final bool isFavorite;
@override
String toString() {
return 'PlanModel(id: $id, name: $name, image: $image, duration: $duration, state: $state, type: $type, details: $details, packetsCount: $packetsCount, packet1Options: $packet1Options, packet2Options: $packet2Options, packet3Options: $packet3Options, author: $author, totalLikes: $totalLikes, totalViews: $totalViews, totalComments: $totalComments)';
return 'PlanModel(id: $id, slug: $slug, name: $name, image: $image, duration: $duration, state: $state, type: $type, details: $details, packetsCount: $packetsCount, packet1Options: $packet1Options, packet2Options: $packet2Options, packet3Options: $packet3Options, author: $author, totalLikes: $totalLikes, totalViews: $totalViews, totalComments: $totalComments, isFavorite: $isFavorite)';
}
@override
@@ -648,6 +735,7 @@ class _$PlanModelImpl implements _PlanModel {
(other.runtimeType == runtimeType &&
other is _$PlanModelImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.slug, slug) || other.slug == slug) &&
(identical(other.name, name) || other.name == name) &&
(identical(other.image, image) || other.image == image) &&
(identical(other.duration, duration) ||
@@ -657,19 +745,21 @@ class _$PlanModelImpl implements _PlanModel {
(identical(other.details, details) || other.details == details) &&
(identical(other.packetsCount, packetsCount) ||
other.packetsCount == packetsCount) &&
const DeepCollectionEquality()
.equals(other.packet1Options, packet1Options) &&
const DeepCollectionEquality()
.equals(other.packet2Options, packet2Options) &&
const DeepCollectionEquality()
.equals(other.packet3Options, packet3Options) &&
(identical(other.packet1Options, packet1Options) ||
other.packet1Options == packet1Options) &&
(identical(other.packet2Options, packet2Options) ||
other.packet2Options == packet2Options) &&
(identical(other.packet3Options, packet3Options) ||
other.packet3Options == packet3Options) &&
(identical(other.author, author) || other.author == author) &&
(identical(other.totalLikes, totalLikes) ||
other.totalLikes == totalLikes) &&
(identical(other.totalViews, totalViews) ||
other.totalViews == totalViews) &&
(identical(other.totalComments, totalComments) ||
other.totalComments == totalComments));
other.totalComments == totalComments) &&
(identical(other.isFavorite, isFavorite) ||
other.isFavorite == isFavorite));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -677,6 +767,7 @@ class _$PlanModelImpl implements _PlanModel {
int get hashCode => Object.hash(
runtimeType,
id,
slug,
name,
image,
duration,
@@ -684,13 +775,14 @@ class _$PlanModelImpl implements _PlanModel {
type,
details,
packetsCount,
const DeepCollectionEquality().hash(packet1Options),
const DeepCollectionEquality().hash(packet2Options),
const DeepCollectionEquality().hash(packet3Options),
packet1Options,
packet2Options,
packet3Options,
author,
totalLikes,
totalViews,
totalComments);
totalComments,
isFavorite);
/// Create a copy of PlanModel
/// with the given fields replaced by the non-null parameter values.
@@ -711,6 +803,7 @@ class _$PlanModelImpl implements _PlanModel {
abstract class _PlanModel implements PlanModel {
const factory _PlanModel(
{@JsonKey(name: "id") required final int id,
@JsonKey(name: "slug") required final String slug,
@JsonKey(name: "name") required final String name,
@JsonKey(name: "image") required final String image,
@JsonKey(name: "duration") required final int duration,
@@ -718,13 +811,14 @@ abstract class _PlanModel implements PlanModel {
@JsonKey(name: "type") required final PlanType type,
@JsonKey(name: "details") required final String details,
@JsonKey(name: "packets_count") required final int packetsCount,
@JsonKey(name: "packet1_options") final dynamic packet1Options,
@JsonKey(name: "packet2_options") final dynamic packet2Options,
@JsonKey(name: "packet3_options") final dynamic packet3Options,
@JsonKey(name: "packet1_options") final PacketOptions? packet1Options,
@JsonKey(name: "packet2_options") final PacketOptions? packet2Options,
@JsonKey(name: "packet3_options") final PacketOptions? packet3Options,
@JsonKey(name: "author") required final Author author,
@JsonKey(name: "total_likes") required final int totalLikes,
@JsonKey(name: "total_views") required final int totalViews,
@JsonKey(name: "total_comments") required final int totalComments}) =
@JsonKey(name: "total_comments") required final int totalComments,
@JsonKey(name: "is_favorite") required final bool isFavorite}) =
_$PlanModelImpl;
factory _PlanModel.fromJson(Map<String, dynamic> json) =
@@ -734,6 +828,9 @@ abstract class _PlanModel implements PlanModel {
@JsonKey(name: "id")
int get id;
@override
@JsonKey(name: "slug")
String get slug;
@override
@JsonKey(name: "name")
String get name;
@override
@@ -756,13 +853,13 @@ abstract class _PlanModel implements PlanModel {
int get packetsCount;
@override
@JsonKey(name: "packet1_options")
dynamic get packet1Options;
PacketOptions? get packet1Options;
@override
@JsonKey(name: "packet2_options")
dynamic get packet2Options;
PacketOptions? get packet2Options;
@override
@JsonKey(name: "packet3_options")
dynamic get packet3Options;
PacketOptions? get packet3Options;
@override
@JsonKey(name: "author")
Author get author;
@@ -775,6 +872,9 @@ abstract class _PlanModel implements PlanModel {
@override
@JsonKey(name: "total_comments")
int get totalComments;
@override
@JsonKey(name: "is_favorite")
bool get isFavorite;
/// Create a copy of PlanModel
/// with the given fields replaced by the non-null parameter values.
@@ -1030,13 +1130,13 @@ PlanType _$PlanTypeFromJson(Map<String, dynamic> json) {
/// @nodoc
mixin _$PlanType {
@JsonKey(name: "fit")
bool get fit => throw _privateConstructorUsedError;
bool? get fit => throw _privateConstructorUsedError;
@JsonKey(name: "slim")
bool get slim => throw _privateConstructorUsedError;
bool? get slim => throw _privateConstructorUsedError;
@JsonKey(name: "behavior")
bool get behavior => throw _privateConstructorUsedError;
bool? get behavior => throw _privateConstructorUsedError;
@JsonKey(name: "wellness")
bool get wellness => throw _privateConstructorUsedError;
bool? get wellness => throw _privateConstructorUsedError;
/// Serializes this PlanType to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -1054,10 +1154,10 @@ abstract class $PlanTypeCopyWith<$Res> {
_$PlanTypeCopyWithImpl<$Res, PlanType>;
@useResult
$Res call(
{@JsonKey(name: "fit") bool fit,
@JsonKey(name: "slim") bool slim,
@JsonKey(name: "behavior") bool behavior,
@JsonKey(name: "wellness") bool wellness});
{@JsonKey(name: "fit") bool? fit,
@JsonKey(name: "slim") bool? slim,
@JsonKey(name: "behavior") bool? behavior,
@JsonKey(name: "wellness") bool? wellness});
}
/// @nodoc
@@ -1075,28 +1175,28 @@ class _$PlanTypeCopyWithImpl<$Res, $Val extends PlanType>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? fit = null,
Object? slim = null,
Object? behavior = null,
Object? wellness = null,
Object? fit = freezed,
Object? slim = freezed,
Object? behavior = freezed,
Object? wellness = freezed,
}) {
return _then(_value.copyWith(
fit: null == fit
fit: freezed == fit
? _value.fit
: fit // ignore: cast_nullable_to_non_nullable
as bool,
slim: null == slim
as bool?,
slim: freezed == slim
? _value.slim
: slim // ignore: cast_nullable_to_non_nullable
as bool,
behavior: null == behavior
as bool?,
behavior: freezed == behavior
? _value.behavior
: behavior // ignore: cast_nullable_to_non_nullable
as bool,
wellness: null == wellness
as bool?,
wellness: freezed == wellness
? _value.wellness
: wellness // ignore: cast_nullable_to_non_nullable
as bool,
as bool?,
) as $Val);
}
}
@@ -1110,10 +1210,10 @@ abstract class _$$PlanTypeImplCopyWith<$Res>
@override
@useResult
$Res call(
{@JsonKey(name: "fit") bool fit,
@JsonKey(name: "slim") bool slim,
@JsonKey(name: "behavior") bool behavior,
@JsonKey(name: "wellness") bool wellness});
{@JsonKey(name: "fit") bool? fit,
@JsonKey(name: "slim") bool? slim,
@JsonKey(name: "behavior") bool? behavior,
@JsonKey(name: "wellness") bool? wellness});
}
/// @nodoc
@@ -1129,56 +1229,57 @@ class __$$PlanTypeImplCopyWithImpl<$Res>
@pragma('vm:prefer-inline')
@override
$Res call({
Object? fit = null,
Object? slim = null,
Object? behavior = null,
Object? wellness = null,
Object? fit = freezed,
Object? slim = freezed,
Object? behavior = freezed,
Object? wellness = freezed,
}) {
return _then(_$PlanTypeImpl(
fit: null == fit
fit: freezed == fit
? _value.fit
: fit // ignore: cast_nullable_to_non_nullable
as bool,
slim: null == slim
as bool?,
slim: freezed == slim
? _value.slim
: slim // ignore: cast_nullable_to_non_nullable
as bool,
behavior: null == behavior
as bool?,
behavior: freezed == behavior
? _value.behavior
: behavior // ignore: cast_nullable_to_non_nullable
as bool,
wellness: null == wellness
as bool?,
wellness: freezed == wellness
? _value.wellness
: wellness // ignore: cast_nullable_to_non_nullable
as bool,
as bool?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$PlanTypeImpl implements _PlanType {
class _$PlanTypeImpl extends _PlanType {
const _$PlanTypeImpl(
{@JsonKey(name: "fit") required this.fit,
@JsonKey(name: "slim") required this.slim,
@JsonKey(name: "behavior") required this.behavior,
@JsonKey(name: "wellness") required this.wellness});
@JsonKey(name: "wellness") required this.wellness})
: super._();
factory _$PlanTypeImpl.fromJson(Map<String, dynamic> json) =>
_$$PlanTypeImplFromJson(json);
@override
@JsonKey(name: "fit")
final bool fit;
final bool? fit;
@override
@JsonKey(name: "slim")
final bool slim;
final bool? slim;
@override
@JsonKey(name: "behavior")
final bool behavior;
final bool? behavior;
@override
@JsonKey(name: "wellness")
final bool wellness;
final bool? wellness;
@override
String toString() {
@@ -1218,29 +1319,30 @@ class _$PlanTypeImpl implements _PlanType {
}
}
abstract class _PlanType implements PlanType {
abstract class _PlanType extends PlanType {
const factory _PlanType(
{@JsonKey(name: "fit") required final bool fit,
@JsonKey(name: "slim") required final bool slim,
@JsonKey(name: "behavior") required final bool behavior,
@JsonKey(name: "wellness") required final bool wellness}) =
{@JsonKey(name: "fit") required final bool? fit,
@JsonKey(name: "slim") required final bool? slim,
@JsonKey(name: "behavior") required final bool? behavior,
@JsonKey(name: "wellness") required final bool? wellness}) =
_$PlanTypeImpl;
const _PlanType._() : super._();
factory _PlanType.fromJson(Map<String, dynamic> json) =
_$PlanTypeImpl.fromJson;
@override
@JsonKey(name: "fit")
bool get fit;
bool? get fit;
@override
@JsonKey(name: "slim")
bool get slim;
bool? get slim;
@override
@JsonKey(name: "behavior")
bool get behavior;
bool? get behavior;
@override
@JsonKey(name: "wellness")
bool get wellness;
bool? get wellness;
/// Create a copy of PlanType
/// with the given fields replaced by the non-null parameter values.

View File

@@ -27,6 +27,7 @@ Map<String, dynamic> _$$PlanPaginationModelImplToJson(
_$PlanModelImpl _$$PlanModelImplFromJson(Map<String, dynamic> json) =>
_$PlanModelImpl(
id: (json['id'] as num).toInt(),
slug: json['slug'] as String,
name: json['name'] as String,
image: json['image'] as String,
duration: (json['duration'] as num).toInt(),
@@ -34,18 +35,29 @@ _$PlanModelImpl _$$PlanModelImplFromJson(Map<String, dynamic> json) =>
type: PlanType.fromJson(json['type'] as Map<String, dynamic>),
details: json['details'] as String,
packetsCount: (json['packets_count'] as num).toInt(),
packet1Options: json['packet1_options'],
packet2Options: json['packet2_options'],
packet3Options: json['packet3_options'],
packet1Options: json['packet1_options'] == null
? null
: PacketOptions.fromJson(
json['packet1_options'] as Map<String, dynamic>),
packet2Options: json['packet2_options'] == null
? null
: PacketOptions.fromJson(
json['packet2_options'] as Map<String, dynamic>),
packet3Options: json['packet3_options'] == null
? null
: PacketOptions.fromJson(
json['packet3_options'] as Map<String, dynamic>),
author: Author.fromJson(json['author'] as Map<String, dynamic>),
totalLikes: (json['total_likes'] as num).toInt(),
totalViews: (json['total_views'] as num).toInt(),
totalComments: (json['total_comments'] as num).toInt(),
isFavorite: json['is_favorite'] as bool,
);
Map<String, dynamic> _$$PlanModelImplToJson(_$PlanModelImpl instance) =>
<String, dynamic>{
'id': instance.id,
'slug': instance.slug,
'name': instance.name,
'image': instance.image,
'duration': instance.duration,
@@ -60,6 +72,7 @@ Map<String, dynamic> _$$PlanModelImplToJson(_$PlanModelImpl instance) =>
'total_likes': instance.totalLikes,
'total_views': instance.totalViews,
'total_comments': instance.totalComments,
'is_favorite': instance.isFavorite,
};
_$PacketOptionsImpl _$$PacketOptionsImplFromJson(Map<String, dynamic> json) =>
@@ -80,10 +93,10 @@ Map<String, dynamic> _$$PacketOptionsImplToJson(_$PacketOptionsImpl instance) =>
_$PlanTypeImpl _$$PlanTypeImplFromJson(Map<String, dynamic> json) =>
_$PlanTypeImpl(
fit: json['fit'] as bool,
slim: json['slim'] as bool,
behavior: json['behavior'] as bool,
wellness: json['wellness'] as bool,
fit: json['fit'] as bool?,
slim: json['slim'] as bool?,
behavior: json['behavior'] as bool?,
wellness: json['wellness'] as bool?,
);
Map<String, dynamic> _$$PlanTypeImplToJson(_$PlanTypeImpl instance) =>