feat(order info): added order info screen

This commit is contained in:
Username1548
2025-04-04 20:21:31 +07:00
parent 9715f4cac9
commit 748484cf8f
387 changed files with 16171 additions and 18199 deletions

View File

@@ -8,19 +8,20 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'recipe_create_entity.freezed.dart';
enum TypeOfRecipe {
first_meals,
second_meals,
firstMeals,
secondMeals,
salads,
snacks,
sweets,
drinks,
other;
@override
String toString() {
switch (this) {
case TypeOfRecipe.first_meals:
case TypeOfRecipe.firstMeals:
return 'Первые блюда';
case TypeOfRecipe.second_meals:
case TypeOfRecipe.secondMeals:
return 'Вторые блюда';
case TypeOfRecipe.salads:
return 'Салаты';
@@ -37,9 +38,9 @@ enum TypeOfRecipe {
String toApiType() {
switch (this) {
case TypeOfRecipe.first_meals:
case TypeOfRecipe.firstMeals:
return 'first_meals';
case TypeOfRecipe.second_meals:
case TypeOfRecipe.secondMeals:
return 'second_meals';
case TypeOfRecipe.salads:
return 'salads';
@@ -57,9 +58,9 @@ enum TypeOfRecipe {
static TypeOfRecipe? fromString(String value) {
switch (value) {
case 'Первые блюда':
return TypeOfRecipe.first_meals;
return TypeOfRecipe.firstMeals;
case 'Вторые блюда':
return TypeOfRecipe.second_meals;
return TypeOfRecipe.secondMeals;
case 'Салаты':
return TypeOfRecipe.salads;
case 'Закуски':
@@ -84,10 +85,10 @@ class RecipeCreateEntity with _$RecipeCreateEntity {
TypeOfRecipe? typeOfRecipe,
int? countOfPortions,
double? energyInOnePortion,
int? totalCookHours,
int? totalCookMinutes,
int? activeCookHours,
int? activeCookMinutes,
int? totalCookHours,
int? totalCookMinutes,
int? activeCookHours,
int? activeCookMinutes,
String? description,
File? image,
String? videoUrl,
@@ -105,7 +106,7 @@ class RecipeCreateEntity with _$RecipeCreateEntity {
activeCookTime: ((activeCookHours ?? 0) * 60) + (activeCookMinutes ?? 0),
description: description,
image: image?.path,
video_url: videoUrl,
videoUrl: videoUrl,
ingredients: ingredients,
steps: steps.map((step) {
if (step.hasProps()) return Step(image: step.image?.path ?? '', description: step.description ?? '');

View File

@@ -12,8 +12,7 @@ part of 'recipe_create_entity.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$RecipeCreateEntity {
@@ -42,26 +41,24 @@ mixin _$RecipeCreateEntity {
/// @nodoc
abstract class $RecipeCreateEntityCopyWith<$Res> {
factory $RecipeCreateEntityCopyWith(
RecipeCreateEntity value,
$Res Function(RecipeCreateEntity) then,
) = _$RecipeCreateEntityCopyWithImpl<$Res, RecipeCreateEntity>;
RecipeCreateEntity value, $Res Function(RecipeCreateEntity) then) =
_$RecipeCreateEntityCopyWithImpl<$Res, RecipeCreateEntity>;
@useResult
$Res call({
String? title,
TypeOfRecipe? typeOfRecipe,
int? countOfPortions,
double? energyInOnePortion,
int? totalCookHours,
int? totalCookMinutes,
int? activeCookHours,
int? activeCookMinutes,
String? description,
File? image,
String? videoUrl,
List<Ingredient> ingredients,
List<StepEntity> steps,
List<String> tags,
});
$Res call(
{String? title,
TypeOfRecipe? typeOfRecipe,
int? countOfPortions,
double? energyInOnePortion,
int? totalCookHours,
int? totalCookMinutes,
int? activeCookHours,
int? activeCookMinutes,
String? description,
File? image,
String? videoUrl,
List<Ingredient> ingredients,
List<StepEntity> steps,
List<String> tags});
}
/// @nodoc
@@ -94,119 +91,99 @@ class _$RecipeCreateEntityCopyWithImpl<$Res, $Val extends RecipeCreateEntity>
Object? steps = null,
Object? tags = null,
}) {
return _then(
_value.copyWith(
title:
freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
typeOfRecipe:
freezed == typeOfRecipe
? _value.typeOfRecipe
: typeOfRecipe // ignore: cast_nullable_to_non_nullable
as TypeOfRecipe?,
countOfPortions:
freezed == countOfPortions
? _value.countOfPortions
: countOfPortions // ignore: cast_nullable_to_non_nullable
as int?,
energyInOnePortion:
freezed == energyInOnePortion
? _value.energyInOnePortion
: energyInOnePortion // ignore: cast_nullable_to_non_nullable
as double?,
totalCookHours:
freezed == totalCookHours
? _value.totalCookHours
: totalCookHours // ignore: cast_nullable_to_non_nullable
as int?,
totalCookMinutes:
freezed == totalCookMinutes
? _value.totalCookMinutes
: totalCookMinutes // ignore: cast_nullable_to_non_nullable
as int?,
activeCookHours:
freezed == activeCookHours
? _value.activeCookHours
: activeCookHours // ignore: cast_nullable_to_non_nullable
as int?,
activeCookMinutes:
freezed == activeCookMinutes
? _value.activeCookMinutes
: activeCookMinutes // ignore: cast_nullable_to_non_nullable
as int?,
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
videoUrl:
freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
ingredients:
null == ingredients
? _value.ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient>,
steps:
null == steps
? _value.steps
: steps // ignore: cast_nullable_to_non_nullable
as List<StepEntity>,
tags:
null == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
)
as $Val,
);
return _then(_value.copyWith(
title: freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
typeOfRecipe: freezed == typeOfRecipe
? _value.typeOfRecipe
: typeOfRecipe // ignore: cast_nullable_to_non_nullable
as TypeOfRecipe?,
countOfPortions: freezed == countOfPortions
? _value.countOfPortions
: countOfPortions // ignore: cast_nullable_to_non_nullable
as int?,
energyInOnePortion: freezed == energyInOnePortion
? _value.energyInOnePortion
: energyInOnePortion // ignore: cast_nullable_to_non_nullable
as double?,
totalCookHours: freezed == totalCookHours
? _value.totalCookHours
: totalCookHours // ignore: cast_nullable_to_non_nullable
as int?,
totalCookMinutes: freezed == totalCookMinutes
? _value.totalCookMinutes
: totalCookMinutes // ignore: cast_nullable_to_non_nullable
as int?,
activeCookHours: freezed == activeCookHours
? _value.activeCookHours
: activeCookHours // ignore: cast_nullable_to_non_nullable
as int?,
activeCookMinutes: freezed == activeCookMinutes
? _value.activeCookMinutes
: activeCookMinutes // ignore: cast_nullable_to_non_nullable
as int?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
videoUrl: freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
ingredients: null == ingredients
? _value.ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient>,
steps: null == steps
? _value.steps
: steps // ignore: cast_nullable_to_non_nullable
as List<StepEntity>,
tags: null == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
) as $Val);
}
}
/// @nodoc
abstract class _$$RecipeCreateEntityImplCopyWith<$Res>
implements $RecipeCreateEntityCopyWith<$Res> {
factory _$$RecipeCreateEntityImplCopyWith(
_$RecipeCreateEntityImpl value,
$Res Function(_$RecipeCreateEntityImpl) then,
) = __$$RecipeCreateEntityImplCopyWithImpl<$Res>;
factory _$$RecipeCreateEntityImplCopyWith(_$RecipeCreateEntityImpl value,
$Res Function(_$RecipeCreateEntityImpl) then) =
__$$RecipeCreateEntityImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String? title,
TypeOfRecipe? typeOfRecipe,
int? countOfPortions,
double? energyInOnePortion,
int? totalCookHours,
int? totalCookMinutes,
int? activeCookHours,
int? activeCookMinutes,
String? description,
File? image,
String? videoUrl,
List<Ingredient> ingredients,
List<StepEntity> steps,
List<String> tags,
});
$Res call(
{String? title,
TypeOfRecipe? typeOfRecipe,
int? countOfPortions,
double? energyInOnePortion,
int? totalCookHours,
int? totalCookMinutes,
int? activeCookHours,
int? activeCookMinutes,
String? description,
File? image,
String? videoUrl,
List<Ingredient> ingredients,
List<StepEntity> steps,
List<String> tags});
}
/// @nodoc
class __$$RecipeCreateEntityImplCopyWithImpl<$Res>
extends _$RecipeCreateEntityCopyWithImpl<$Res, _$RecipeCreateEntityImpl>
implements _$$RecipeCreateEntityImplCopyWith<$Res> {
__$$RecipeCreateEntityImplCopyWithImpl(
_$RecipeCreateEntityImpl _value,
$Res Function(_$RecipeCreateEntityImpl) _then,
) : super(_value, _then);
__$$RecipeCreateEntityImplCopyWithImpl(_$RecipeCreateEntityImpl _value,
$Res Function(_$RecipeCreateEntityImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeCreateEntity
/// with the given fields replaced by the non-null parameter values.
@@ -228,105 +205,89 @@ class __$$RecipeCreateEntityImplCopyWithImpl<$Res>
Object? steps = null,
Object? tags = null,
}) {
return _then(
_$RecipeCreateEntityImpl(
title:
freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
typeOfRecipe:
freezed == typeOfRecipe
? _value.typeOfRecipe
: typeOfRecipe // ignore: cast_nullable_to_non_nullable
as TypeOfRecipe?,
countOfPortions:
freezed == countOfPortions
? _value.countOfPortions
: countOfPortions // ignore: cast_nullable_to_non_nullable
as int?,
energyInOnePortion:
freezed == energyInOnePortion
? _value.energyInOnePortion
: energyInOnePortion // ignore: cast_nullable_to_non_nullable
as double?,
totalCookHours:
freezed == totalCookHours
? _value.totalCookHours
: totalCookHours // ignore: cast_nullable_to_non_nullable
as int?,
totalCookMinutes:
freezed == totalCookMinutes
? _value.totalCookMinutes
: totalCookMinutes // ignore: cast_nullable_to_non_nullable
as int?,
activeCookHours:
freezed == activeCookHours
? _value.activeCookHours
: activeCookHours // ignore: cast_nullable_to_non_nullable
as int?,
activeCookMinutes:
freezed == activeCookMinutes
? _value.activeCookMinutes
: activeCookMinutes // ignore: cast_nullable_to_non_nullable
as int?,
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
videoUrl:
freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
ingredients:
null == ingredients
? _value._ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient>,
steps:
null == steps
? _value._steps
: steps // ignore: cast_nullable_to_non_nullable
as List<StepEntity>,
tags:
null == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
),
);
return _then(_$RecipeCreateEntityImpl(
title: freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
typeOfRecipe: freezed == typeOfRecipe
? _value.typeOfRecipe
: typeOfRecipe // ignore: cast_nullable_to_non_nullable
as TypeOfRecipe?,
countOfPortions: freezed == countOfPortions
? _value.countOfPortions
: countOfPortions // ignore: cast_nullable_to_non_nullable
as int?,
energyInOnePortion: freezed == energyInOnePortion
? _value.energyInOnePortion
: energyInOnePortion // ignore: cast_nullable_to_non_nullable
as double?,
totalCookHours: freezed == totalCookHours
? _value.totalCookHours
: totalCookHours // ignore: cast_nullable_to_non_nullable
as int?,
totalCookMinutes: freezed == totalCookMinutes
? _value.totalCookMinutes
: totalCookMinutes // ignore: cast_nullable_to_non_nullable
as int?,
activeCookHours: freezed == activeCookHours
? _value.activeCookHours
: activeCookHours // ignore: cast_nullable_to_non_nullable
as int?,
activeCookMinutes: freezed == activeCookMinutes
? _value.activeCookMinutes
: activeCookMinutes // ignore: cast_nullable_to_non_nullable
as int?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
videoUrl: freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
ingredients: null == ingredients
? _value._ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient>,
steps: null == steps
? _value._steps
: steps // ignore: cast_nullable_to_non_nullable
as List<StepEntity>,
tags: null == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// @nodoc
class _$RecipeCreateEntityImpl extends _RecipeCreateEntity {
const _$RecipeCreateEntityImpl({
this.title,
this.typeOfRecipe,
this.countOfPortions,
this.energyInOnePortion,
this.totalCookHours,
this.totalCookMinutes,
this.activeCookHours,
this.activeCookMinutes,
this.description,
this.image,
this.videoUrl,
required final List<Ingredient> ingredients,
required final List<StepEntity> steps,
required final List<String> tags,
}) : _ingredients = ingredients,
_steps = steps,
_tags = tags,
super._();
const _$RecipeCreateEntityImpl(
{this.title,
this.typeOfRecipe,
this.countOfPortions,
this.energyInOnePortion,
this.totalCookHours,
this.totalCookMinutes,
this.activeCookHours,
this.activeCookMinutes,
this.description,
this.image,
this.videoUrl,
required final List<Ingredient> ingredients,
required final List<StepEntity> steps,
required final List<String> tags})
: _ingredients = ingredients,
_steps = steps,
_tags = tags,
super._();
@override
final String? title;
@@ -404,32 +365,29 @@ class _$RecipeCreateEntityImpl extends _RecipeCreateEntity {
(identical(other.image, image) || other.image == image) &&
(identical(other.videoUrl, videoUrl) ||
other.videoUrl == videoUrl) &&
const DeepCollectionEquality().equals(
other._ingredients,
_ingredients,
) &&
const DeepCollectionEquality()
.equals(other._ingredients, _ingredients) &&
const DeepCollectionEquality().equals(other._steps, _steps) &&
const DeepCollectionEquality().equals(other._tags, _tags));
}
@override
int get hashCode => Object.hash(
runtimeType,
title,
typeOfRecipe,
countOfPortions,
energyInOnePortion,
totalCookHours,
totalCookMinutes,
activeCookHours,
activeCookMinutes,
description,
image,
videoUrl,
const DeepCollectionEquality().hash(_ingredients),
const DeepCollectionEquality().hash(_steps),
const DeepCollectionEquality().hash(_tags),
);
runtimeType,
title,
typeOfRecipe,
countOfPortions,
energyInOnePortion,
totalCookHours,
totalCookMinutes,
activeCookHours,
activeCookMinutes,
description,
image,
videoUrl,
const DeepCollectionEquality().hash(_ingredients),
const DeepCollectionEquality().hash(_steps),
const DeepCollectionEquality().hash(_tags));
/// Create a copy of RecipeCreateEntity
/// with the given fields replaced by the non-null parameter values.
@@ -438,28 +396,25 @@ class _$RecipeCreateEntityImpl extends _RecipeCreateEntity {
@pragma('vm:prefer-inline')
_$$RecipeCreateEntityImplCopyWith<_$RecipeCreateEntityImpl> get copyWith =>
__$$RecipeCreateEntityImplCopyWithImpl<_$RecipeCreateEntityImpl>(
this,
_$identity,
);
this, _$identity);
}
abstract class _RecipeCreateEntity extends RecipeCreateEntity {
const factory _RecipeCreateEntity({
final String? title,
final TypeOfRecipe? typeOfRecipe,
final int? countOfPortions,
final double? energyInOnePortion,
final int? totalCookHours,
final int? totalCookMinutes,
final int? activeCookHours,
final int? activeCookMinutes,
final String? description,
final File? image,
final String? videoUrl,
required final List<Ingredient> ingredients,
required final List<StepEntity> steps,
required final List<String> tags,
}) = _$RecipeCreateEntityImpl;
const factory _RecipeCreateEntity(
{final String? title,
final TypeOfRecipe? typeOfRecipe,
final int? countOfPortions,
final double? energyInOnePortion,
final int? totalCookHours,
final int? totalCookMinutes,
final int? activeCookHours,
final int? activeCookMinutes,
final String? description,
final File? image,
final String? videoUrl,
required final List<Ingredient> ingredients,
required final List<StepEntity> steps,
required final List<String> tags}) = _$RecipeCreateEntityImpl;
const _RecipeCreateEntity._() : super._();
@override
@@ -514,9 +469,8 @@ mixin _$StepEntity {
/// @nodoc
abstract class $StepEntityCopyWith<$Res> {
factory $StepEntityCopyWith(
StepEntity value,
$Res Function(StepEntity) then,
) = _$StepEntityCopyWithImpl<$Res, StepEntity>;
StepEntity value, $Res Function(StepEntity) then) =
_$StepEntityCopyWithImpl<$Res, StepEntity>;
@useResult
$Res call({String? description, File? image});
}
@@ -535,22 +489,20 @@ class _$StepEntityCopyWithImpl<$Res, $Val extends StepEntity>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? description = freezed, Object? image = freezed}) {
return _then(
_value.copyWith(
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
)
as $Val,
);
$Res call({
Object? description = freezed,
Object? image = freezed,
}) {
return _then(_value.copyWith(
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
) as $Val);
}
}
@@ -558,9 +510,8 @@ class _$StepEntityCopyWithImpl<$Res, $Val extends StepEntity>
abstract class _$$StepEntityImplCopyWith<$Res>
implements $StepEntityCopyWith<$Res> {
factory _$$StepEntityImplCopyWith(
_$StepEntityImpl value,
$Res Function(_$StepEntityImpl) then,
) = __$$StepEntityImplCopyWithImpl<$Res>;
_$StepEntityImpl value, $Res Function(_$StepEntityImpl) then) =
__$$StepEntityImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String? description, File? image});
@@ -571,29 +522,27 @@ class __$$StepEntityImplCopyWithImpl<$Res>
extends _$StepEntityCopyWithImpl<$Res, _$StepEntityImpl>
implements _$$StepEntityImplCopyWith<$Res> {
__$$StepEntityImplCopyWithImpl(
_$StepEntityImpl _value,
$Res Function(_$StepEntityImpl) _then,
) : super(_value, _then);
_$StepEntityImpl _value, $Res Function(_$StepEntityImpl) _then)
: super(_value, _then);
/// Create a copy of StepEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? description = freezed, Object? image = freezed}) {
return _then(
_$StepEntityImpl(
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
),
);
$Res call({
Object? description = freezed,
Object? image = freezed,
}) {
return _then(_$StepEntityImpl(
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as File?,
));
}
}

View File

@@ -12,8 +12,7 @@ part of 'ingredient.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Ingredient _$IngredientFromJson(Map<String, dynamic> json) {
return _Ingredient.fromJson(json);
@@ -38,9 +37,8 @@ mixin _$Ingredient {
/// @nodoc
abstract class $IngredientCopyWith<$Res> {
factory $IngredientCopyWith(
Ingredient value,
$Res Function(Ingredient) then,
) = _$IngredientCopyWithImpl<$Res, Ingredient>;
Ingredient value, $Res Function(Ingredient) then) =
_$IngredientCopyWithImpl<$Res, Ingredient>;
@useResult
$Res call({String name, String unit, String portion});
}
@@ -64,26 +62,20 @@ class _$IngredientCopyWithImpl<$Res, $Val extends Ingredient>
Object? unit = null,
Object? portion = null,
}) {
return _then(
_value.copyWith(
name:
null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
unit:
null == unit
? _value.unit
: unit // ignore: cast_nullable_to_non_nullable
as String,
portion:
null == portion
? _value.portion
: portion // ignore: cast_nullable_to_non_nullable
as String,
)
as $Val,
);
return _then(_value.copyWith(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
unit: null == unit
? _value.unit
: unit // ignore: cast_nullable_to_non_nullable
as String,
portion: null == portion
? _value.portion
: portion // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
@@ -91,9 +83,8 @@ class _$IngredientCopyWithImpl<$Res, $Val extends Ingredient>
abstract class _$$IngredientImplCopyWith<$Res>
implements $IngredientCopyWith<$Res> {
factory _$$IngredientImplCopyWith(
_$IngredientImpl value,
$Res Function(_$IngredientImpl) then,
) = __$$IngredientImplCopyWithImpl<$Res>;
_$IngredientImpl value, $Res Function(_$IngredientImpl) then) =
__$$IngredientImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String name, String unit, String portion});
@@ -104,9 +95,8 @@ class __$$IngredientImplCopyWithImpl<$Res>
extends _$IngredientCopyWithImpl<$Res, _$IngredientImpl>
implements _$$IngredientImplCopyWith<$Res> {
__$$IngredientImplCopyWithImpl(
_$IngredientImpl _value,
$Res Function(_$IngredientImpl) _then,
) : super(_value, _then);
_$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.
@@ -117,36 +107,28 @@ class __$$IngredientImplCopyWithImpl<$Res>
Object? unit = null,
Object? portion = null,
}) {
return _then(
_$IngredientImpl(
name:
null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
unit:
null == unit
? _value.unit
: unit // ignore: cast_nullable_to_non_nullable
as String,
portion:
null == portion
? _value.portion
: portion // ignore: cast_nullable_to_non_nullable
as String,
),
);
return _then(_$IngredientImpl(
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
unit: null == unit
? _value.unit
: unit // ignore: cast_nullable_to_non_nullable
as String,
portion: null == portion
? _value.portion
: portion // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
@JsonSerializable()
class _$IngredientImpl implements _Ingredient {
const _$IngredientImpl({
required this.name,
required this.unit,
required this.portion,
});
const _$IngredientImpl(
{required this.name, required this.unit, required this.portion});
factory _$IngredientImpl.fromJson(Map<String, dynamic> json) =>
_$$IngredientImplFromJson(json);
@@ -187,16 +169,17 @@ class _$IngredientImpl implements _Ingredient {
@override
Map<String, dynamic> toJson() {
return _$$IngredientImplToJson(this);
return _$$IngredientImplToJson(
this,
);
}
}
abstract class _Ingredient implements Ingredient {
const factory _Ingredient({
required final String name,
required final String unit,
required final String portion,
}) = _$IngredientImpl;
const factory _Ingredient(
{required final String name,
required final String unit,
required final String portion}) = _$IngredientImpl;
factory _Ingredient.fromJson(Map<String, dynamic> json) =
_$IngredientImpl.fromJson;

View File

@@ -12,8 +12,7 @@ part of 'product.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Product _$ProductFromJson(Map<String, dynamic> json) {
return _Product.fromJson(json);
@@ -55,31 +54,28 @@ class _$ProductCopyWithImpl<$Res, $Val extends Product>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? id = null, Object? name = null}) {
return _then(
_value.copyWith(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name:
null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
)
as $Val,
);
$Res call({
Object? id = null,
Object? name = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$ProductImplCopyWith<$Res> implements $ProductCopyWith<$Res> {
factory _$$ProductImplCopyWith(
_$ProductImpl value,
$Res Function(_$ProductImpl) then,
) = __$$ProductImplCopyWithImpl<$Res>;
_$ProductImpl value, $Res Function(_$ProductImpl) then) =
__$$ProductImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int id, String name});
@@ -90,29 +86,27 @@ class __$$ProductImplCopyWithImpl<$Res>
extends _$ProductCopyWithImpl<$Res, _$ProductImpl>
implements _$$ProductImplCopyWith<$Res> {
__$$ProductImplCopyWithImpl(
_$ProductImpl _value,
$Res Function(_$ProductImpl) _then,
) : super(_value, _then);
_$ProductImpl _value, $Res Function(_$ProductImpl) _then)
: super(_value, _then);
/// Create a copy of Product
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? id = null, Object? name = null}) {
return _then(
_$ProductImpl(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name:
null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
),
);
$Res call({
Object? id = null,
Object? name = null,
}) {
return _then(_$ProductImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
@@ -157,7 +151,9 @@ class _$ProductImpl implements _Product {
@override
Map<String, dynamic> toJson() {
return _$$ProductImplToJson(this);
return _$$ProductImplToJson(
this,
);
}
}

View File

@@ -13,4 +13,7 @@ _$ProductImpl _$$ProductImplFromJson(Map<String, dynamic> json) =>
);
Map<String, dynamic> _$$ProductImplToJson(_$ProductImpl instance) =>
<String, dynamic>{'id': instance.id, 'name': instance.name};
<String, dynamic>{
'id': instance.id,
'name': instance.name,
};

View File

@@ -7,8 +7,8 @@ part 'recipe_create_model.freezed.dart';
part 'recipe_create_model.g.dart';
enum RecipeType {
first_meals,
second_meals,
@JsonKey(name: 'first_meals') firstMeals,
@JsonKey(name: 'second_meals') secondMeals,
salads,
snacks,
sweets,

View File

@@ -12,8 +12,7 @@ part of 'recipe_create_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
RecipeCreateModel _$RecipeCreateModelFromJson(Map<String, dynamic> json) {
return _RecipeCreateModel.fromJson(json);
@@ -52,24 +51,22 @@ mixin _$RecipeCreateModel {
/// @nodoc
abstract class $RecipeCreateModelCopyWith<$Res> {
factory $RecipeCreateModelCopyWith(
RecipeCreateModel value,
$Res Function(RecipeCreateModel) then,
) = _$RecipeCreateModelCopyWithImpl<$Res, RecipeCreateModel>;
RecipeCreateModel value, $Res Function(RecipeCreateModel) then) =
_$RecipeCreateModelCopyWithImpl<$Res, RecipeCreateModel>;
@useResult
$Res call({
String title,
String state,
@JsonKey(name: 'description_md') String description,
RecipeType type,
@JsonKey(name: 'video_url') String? videoUrl,
@JsonKey(name: 'cooking_time') String? cookingTime,
@JsonKey(name: 'active_time') String? activeTime,
String servings,
@JsonKey(name: 'energy_per_serving') String energyPerServing,
List<String> tags,
List<Ingredient> ingredients,
List<Step> steps,
});
$Res call(
{String title,
String state,
@JsonKey(name: 'description_md') String description,
RecipeType type,
@JsonKey(name: 'video_url') String? videoUrl,
@JsonKey(name: 'cooking_time') String? cookingTime,
@JsonKey(name: 'active_time') String? activeTime,
String servings,
@JsonKey(name: 'energy_per_serving') String energyPerServing,
List<String> tags,
List<Ingredient> ingredients,
List<Step> steps});
}
/// @nodoc
@@ -100,107 +97,89 @@ class _$RecipeCreateModelCopyWithImpl<$Res, $Val extends RecipeCreateModel>
Object? ingredients = null,
Object? steps = null,
}) {
return _then(
_value.copyWith(
title:
null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
state:
null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String,
description:
null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
type:
null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as RecipeType,
videoUrl:
freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
cookingTime:
freezed == cookingTime
? _value.cookingTime
: cookingTime // ignore: cast_nullable_to_non_nullable
as String?,
activeTime:
freezed == activeTime
? _value.activeTime
: activeTime // ignore: cast_nullable_to_non_nullable
as String?,
servings:
null == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as String,
energyPerServing:
null == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as String,
tags:
null == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
ingredients:
null == ingredients
? _value.ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient>,
steps:
null == steps
? _value.steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step>,
)
as $Val,
);
return _then(_value.copyWith(
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
state: null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
type: null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as RecipeType,
videoUrl: freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
cookingTime: freezed == cookingTime
? _value.cookingTime
: cookingTime // ignore: cast_nullable_to_non_nullable
as String?,
activeTime: freezed == activeTime
? _value.activeTime
: activeTime // ignore: cast_nullable_to_non_nullable
as String?,
servings: null == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as String,
energyPerServing: null == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as String,
tags: null == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
ingredients: null == ingredients
? _value.ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient>,
steps: null == steps
? _value.steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step>,
) as $Val);
}
}
/// @nodoc
abstract class _$$RecipeCreateModelImplCopyWith<$Res>
implements $RecipeCreateModelCopyWith<$Res> {
factory _$$RecipeCreateModelImplCopyWith(
_$RecipeCreateModelImpl value,
$Res Function(_$RecipeCreateModelImpl) then,
) = __$$RecipeCreateModelImplCopyWithImpl<$Res>;
factory _$$RecipeCreateModelImplCopyWith(_$RecipeCreateModelImpl value,
$Res Function(_$RecipeCreateModelImpl) then) =
__$$RecipeCreateModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String title,
String state,
@JsonKey(name: 'description_md') String description,
RecipeType type,
@JsonKey(name: 'video_url') String? videoUrl,
@JsonKey(name: 'cooking_time') String? cookingTime,
@JsonKey(name: 'active_time') String? activeTime,
String servings,
@JsonKey(name: 'energy_per_serving') String energyPerServing,
List<String> tags,
List<Ingredient> ingredients,
List<Step> steps,
});
$Res call(
{String title,
String state,
@JsonKey(name: 'description_md') String description,
RecipeType type,
@JsonKey(name: 'video_url') String? videoUrl,
@JsonKey(name: 'cooking_time') String? cookingTime,
@JsonKey(name: 'active_time') String? activeTime,
String servings,
@JsonKey(name: 'energy_per_serving') String energyPerServing,
List<String> tags,
List<Ingredient> ingredients,
List<Step> steps});
}
/// @nodoc
class __$$RecipeCreateModelImplCopyWithImpl<$Res>
extends _$RecipeCreateModelCopyWithImpl<$Res, _$RecipeCreateModelImpl>
implements _$$RecipeCreateModelImplCopyWith<$Res> {
__$$RecipeCreateModelImplCopyWithImpl(
_$RecipeCreateModelImpl _value,
$Res Function(_$RecipeCreateModelImpl) _then,
) : super(_value, _then);
__$$RecipeCreateModelImplCopyWithImpl(_$RecipeCreateModelImpl _value,
$Res Function(_$RecipeCreateModelImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeCreateModel
/// with the given fields replaced by the non-null parameter values.
@@ -220,92 +199,78 @@ class __$$RecipeCreateModelImplCopyWithImpl<$Res>
Object? ingredients = null,
Object? steps = null,
}) {
return _then(
_$RecipeCreateModelImpl(
title:
null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
state:
null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String,
description:
null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
type:
null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as RecipeType,
videoUrl:
freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
cookingTime:
freezed == cookingTime
? _value.cookingTime
: cookingTime // ignore: cast_nullable_to_non_nullable
as String?,
activeTime:
freezed == activeTime
? _value.activeTime
: activeTime // ignore: cast_nullable_to_non_nullable
as String?,
servings:
null == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as String,
energyPerServing:
null == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as String,
tags:
null == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
ingredients:
null == ingredients
? _value._ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient>,
steps:
null == steps
? _value._steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step>,
),
);
return _then(_$RecipeCreateModelImpl(
title: null == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String,
state: null == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String,
description: null == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String,
type: null == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as RecipeType,
videoUrl: freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
cookingTime: freezed == cookingTime
? _value.cookingTime
: cookingTime // ignore: cast_nullable_to_non_nullable
as String?,
activeTime: freezed == activeTime
? _value.activeTime
: activeTime // ignore: cast_nullable_to_non_nullable
as String?,
servings: null == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as String,
energyPerServing: null == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as String,
tags: null == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>,
ingredients: null == ingredients
? _value._ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient>,
steps: null == steps
? _value._steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step>,
));
}
}
/// @nodoc
@JsonSerializable()
class _$RecipeCreateModelImpl implements _RecipeCreateModel {
const _$RecipeCreateModelImpl({
required this.title,
required this.state,
@JsonKey(name: 'description_md') required this.description,
required this.type,
@JsonKey(name: 'video_url') this.videoUrl,
@JsonKey(name: 'cooking_time') this.cookingTime,
@JsonKey(name: 'active_time') this.activeTime,
required this.servings,
@JsonKey(name: 'energy_per_serving') required this.energyPerServing,
required final List<String> tags,
required final List<Ingredient> ingredients,
required final List<Step> steps,
}) : _tags = tags,
_ingredients = ingredients,
_steps = steps;
const _$RecipeCreateModelImpl(
{required this.title,
required this.state,
@JsonKey(name: 'description_md') required this.description,
required this.type,
@JsonKey(name: 'video_url') this.videoUrl,
@JsonKey(name: 'cooking_time') this.cookingTime,
@JsonKey(name: 'active_time') this.activeTime,
required this.servings,
@JsonKey(name: 'energy_per_serving') required this.energyPerServing,
required final List<String> tags,
required final List<Ingredient> ingredients,
required final List<Step> steps})
: _tags = tags,
_ingredients = ingredients,
_steps = steps;
factory _$RecipeCreateModelImpl.fromJson(Map<String, dynamic> json) =>
_$$RecipeCreateModelImplFromJson(json);
@@ -383,30 +348,27 @@ class _$RecipeCreateModelImpl implements _RecipeCreateModel {
(identical(other.energyPerServing, energyPerServing) ||
other.energyPerServing == energyPerServing) &&
const DeepCollectionEquality().equals(other._tags, _tags) &&
const DeepCollectionEquality().equals(
other._ingredients,
_ingredients,
) &&
const DeepCollectionEquality()
.equals(other._ingredients, _ingredients) &&
const DeepCollectionEquality().equals(other._steps, _steps));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
title,
state,
description,
type,
videoUrl,
cookingTime,
activeTime,
servings,
energyPerServing,
const DeepCollectionEquality().hash(_tags),
const DeepCollectionEquality().hash(_ingredients),
const DeepCollectionEquality().hash(_steps),
);
runtimeType,
title,
state,
description,
type,
videoUrl,
cookingTime,
activeTime,
servings,
energyPerServing,
const DeepCollectionEquality().hash(_tags),
const DeepCollectionEquality().hash(_ingredients),
const DeepCollectionEquality().hash(_steps));
/// Create a copy of RecipeCreateModel
/// with the given fields replaced by the non-null parameter values.
@@ -415,31 +377,31 @@ class _$RecipeCreateModelImpl implements _RecipeCreateModel {
@pragma('vm:prefer-inline')
_$$RecipeCreateModelImplCopyWith<_$RecipeCreateModelImpl> get copyWith =>
__$$RecipeCreateModelImplCopyWithImpl<_$RecipeCreateModelImpl>(
this,
_$identity,
);
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$RecipeCreateModelImplToJson(this);
return _$$RecipeCreateModelImplToJson(
this,
);
}
}
abstract class _RecipeCreateModel implements RecipeCreateModel {
const factory _RecipeCreateModel({
required final String title,
required final String state,
@JsonKey(name: 'description_md') required final String description,
required final RecipeType type,
@JsonKey(name: 'video_url') final String? videoUrl,
@JsonKey(name: 'cooking_time') final String? cookingTime,
@JsonKey(name: 'active_time') final String? activeTime,
required final String servings,
@JsonKey(name: 'energy_per_serving') required final String energyPerServing,
required final List<String> tags,
required final List<Ingredient> ingredients,
required final List<Step> steps,
}) = _$RecipeCreateModelImpl;
const factory _RecipeCreateModel(
{required final String title,
required final String state,
@JsonKey(name: 'description_md') required final String description,
required final RecipeType type,
@JsonKey(name: 'video_url') final String? videoUrl,
@JsonKey(name: 'cooking_time') final String? cookingTime,
@JsonKey(name: 'active_time') final String? activeTime,
required final String servings,
@JsonKey(name: 'energy_per_serving')
required final String energyPerServing,
required final List<String> tags,
required final List<Ingredient> ingredients,
required final List<Step> steps}) = _$RecipeCreateModelImpl;
factory _RecipeCreateModel.fromJson(Map<String, dynamic> json) =
_$RecipeCreateModelImpl.fromJson;

View File

@@ -7,48 +7,46 @@ part of 'recipe_create_model.dart';
// **************************************************************************
_$RecipeCreateModelImpl _$$RecipeCreateModelImplFromJson(
Map<String, dynamic> json,
) => _$RecipeCreateModelImpl(
title: json['title'] as String,
state: json['state'] as String,
description: json['description_md'] as String,
type: $enumDecode(_$RecipeTypeEnumMap, json['type']),
videoUrl: json['video_url'] as String?,
cookingTime: json['cooking_time'] as String?,
activeTime: json['active_time'] as String?,
servings: json['servings'] as String,
energyPerServing: json['energy_per_serving'] as String,
tags: (json['tags'] as List<dynamic>).map((e) => e as String).toList(),
ingredients:
(json['ingredients'] as List<dynamic>)
Map<String, dynamic> json) =>
_$RecipeCreateModelImpl(
title: json['title'] as String,
state: json['state'] as String,
description: json['description_md'] as String,
type: $enumDecode(_$RecipeTypeEnumMap, json['type']),
videoUrl: json['video_url'] as String?,
cookingTime: json['cooking_time'] as String?,
activeTime: json['active_time'] as String?,
servings: json['servings'] as String,
energyPerServing: json['energy_per_serving'] as String,
tags: (json['tags'] as List<dynamic>).map((e) => e as String).toList(),
ingredients: (json['ingredients'] as List<dynamic>)
.map((e) => Ingredient.fromJson(e as Map<String, dynamic>))
.toList(),
steps:
(json['steps'] as List<dynamic>)
steps: (json['steps'] as List<dynamic>)
.map((e) => Step.fromJson(e as Map<String, dynamic>))
.toList(),
);
);
Map<String, dynamic> _$$RecipeCreateModelImplToJson(
_$RecipeCreateModelImpl instance,
) => <String, dynamic>{
'title': instance.title,
'state': instance.state,
'description_md': instance.description,
'type': _$RecipeTypeEnumMap[instance.type]!,
'video_url': instance.videoUrl,
'cooking_time': instance.cookingTime,
'active_time': instance.activeTime,
'servings': instance.servings,
'energy_per_serving': instance.energyPerServing,
'tags': instance.tags,
'ingredients': instance.ingredients,
'steps': instance.steps,
};
_$RecipeCreateModelImpl instance) =>
<String, dynamic>{
'title': instance.title,
'state': instance.state,
'description_md': instance.description,
'type': _$RecipeTypeEnumMap[instance.type]!,
'video_url': instance.videoUrl,
'cooking_time': instance.cookingTime,
'active_time': instance.activeTime,
'servings': instance.servings,
'energy_per_serving': instance.energyPerServing,
'tags': instance.tags,
'ingredients': instance.ingredients,
'steps': instance.steps,
};
const _$RecipeTypeEnumMap = {
RecipeType.first_meals: 'first_meals',
RecipeType.second_meals: 'second_meals',
RecipeType.firstMeals: 'firstMeals',
RecipeType.secondMeals: 'secondMeals',
RecipeType.salads: 'salads',
RecipeType.snacks: 'snacks',
RecipeType.sweets: 'sweets',

View File

@@ -16,12 +16,12 @@ class RecipeModel with _$RecipeModel {
String? state,
String? title,
String? description,
String? video_url,
@JsonKey(name: 'video_url') String? videoUrl,
String? image,
int? totalCookingTime,
int? activeCookTime,
int? servings,
int? energyPerServing,
int? servings,
int? energyPerServing,
}) = _RecipeModel;
factory RecipeModel.fromJson(Map<String, Object?> json) => _$RecipeModelFromJson(json);

View File

@@ -12,8 +12,7 @@ part of 'recipe_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
RecipeModel _$RecipeModelFromJson(Map<String, dynamic> json) {
return _RecipeModel.fromJson(json);
@@ -28,7 +27,8 @@ mixin _$RecipeModel {
String? get state => throw _privateConstructorUsedError;
String? get title => throw _privateConstructorUsedError;
String? get description => throw _privateConstructorUsedError;
String? get video_url => throw _privateConstructorUsedError;
@JsonKey(name: 'video_url')
String? get videoUrl => throw _privateConstructorUsedError;
String? get image => throw _privateConstructorUsedError;
int? get totalCookingTime => throw _privateConstructorUsedError;
int? get activeCookTime => throw _privateConstructorUsedError;
@@ -48,25 +48,23 @@ mixin _$RecipeModel {
/// @nodoc
abstract class $RecipeModelCopyWith<$Res> {
factory $RecipeModelCopyWith(
RecipeModel value,
$Res Function(RecipeModel) then,
) = _$RecipeModelCopyWithImpl<$Res, RecipeModel>;
RecipeModel value, $Res Function(RecipeModel) then) =
_$RecipeModelCopyWithImpl<$Res, RecipeModel>;
@useResult
$Res call({
List<Ingredient?>? ingredients,
List<Step?>? steps,
List<String>? tags,
String? type,
String? state,
String? title,
String? description,
String? video_url,
String? image,
int? totalCookingTime,
int? activeCookTime,
int? servings,
int? energyPerServing,
});
$Res call(
{List<Ingredient?>? ingredients,
List<Step?>? steps,
List<String>? tags,
String? type,
String? state,
String? title,
String? description,
@JsonKey(name: 'video_url') String? videoUrl,
String? image,
int? totalCookingTime,
int? activeCookTime,
int? servings,
int? energyPerServing});
}
/// @nodoc
@@ -91,83 +89,67 @@ class _$RecipeModelCopyWithImpl<$Res, $Val extends RecipeModel>
Object? state = freezed,
Object? title = freezed,
Object? description = freezed,
Object? video_url = freezed,
Object? videoUrl = freezed,
Object? image = freezed,
Object? totalCookingTime = freezed,
Object? activeCookTime = freezed,
Object? servings = freezed,
Object? energyPerServing = freezed,
}) {
return _then(
_value.copyWith(
ingredients:
freezed == ingredients
? _value.ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient?>?,
steps:
freezed == steps
? _value.steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step?>?,
tags:
freezed == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>?,
type:
freezed == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as String?,
state:
freezed == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String?,
title:
freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
video_url:
freezed == video_url
? _value.video_url
: video_url // ignore: cast_nullable_to_non_nullable
as String?,
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
totalCookingTime:
freezed == totalCookingTime
? _value.totalCookingTime
: totalCookingTime // ignore: cast_nullable_to_non_nullable
as int?,
activeCookTime:
freezed == activeCookTime
? _value.activeCookTime
: activeCookTime // ignore: cast_nullable_to_non_nullable
as int?,
servings:
freezed == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as int?,
energyPerServing:
freezed == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as int?,
)
as $Val,
);
return _then(_value.copyWith(
ingredients: freezed == ingredients
? _value.ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient?>?,
steps: freezed == steps
? _value.steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step?>?,
tags: freezed == tags
? _value.tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>?,
type: freezed == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as String?,
state: freezed == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String?,
title: freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
videoUrl: freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
totalCookingTime: freezed == totalCookingTime
? _value.totalCookingTime
: totalCookingTime // ignore: cast_nullable_to_non_nullable
as int?,
activeCookTime: freezed == activeCookTime
? _value.activeCookTime
: activeCookTime // ignore: cast_nullable_to_non_nullable
as int?,
servings: freezed == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as int?,
energyPerServing: freezed == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as int?,
) as $Val);
}
}
@@ -175,26 +157,24 @@ class _$RecipeModelCopyWithImpl<$Res, $Val extends RecipeModel>
abstract class _$$RecipeModelImplCopyWith<$Res>
implements $RecipeModelCopyWith<$Res> {
factory _$$RecipeModelImplCopyWith(
_$RecipeModelImpl value,
$Res Function(_$RecipeModelImpl) then,
) = __$$RecipeModelImplCopyWithImpl<$Res>;
_$RecipeModelImpl value, $Res Function(_$RecipeModelImpl) then) =
__$$RecipeModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
List<Ingredient?>? ingredients,
List<Step?>? steps,
List<String>? tags,
String? type,
String? state,
String? title,
String? description,
String? video_url,
String? image,
int? totalCookingTime,
int? activeCookTime,
int? servings,
int? energyPerServing,
});
$Res call(
{List<Ingredient?>? ingredients,
List<Step?>? steps,
List<String>? tags,
String? type,
String? state,
String? title,
String? description,
@JsonKey(name: 'video_url') String? videoUrl,
String? image,
int? totalCookingTime,
int? activeCookTime,
int? servings,
int? energyPerServing});
}
/// @nodoc
@@ -202,9 +182,8 @@ class __$$RecipeModelImplCopyWithImpl<$Res>
extends _$RecipeModelCopyWithImpl<$Res, _$RecipeModelImpl>
implements _$$RecipeModelImplCopyWith<$Res> {
__$$RecipeModelImplCopyWithImpl(
_$RecipeModelImpl _value,
$Res Function(_$RecipeModelImpl) _then,
) : super(_value, _then);
_$RecipeModelImpl _value, $Res Function(_$RecipeModelImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeModel
/// with the given fields replaced by the non-null parameter values.
@@ -218,105 +197,90 @@ class __$$RecipeModelImplCopyWithImpl<$Res>
Object? state = freezed,
Object? title = freezed,
Object? description = freezed,
Object? video_url = freezed,
Object? videoUrl = freezed,
Object? image = freezed,
Object? totalCookingTime = freezed,
Object? activeCookTime = freezed,
Object? servings = freezed,
Object? energyPerServing = freezed,
}) {
return _then(
_$RecipeModelImpl(
ingredients:
freezed == ingredients
? _value._ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient?>?,
steps:
freezed == steps
? _value._steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step?>?,
tags:
freezed == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>?,
type:
freezed == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as String?,
state:
freezed == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String?,
title:
freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
video_url:
freezed == video_url
? _value.video_url
: video_url // ignore: cast_nullable_to_non_nullable
as String?,
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
totalCookingTime:
freezed == totalCookingTime
? _value.totalCookingTime
: totalCookingTime // ignore: cast_nullable_to_non_nullable
as int?,
activeCookTime:
freezed == activeCookTime
? _value.activeCookTime
: activeCookTime // ignore: cast_nullable_to_non_nullable
as int?,
servings:
freezed == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as int?,
energyPerServing:
freezed == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as int?,
),
);
return _then(_$RecipeModelImpl(
ingredients: freezed == ingredients
? _value._ingredients
: ingredients // ignore: cast_nullable_to_non_nullable
as List<Ingredient?>?,
steps: freezed == steps
? _value._steps
: steps // ignore: cast_nullable_to_non_nullable
as List<Step?>?,
tags: freezed == tags
? _value._tags
: tags // ignore: cast_nullable_to_non_nullable
as List<String>?,
type: freezed == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as String?,
state: freezed == state
? _value.state
: state // ignore: cast_nullable_to_non_nullable
as String?,
title: freezed == title
? _value.title
: title // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
videoUrl: freezed == videoUrl
? _value.videoUrl
: videoUrl // ignore: cast_nullable_to_non_nullable
as String?,
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
totalCookingTime: freezed == totalCookingTime
? _value.totalCookingTime
: totalCookingTime // ignore: cast_nullable_to_non_nullable
as int?,
activeCookTime: freezed == activeCookTime
? _value.activeCookTime
: activeCookTime // ignore: cast_nullable_to_non_nullable
as int?,
servings: freezed == servings
? _value.servings
: servings // ignore: cast_nullable_to_non_nullable
as int?,
energyPerServing: freezed == energyPerServing
? _value.energyPerServing
: energyPerServing // ignore: cast_nullable_to_non_nullable
as int?,
));
}
}
/// @nodoc
@JsonSerializable()
class _$RecipeModelImpl implements _RecipeModel {
const _$RecipeModelImpl({
final List<Ingredient?>? ingredients,
final List<Step?>? steps,
final List<String>? tags,
this.type,
this.state,
this.title,
this.description,
this.video_url,
this.image,
this.totalCookingTime,
this.activeCookTime,
this.servings,
this.energyPerServing,
}) : _ingredients = ingredients,
_steps = steps,
_tags = tags;
const _$RecipeModelImpl(
{final List<Ingredient?>? ingredients,
final List<Step?>? steps,
final List<String>? tags,
this.type,
this.state,
this.title,
this.description,
@JsonKey(name: 'video_url') this.videoUrl,
this.image,
this.totalCookingTime,
this.activeCookTime,
this.servings,
this.energyPerServing})
: _ingredients = ingredients,
_steps = steps,
_tags = tags;
factory _$RecipeModelImpl.fromJson(Map<String, dynamic> json) =>
_$$RecipeModelImplFromJson(json);
@@ -360,7 +324,8 @@ class _$RecipeModelImpl implements _RecipeModel {
@override
final String? description;
@override
final String? video_url;
@JsonKey(name: 'video_url')
final String? videoUrl;
@override
final String? image;
@override
@@ -374,7 +339,7 @@ class _$RecipeModelImpl implements _RecipeModel {
@override
String toString() {
return 'RecipeModel(ingredients: $ingredients, steps: $steps, tags: $tags, type: $type, state: $state, title: $title, description: $description, video_url: $video_url, image: $image, totalCookingTime: $totalCookingTime, activeCookTime: $activeCookTime, servings: $servings, energyPerServing: $energyPerServing)';
return 'RecipeModel(ingredients: $ingredients, steps: $steps, tags: $tags, type: $type, state: $state, title: $title, description: $description, videoUrl: $videoUrl, image: $image, totalCookingTime: $totalCookingTime, activeCookTime: $activeCookTime, servings: $servings, energyPerServing: $energyPerServing)';
}
@override
@@ -382,10 +347,8 @@ class _$RecipeModelImpl implements _RecipeModel {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$RecipeModelImpl &&
const DeepCollectionEquality().equals(
other._ingredients,
_ingredients,
) &&
const DeepCollectionEquality()
.equals(other._ingredients, _ingredients) &&
const DeepCollectionEquality().equals(other._steps, _steps) &&
const DeepCollectionEquality().equals(other._tags, _tags) &&
(identical(other.type, type) || other.type == type) &&
@@ -393,8 +356,8 @@ class _$RecipeModelImpl implements _RecipeModel {
(identical(other.title, title) || other.title == title) &&
(identical(other.description, description) ||
other.description == description) &&
(identical(other.video_url, video_url) ||
other.video_url == video_url) &&
(identical(other.videoUrl, videoUrl) ||
other.videoUrl == videoUrl) &&
(identical(other.image, image) || other.image == image) &&
(identical(other.totalCookingTime, totalCookingTime) ||
other.totalCookingTime == totalCookingTime) &&
@@ -409,21 +372,20 @@ class _$RecipeModelImpl implements _RecipeModel {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_ingredients),
const DeepCollectionEquality().hash(_steps),
const DeepCollectionEquality().hash(_tags),
type,
state,
title,
description,
video_url,
image,
totalCookingTime,
activeCookTime,
servings,
energyPerServing,
);
runtimeType,
const DeepCollectionEquality().hash(_ingredients),
const DeepCollectionEquality().hash(_steps),
const DeepCollectionEquality().hash(_tags),
type,
state,
title,
description,
videoUrl,
image,
totalCookingTime,
activeCookTime,
servings,
energyPerServing);
/// Create a copy of RecipeModel
/// with the given fields replaced by the non-null parameter values.
@@ -435,26 +397,27 @@ class _$RecipeModelImpl implements _RecipeModel {
@override
Map<String, dynamic> toJson() {
return _$$RecipeModelImplToJson(this);
return _$$RecipeModelImplToJson(
this,
);
}
}
abstract class _RecipeModel implements RecipeModel {
const factory _RecipeModel({
final List<Ingredient?>? ingredients,
final List<Step?>? steps,
final List<String>? tags,
final String? type,
final String? state,
final String? title,
final String? description,
final String? video_url,
final String? image,
final int? totalCookingTime,
final int? activeCookTime,
final int? servings,
final int? energyPerServing,
}) = _$RecipeModelImpl;
const factory _RecipeModel(
{final List<Ingredient?>? ingredients,
final List<Step?>? steps,
final List<String>? tags,
final String? type,
final String? state,
final String? title,
final String? description,
@JsonKey(name: 'video_url') final String? videoUrl,
final String? image,
final int? totalCookingTime,
final int? activeCookTime,
final int? servings,
final int? energyPerServing}) = _$RecipeModelImpl;
factory _RecipeModel.fromJson(Map<String, dynamic> json) =
_$RecipeModelImpl.fromJson;
@@ -474,7 +437,8 @@ abstract class _RecipeModel implements RecipeModel {
@override
String? get description;
@override
String? get video_url;
@JsonKey(name: 'video_url')
String? get videoUrl;
@override
String? get image;
@override

View File

@@ -8,28 +8,20 @@ part of 'recipe_model.dart';
_$RecipeModelImpl _$$RecipeModelImplFromJson(Map<String, dynamic> json) =>
_$RecipeModelImpl(
ingredients:
(json['ingredients'] as List<dynamic>?)
?.map(
(e) =>
e == null
? null
: Ingredient.fromJson(e as Map<String, dynamic>),
)
.toList(),
steps:
(json['steps'] as List<dynamic>?)
?.map(
(e) =>
e == null ? null : Step.fromJson(e as Map<String, dynamic>),
)
.toList(),
ingredients: (json['ingredients'] as List<dynamic>?)
?.map((e) =>
e == null ? null : Ingredient.fromJson(e as Map<String, dynamic>))
.toList(),
steps: (json['steps'] as List<dynamic>?)
?.map((e) =>
e == null ? null : Step.fromJson(e as Map<String, dynamic>))
.toList(),
tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(),
type: json['type'] as String?,
state: json['state'] as String?,
title: json['title'] as String?,
description: json['description'] as String?,
video_url: json['video_url'] as String?,
videoUrl: json['video_url'] as String?,
image: json['image'] as String?,
totalCookingTime: (json['totalCookingTime'] as num?)?.toInt(),
activeCookTime: (json['activeCookTime'] as num?)?.toInt(),
@@ -46,7 +38,7 @@ Map<String, dynamic> _$$RecipeModelImplToJson(_$RecipeModelImpl instance) =>
'state': instance.state,
'title': instance.title,
'description': instance.description,
'video_url': instance.video_url,
'video_url': instance.videoUrl,
'image': instance.image,
'totalCookingTime': instance.totalCookingTime,
'activeCookTime': instance.activeCookTime,

View File

@@ -12,8 +12,7 @@ part of 'recipe_tag_model.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
RecipeTagModel _$RecipeTagModelFromJson(Map<String, dynamic> json) {
return _RecipeTagModel.fromJson(json);
@@ -41,15 +40,13 @@ mixin _$RecipeTagModel {
/// @nodoc
abstract class $RecipeTagModelCopyWith<$Res> {
factory $RecipeTagModelCopyWith(
RecipeTagModel value,
$Res Function(RecipeTagModel) then,
) = _$RecipeTagModelCopyWithImpl<$Res, RecipeTagModel>;
RecipeTagModel value, $Res Function(RecipeTagModel) then) =
_$RecipeTagModelCopyWithImpl<$Res, RecipeTagModel>;
@useResult
$Res call({
@JsonKey(name: "data") List<RecipeTag> data,
@JsonKey(name: "links") Links links,
@JsonKey(name: "meta") Meta meta,
});
$Res call(
{@JsonKey(name: "data") List<RecipeTag> data,
@JsonKey(name: "links") Links links,
@JsonKey(name: "meta") Meta meta});
$LinksCopyWith<$Res> get links;
$MetaCopyWith<$Res> get meta;
@@ -69,27 +66,25 @@ class _$RecipeTagModelCopyWithImpl<$Res, $Val extends RecipeTagModel>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? data = null, Object? links = null, Object? meta = null}) {
return _then(
_value.copyWith(
data:
null == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as List<RecipeTag>,
links:
null == links
? _value.links
: links // ignore: cast_nullable_to_non_nullable
as Links,
meta:
null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as Meta,
)
as $Val,
);
$Res call({
Object? data = null,
Object? links = null,
Object? meta = null,
}) {
return _then(_value.copyWith(
data: null == data
? _value.data
: data // ignore: cast_nullable_to_non_nullable
as List<RecipeTag>,
links: null == links
? _value.links
: links // ignore: cast_nullable_to_non_nullable
as Links,
meta: null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as Meta,
) as $Val);
}
/// Create a copy of RecipeTagModel
@@ -116,17 +111,15 @@ class _$RecipeTagModelCopyWithImpl<$Res, $Val extends RecipeTagModel>
/// @nodoc
abstract class _$$RecipeTagModelImplCopyWith<$Res>
implements $RecipeTagModelCopyWith<$Res> {
factory _$$RecipeTagModelImplCopyWith(
_$RecipeTagModelImpl value,
$Res Function(_$RecipeTagModelImpl) then,
) = __$$RecipeTagModelImplCopyWithImpl<$Res>;
factory _$$RecipeTagModelImplCopyWith(_$RecipeTagModelImpl value,
$Res Function(_$RecipeTagModelImpl) then) =
__$$RecipeTagModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
@JsonKey(name: "data") List<RecipeTag> data,
@JsonKey(name: "links") Links links,
@JsonKey(name: "meta") Meta meta,
});
$Res call(
{@JsonKey(name: "data") List<RecipeTag> data,
@JsonKey(name: "links") Links links,
@JsonKey(name: "meta") Meta meta});
@override
$LinksCopyWith<$Res> get links;
@@ -139,45 +132,43 @@ class __$$RecipeTagModelImplCopyWithImpl<$Res>
extends _$RecipeTagModelCopyWithImpl<$Res, _$RecipeTagModelImpl>
implements _$$RecipeTagModelImplCopyWith<$Res> {
__$$RecipeTagModelImplCopyWithImpl(
_$RecipeTagModelImpl _value,
$Res Function(_$RecipeTagModelImpl) _then,
) : super(_value, _then);
_$RecipeTagModelImpl _value, $Res Function(_$RecipeTagModelImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeTagModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? data = null, Object? links = null, Object? meta = null}) {
return _then(
_$RecipeTagModelImpl(
data:
null == data
? _value._data
: data // ignore: cast_nullable_to_non_nullable
as List<RecipeTag>,
links:
null == links
? _value.links
: links // ignore: cast_nullable_to_non_nullable
as Links,
meta:
null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as Meta,
),
);
$Res call({
Object? data = null,
Object? links = null,
Object? meta = null,
}) {
return _then(_$RecipeTagModelImpl(
data: null == data
? _value._data
: data // ignore: cast_nullable_to_non_nullable
as List<RecipeTag>,
links: null == links
? _value.links
: links // ignore: cast_nullable_to_non_nullable
as Links,
meta: null == meta
? _value.meta
: meta // ignore: cast_nullable_to_non_nullable
as Meta,
));
}
}
/// @nodoc
@JsonSerializable()
class _$RecipeTagModelImpl implements _RecipeTagModel {
const _$RecipeTagModelImpl({
@JsonKey(name: "data") required final List<RecipeTag> data,
@JsonKey(name: "links") required this.links,
@JsonKey(name: "meta") required this.meta,
}) : _data = data;
const _$RecipeTagModelImpl(
{@JsonKey(name: "data") required final List<RecipeTag> data,
@JsonKey(name: "links") required this.links,
@JsonKey(name: "meta") required this.meta})
: _data = data;
factory _$RecipeTagModelImpl.fromJson(Map<String, dynamic> json) =>
_$$RecipeTagModelImplFromJson(json);
@@ -216,11 +207,7 @@ class _$RecipeTagModelImpl implements _RecipeTagModel {
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_data),
links,
meta,
);
runtimeType, const DeepCollectionEquality().hash(_data), links, meta);
/// Create a copy of RecipeTagModel
/// with the given fields replaced by the non-null parameter values.
@@ -229,22 +216,21 @@ class _$RecipeTagModelImpl implements _RecipeTagModel {
@pragma('vm:prefer-inline')
_$$RecipeTagModelImplCopyWith<_$RecipeTagModelImpl> get copyWith =>
__$$RecipeTagModelImplCopyWithImpl<_$RecipeTagModelImpl>(
this,
_$identity,
);
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$RecipeTagModelImplToJson(this);
return _$$RecipeTagModelImplToJson(
this,
);
}
}
abstract class _RecipeTagModel implements RecipeTagModel {
const factory _RecipeTagModel({
@JsonKey(name: "data") required final List<RecipeTag> data,
@JsonKey(name: "links") required final Links links,
@JsonKey(name: "meta") required final Meta meta,
}) = _$RecipeTagModelImpl;
const factory _RecipeTagModel(
{@JsonKey(name: "data") required final List<RecipeTag> data,
@JsonKey(name: "links") required final Links links,
@JsonKey(name: "meta") required final Meta meta}) = _$RecipeTagModelImpl;
factory _RecipeTagModel.fromJson(Map<String, dynamic> json) =
_$RecipeTagModelImpl.fromJson;
@@ -299,13 +285,12 @@ abstract class $RecipeTagCopyWith<$Res> {
factory $RecipeTagCopyWith(RecipeTag value, $Res Function(RecipeTag) then) =
_$RecipeTagCopyWithImpl<$Res, RecipeTag>;
@useResult
$Res call({
@JsonKey(name: "id") int id,
@JsonKey(name: "name") String name,
@JsonKey(name: "recipes_count") int recipesCount,
@JsonKey(name: "created_at") DateTime createdAt,
@JsonKey(name: "updated_at") DateTime updatedAt,
});
$Res call(
{@JsonKey(name: "id") int id,
@JsonKey(name: "name") String name,
@JsonKey(name: "recipes_count") int recipesCount,
@JsonKey(name: "created_at") DateTime createdAt,
@JsonKey(name: "updated_at") DateTime updatedAt});
}
/// @nodoc
@@ -329,36 +314,28 @@ class _$RecipeTagCopyWithImpl<$Res, $Val extends RecipeTag>
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(
_value.copyWith(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name:
null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
recipesCount:
null == recipesCount
? _value.recipesCount
: recipesCount // ignore: cast_nullable_to_non_nullable
as int,
createdAt:
null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt:
null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
)
as $Val,
);
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
recipesCount: null == recipesCount
? _value.recipesCount
: recipesCount // ignore: cast_nullable_to_non_nullable
as int,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
) as $Val);
}
}
@@ -366,18 +343,16 @@ class _$RecipeTagCopyWithImpl<$Res, $Val extends RecipeTag>
abstract class _$$RecipeTagImplCopyWith<$Res>
implements $RecipeTagCopyWith<$Res> {
factory _$$RecipeTagImplCopyWith(
_$RecipeTagImpl value,
$Res Function(_$RecipeTagImpl) then,
) = __$$RecipeTagImplCopyWithImpl<$Res>;
_$RecipeTagImpl value, $Res Function(_$RecipeTagImpl) then) =
__$$RecipeTagImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
@JsonKey(name: "id") int id,
@JsonKey(name: "name") String name,
@JsonKey(name: "recipes_count") int recipesCount,
@JsonKey(name: "created_at") DateTime createdAt,
@JsonKey(name: "updated_at") DateTime updatedAt,
});
$Res call(
{@JsonKey(name: "id") int id,
@JsonKey(name: "name") String name,
@JsonKey(name: "recipes_count") int recipesCount,
@JsonKey(name: "created_at") DateTime createdAt,
@JsonKey(name: "updated_at") DateTime updatedAt});
}
/// @nodoc
@@ -385,9 +360,8 @@ class __$$RecipeTagImplCopyWithImpl<$Res>
extends _$RecipeTagCopyWithImpl<$Res, _$RecipeTagImpl>
implements _$$RecipeTagImplCopyWith<$Res> {
__$$RecipeTagImplCopyWithImpl(
_$RecipeTagImpl _value,
$Res Function(_$RecipeTagImpl) _then,
) : super(_value, _then);
_$RecipeTagImpl _value, $Res Function(_$RecipeTagImpl) _then)
: super(_value, _then);
/// Create a copy of RecipeTag
/// with the given fields replaced by the non-null parameter values.
@@ -400,48 +374,40 @@ class __$$RecipeTagImplCopyWithImpl<$Res>
Object? createdAt = null,
Object? updatedAt = null,
}) {
return _then(
_$RecipeTagImpl(
id:
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name:
null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
recipesCount:
null == recipesCount
? _value.recipesCount
: recipesCount // ignore: cast_nullable_to_non_nullable
as int,
createdAt:
null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt:
null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
),
);
return _then(_$RecipeTagImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
name: null == name
? _value.name
: name // ignore: cast_nullable_to_non_nullable
as String,
recipesCount: null == recipesCount
? _value.recipesCount
: recipesCount // ignore: cast_nullable_to_non_nullable
as int,
createdAt: null == createdAt
? _value.createdAt
: createdAt // ignore: cast_nullable_to_non_nullable
as DateTime,
updatedAt: null == updatedAt
? _value.updatedAt
: updatedAt // ignore: cast_nullable_to_non_nullable
as DateTime,
));
}
}
/// @nodoc
@JsonSerializable()
class _$RecipeTagImpl implements _RecipeTag {
const _$RecipeTagImpl({
@JsonKey(name: "id") required this.id,
@JsonKey(name: "name") required this.name,
@JsonKey(name: "recipes_count") required this.recipesCount,
@JsonKey(name: "created_at") required this.createdAt,
@JsonKey(name: "updated_at") required this.updatedAt,
});
const _$RecipeTagImpl(
{@JsonKey(name: "id") required this.id,
@JsonKey(name: "name") required this.name,
@JsonKey(name: "recipes_count") required this.recipesCount,
@JsonKey(name: "created_at") required this.createdAt,
@JsonKey(name: "updated_at") required this.updatedAt});
factory _$RecipeTagImpl.fromJson(Map<String, dynamic> json) =>
_$$RecipeTagImplFromJson(json);
@@ -497,18 +463,20 @@ class _$RecipeTagImpl implements _RecipeTag {
@override
Map<String, dynamic> toJson() {
return _$$RecipeTagImplToJson(this);
return _$$RecipeTagImplToJson(
this,
);
}
}
abstract class _RecipeTag implements RecipeTag {
const factory _RecipeTag({
@JsonKey(name: "id") required final int id,
@JsonKey(name: "name") required final String name,
@JsonKey(name: "recipes_count") required final int recipesCount,
@JsonKey(name: "created_at") required final DateTime createdAt,
@JsonKey(name: "updated_at") required final DateTime updatedAt,
}) = _$RecipeTagImpl;
const factory _RecipeTag(
{@JsonKey(name: "id") required final int id,
@JsonKey(name: "name") required final String name,
@JsonKey(name: "recipes_count") required final int recipesCount,
@JsonKey(name: "created_at") required final DateTime createdAt,
@JsonKey(name: "updated_at") required final DateTime updatedAt}) =
_$RecipeTagImpl;
factory _RecipeTag.fromJson(Map<String, dynamic> json) =
_$RecipeTagImpl.fromJson;

View File

@@ -8,21 +8,20 @@ part of 'recipe_tag_model.dart';
_$RecipeTagModelImpl _$$RecipeTagModelImplFromJson(Map<String, dynamic> json) =>
_$RecipeTagModelImpl(
data:
(json['data'] as List<dynamic>)
.map((e) => RecipeTag.fromJson(e as Map<String, dynamic>))
.toList(),
data: (json['data'] as List<dynamic>)
.map((e) => RecipeTag.fromJson(e as Map<String, dynamic>))
.toList(),
links: Links.fromJson(json['links'] as Map<String, dynamic>),
meta: Meta.fromJson(json['meta'] as Map<String, dynamic>),
);
Map<String, dynamic> _$$RecipeTagModelImplToJson(
_$RecipeTagModelImpl instance,
) => <String, dynamic>{
'data': instance.data,
'links': instance.links,
'meta': instance.meta,
};
_$RecipeTagModelImpl instance) =>
<String, dynamic>{
'data': instance.data,
'links': instance.links,
'meta': instance.meta,
};
_$RecipeTagImpl _$$RecipeTagImplFromJson(Map<String, dynamic> json) =>
_$RecipeTagImpl(

View File

@@ -12,8 +12,7 @@ part of 'step.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
Step _$StepFromJson(Map<String, dynamic> json) {
return _Step.fromJson(json);
@@ -55,31 +54,28 @@ class _$StepCopyWithImpl<$Res, $Val extends Step>
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? image = freezed, Object? description = freezed}) {
return _then(
_value.copyWith(
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
$Res call({
Object? image = freezed,
Object? description = freezed,
}) {
return _then(_value.copyWith(
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
}
/// @nodoc
abstract class _$$StepImplCopyWith<$Res> implements $StepCopyWith<$Res> {
factory _$$StepImplCopyWith(
_$StepImpl value,
$Res Function(_$StepImpl) then,
) = __$$StepImplCopyWithImpl<$Res>;
_$StepImpl value, $Res Function(_$StepImpl) then) =
__$$StepImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String? image, String? description});
@@ -90,27 +86,26 @@ class __$$StepImplCopyWithImpl<$Res>
extends _$StepCopyWithImpl<$Res, _$StepImpl>
implements _$$StepImplCopyWith<$Res> {
__$$StepImplCopyWithImpl(_$StepImpl _value, $Res Function(_$StepImpl) _then)
: super(_value, _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({Object? image = freezed, Object? description = freezed}) {
return _then(
_$StepImpl(
image:
freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
description:
freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
),
);
$Res call({
Object? image = freezed,
Object? description = freezed,
}) {
return _then(_$StepImpl(
image: freezed == image
? _value.image
: image // ignore: cast_nullable_to_non_nullable
as String?,
description: freezed == description
? _value.description
: description // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
@@ -156,7 +151,9 @@ class _$StepImpl implements _Step {
@override
Map<String, dynamic> toJson() {
return _$$StepImplToJson(this);
return _$$StepImplToJson(
this,
);
}
}

View File

@@ -7,9 +7,9 @@ part of 'step.dart';
// **************************************************************************
_$StepImpl _$$StepImplFromJson(Map<String, dynamic> json) => _$StepImpl(
image: json['image'] as String?,
description: json['description'] as String?,
);
image: json['image'] as String?,
description: json['description'] as String?,
);
Map<String, dynamic> _$$StepImplToJson(_$StepImpl instance) =>
<String, dynamic>{

View File

@@ -11,9 +11,9 @@ class CreateRecipeCubit extends Cubit<CreateRecipeState> {
final RecipeRepository recipeRepository;
CreateRecipeCubit({required this.recipeRepository})
: super(
CreateRecipeState(
const CreateRecipeState(
entity: RecipeCreateEntity(
typeOfRecipe: TypeOfRecipe.first_meals,
typeOfRecipe: TypeOfRecipe.firstMeals,
ingredients: [],
steps: [StepEntity()],
tags: [],
@@ -26,7 +26,7 @@ class CreateRecipeCubit extends Cubit<CreateRecipeState> {
state.copyWith.entity(
steps: [
...state.entity.steps,
StepEntity(),
const StepEntity(),
],
),
);

View File

@@ -12,8 +12,7 @@ part of 'create_recipe_state.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$CreateRecipeState {
@@ -37,20 +36,18 @@ mixin _$CreateRecipeState {
/// @nodoc
abstract class $CreateRecipeStateCopyWith<$Res> {
factory $CreateRecipeStateCopyWith(
CreateRecipeState value,
$Res Function(CreateRecipeState) then,
) = _$CreateRecipeStateCopyWithImpl<$Res, CreateRecipeState>;
CreateRecipeState value, $Res Function(CreateRecipeState) then) =
_$CreateRecipeStateCopyWithImpl<$Res, CreateRecipeState>;
@useResult
$Res call({
RecipeCreateEntity entity,
String? titleValidationError,
String? descriptionValidationError,
String? cookingTimeValidationError,
String? activeTimeValidationError,
String? servingsValidationError,
String? energyPerServingValidationError,
String? imageValidationError,
});
$Res call(
{RecipeCreateEntity entity,
String? titleValidationError,
String? descriptionValidationError,
String? cookingTimeValidationError,
String? activeTimeValidationError,
String? servingsValidationError,
String? energyPerServingValidationError,
String? imageValidationError});
$RecipeCreateEntityCopyWith<$Res> get entity;
}
@@ -79,51 +76,41 @@ class _$CreateRecipeStateCopyWithImpl<$Res, $Val extends CreateRecipeState>
Object? energyPerServingValidationError = freezed,
Object? imageValidationError = freezed,
}) {
return _then(
_value.copyWith(
entity:
null == entity
? _value.entity
: entity // ignore: cast_nullable_to_non_nullable
as RecipeCreateEntity,
titleValidationError:
freezed == titleValidationError
? _value.titleValidationError
: titleValidationError // ignore: cast_nullable_to_non_nullable
as String?,
descriptionValidationError:
freezed == descriptionValidationError
? _value.descriptionValidationError
: descriptionValidationError // ignore: cast_nullable_to_non_nullable
as String?,
cookingTimeValidationError:
freezed == cookingTimeValidationError
? _value.cookingTimeValidationError
: cookingTimeValidationError // ignore: cast_nullable_to_non_nullable
as String?,
activeTimeValidationError:
freezed == activeTimeValidationError
? _value.activeTimeValidationError
: activeTimeValidationError // ignore: cast_nullable_to_non_nullable
as String?,
servingsValidationError:
freezed == servingsValidationError
? _value.servingsValidationError
: servingsValidationError // ignore: cast_nullable_to_non_nullable
as String?,
energyPerServingValidationError:
freezed == energyPerServingValidationError
? _value.energyPerServingValidationError
: energyPerServingValidationError // ignore: cast_nullable_to_non_nullable
as String?,
imageValidationError:
freezed == imageValidationError
? _value.imageValidationError
: imageValidationError // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
return _then(_value.copyWith(
entity: null == entity
? _value.entity
: entity // ignore: cast_nullable_to_non_nullable
as RecipeCreateEntity,
titleValidationError: freezed == titleValidationError
? _value.titleValidationError
: titleValidationError // ignore: cast_nullable_to_non_nullable
as String?,
descriptionValidationError: freezed == descriptionValidationError
? _value.descriptionValidationError
: descriptionValidationError // ignore: cast_nullable_to_non_nullable
as String?,
cookingTimeValidationError: freezed == cookingTimeValidationError
? _value.cookingTimeValidationError
: cookingTimeValidationError // ignore: cast_nullable_to_non_nullable
as String?,
activeTimeValidationError: freezed == activeTimeValidationError
? _value.activeTimeValidationError
: activeTimeValidationError // ignore: cast_nullable_to_non_nullable
as String?,
servingsValidationError: freezed == servingsValidationError
? _value.servingsValidationError
: servingsValidationError // ignore: cast_nullable_to_non_nullable
as String?,
energyPerServingValidationError: freezed ==
energyPerServingValidationError
? _value.energyPerServingValidationError
: energyPerServingValidationError // ignore: cast_nullable_to_non_nullable
as String?,
imageValidationError: freezed == imageValidationError
? _value.imageValidationError
: imageValidationError // ignore: cast_nullable_to_non_nullable
as String?,
) as $Val);
}
/// Create a copy of CreateRecipeState
@@ -140,22 +127,20 @@ class _$CreateRecipeStateCopyWithImpl<$Res, $Val extends CreateRecipeState>
/// @nodoc
abstract class _$$CreateRecipeStateImplCopyWith<$Res>
implements $CreateRecipeStateCopyWith<$Res> {
factory _$$CreateRecipeStateImplCopyWith(
_$CreateRecipeStateImpl value,
$Res Function(_$CreateRecipeStateImpl) then,
) = __$$CreateRecipeStateImplCopyWithImpl<$Res>;
factory _$$CreateRecipeStateImplCopyWith(_$CreateRecipeStateImpl value,
$Res Function(_$CreateRecipeStateImpl) then) =
__$$CreateRecipeStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
RecipeCreateEntity entity,
String? titleValidationError,
String? descriptionValidationError,
String? cookingTimeValidationError,
String? activeTimeValidationError,
String? servingsValidationError,
String? energyPerServingValidationError,
String? imageValidationError,
});
$Res call(
{RecipeCreateEntity entity,
String? titleValidationError,
String? descriptionValidationError,
String? cookingTimeValidationError,
String? activeTimeValidationError,
String? servingsValidationError,
String? energyPerServingValidationError,
String? imageValidationError});
@override
$RecipeCreateEntityCopyWith<$Res> get entity;
@@ -165,10 +150,9 @@ abstract class _$$CreateRecipeStateImplCopyWith<$Res>
class __$$CreateRecipeStateImplCopyWithImpl<$Res>
extends _$CreateRecipeStateCopyWithImpl<$Res, _$CreateRecipeStateImpl>
implements _$$CreateRecipeStateImplCopyWith<$Res> {
__$$CreateRecipeStateImplCopyWithImpl(
_$CreateRecipeStateImpl _value,
$Res Function(_$CreateRecipeStateImpl) _then,
) : super(_value, _then);
__$$CreateRecipeStateImplCopyWithImpl(_$CreateRecipeStateImpl _value,
$Res Function(_$CreateRecipeStateImpl) _then)
: super(_value, _then);
/// Create a copy of CreateRecipeState
/// with the given fields replaced by the non-null parameter values.
@@ -184,66 +168,56 @@ class __$$CreateRecipeStateImplCopyWithImpl<$Res>
Object? energyPerServingValidationError = freezed,
Object? imageValidationError = freezed,
}) {
return _then(
_$CreateRecipeStateImpl(
entity:
null == entity
? _value.entity
: entity // ignore: cast_nullable_to_non_nullable
as RecipeCreateEntity,
titleValidationError:
freezed == titleValidationError
? _value.titleValidationError
: titleValidationError // ignore: cast_nullable_to_non_nullable
as String?,
descriptionValidationError:
freezed == descriptionValidationError
? _value.descriptionValidationError
: descriptionValidationError // ignore: cast_nullable_to_non_nullable
as String?,
cookingTimeValidationError:
freezed == cookingTimeValidationError
? _value.cookingTimeValidationError
: cookingTimeValidationError // ignore: cast_nullable_to_non_nullable
as String?,
activeTimeValidationError:
freezed == activeTimeValidationError
? _value.activeTimeValidationError
: activeTimeValidationError // ignore: cast_nullable_to_non_nullable
as String?,
servingsValidationError:
freezed == servingsValidationError
? _value.servingsValidationError
: servingsValidationError // ignore: cast_nullable_to_non_nullable
as String?,
energyPerServingValidationError:
freezed == energyPerServingValidationError
? _value.energyPerServingValidationError
: energyPerServingValidationError // ignore: cast_nullable_to_non_nullable
as String?,
imageValidationError:
freezed == imageValidationError
? _value.imageValidationError
: imageValidationError // ignore: cast_nullable_to_non_nullable
as String?,
),
);
return _then(_$CreateRecipeStateImpl(
entity: null == entity
? _value.entity
: entity // ignore: cast_nullable_to_non_nullable
as RecipeCreateEntity,
titleValidationError: freezed == titleValidationError
? _value.titleValidationError
: titleValidationError // ignore: cast_nullable_to_non_nullable
as String?,
descriptionValidationError: freezed == descriptionValidationError
? _value.descriptionValidationError
: descriptionValidationError // ignore: cast_nullable_to_non_nullable
as String?,
cookingTimeValidationError: freezed == cookingTimeValidationError
? _value.cookingTimeValidationError
: cookingTimeValidationError // ignore: cast_nullable_to_non_nullable
as String?,
activeTimeValidationError: freezed == activeTimeValidationError
? _value.activeTimeValidationError
: activeTimeValidationError // ignore: cast_nullable_to_non_nullable
as String?,
servingsValidationError: freezed == servingsValidationError
? _value.servingsValidationError
: servingsValidationError // ignore: cast_nullable_to_non_nullable
as String?,
energyPerServingValidationError: freezed ==
energyPerServingValidationError
? _value.energyPerServingValidationError
: energyPerServingValidationError // ignore: cast_nullable_to_non_nullable
as String?,
imageValidationError: freezed == imageValidationError
? _value.imageValidationError
: imageValidationError // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// @nodoc
class _$CreateRecipeStateImpl implements _CreateRecipeState {
const _$CreateRecipeStateImpl({
required this.entity,
this.titleValidationError,
this.descriptionValidationError,
this.cookingTimeValidationError,
this.activeTimeValidationError,
this.servingsValidationError,
this.energyPerServingValidationError,
this.imageValidationError,
});
const _$CreateRecipeStateImpl(
{required this.entity,
this.titleValidationError,
this.descriptionValidationError,
this.cookingTimeValidationError,
this.activeTimeValidationError,
this.servingsValidationError,
this.energyPerServingValidationError,
this.imageValidationError});
@override
final RecipeCreateEntity entity;
@@ -275,32 +249,22 @@ class _$CreateRecipeStateImpl implements _CreateRecipeState {
(identical(other.entity, entity) || other.entity == entity) &&
(identical(other.titleValidationError, titleValidationError) ||
other.titleValidationError == titleValidationError) &&
(identical(
other.descriptionValidationError,
descriptionValidationError,
) ||
(identical(other.descriptionValidationError,
descriptionValidationError) ||
other.descriptionValidationError ==
descriptionValidationError) &&
(identical(
other.cookingTimeValidationError,
cookingTimeValidationError,
) ||
(identical(other.cookingTimeValidationError,
cookingTimeValidationError) ||
other.cookingTimeValidationError ==
cookingTimeValidationError) &&
(identical(
other.activeTimeValidationError,
activeTimeValidationError,
) ||
(identical(other.activeTimeValidationError,
activeTimeValidationError) ||
other.activeTimeValidationError == activeTimeValidationError) &&
(identical(
other.servingsValidationError,
servingsValidationError,
) ||
other.servingsValidationError, servingsValidationError) ||
other.servingsValidationError == servingsValidationError) &&
(identical(
other.energyPerServingValidationError,
energyPerServingValidationError,
) ||
(identical(other.energyPerServingValidationError,
energyPerServingValidationError) ||
other.energyPerServingValidationError ==
energyPerServingValidationError) &&
(identical(other.imageValidationError, imageValidationError) ||
@@ -309,16 +273,15 @@ class _$CreateRecipeStateImpl implements _CreateRecipeState {
@override
int get hashCode => Object.hash(
runtimeType,
entity,
titleValidationError,
descriptionValidationError,
cookingTimeValidationError,
activeTimeValidationError,
servingsValidationError,
energyPerServingValidationError,
imageValidationError,
);
runtimeType,
entity,
titleValidationError,
descriptionValidationError,
cookingTimeValidationError,
activeTimeValidationError,
servingsValidationError,
energyPerServingValidationError,
imageValidationError);
/// Create a copy of CreateRecipeState
/// with the given fields replaced by the non-null parameter values.
@@ -327,22 +290,19 @@ class _$CreateRecipeStateImpl implements _CreateRecipeState {
@pragma('vm:prefer-inline')
_$$CreateRecipeStateImplCopyWith<_$CreateRecipeStateImpl> get copyWith =>
__$$CreateRecipeStateImplCopyWithImpl<_$CreateRecipeStateImpl>(
this,
_$identity,
);
this, _$identity);
}
abstract class _CreateRecipeState implements CreateRecipeState {
const factory _CreateRecipeState({
required final RecipeCreateEntity entity,
final String? titleValidationError,
final String? descriptionValidationError,
final String? cookingTimeValidationError,
final String? activeTimeValidationError,
final String? servingsValidationError,
final String? energyPerServingValidationError,
final String? imageValidationError,
}) = _$CreateRecipeStateImpl;
const factory _CreateRecipeState(
{required final RecipeCreateEntity entity,
final String? titleValidationError,
final String? descriptionValidationError,
final String? cookingTimeValidationError,
final String? activeTimeValidationError,
final String? servingsValidationError,
final String? energyPerServingValidationError,
final String? imageValidationError}) = _$CreateRecipeStateImpl;
@override
RecipeCreateEntity get entity;

View File

@@ -30,11 +30,11 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
return BlocProvider<CreateRecipeCubit>(
create: (BuildContext context) => sl<CreateRecipeCubit>(),
child: Scaffold(
backgroundColor: Color(0xFFF0F2F5),
backgroundColor: const Color(0xFFF0F2F5),
appBar: AppBar(
title: Text('Добавление рецепта'),
title: const Text('Добавление рецепта'),
centerTitle: true,
shape: RoundedRectangleBorder(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(12),
),
@@ -42,13 +42,13 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
),
body: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
padding: EdgeInsets.only(top: 8, bottom: 32),
padding: const EdgeInsets.only(top: 8, bottom: 32),
child: Column(
spacing: 16,
children: [
InfoAboutRecipeWidget(),
IngredientsWidget(),
StepsWidget(),
const InfoAboutRecipeWidget(),
const IngredientsWidget(),
const StepsWidget(),
BlocBuilder<CreateRecipeCubit, CreateRecipeState>(
builder: (context, state) {
return Builder(
@@ -58,7 +58,8 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
if (context.read<CreateRecipeCubit>().validateAll()) {
final isSuccess = await context.read<CreateRecipeCubit>().publishRecipe();
if (isSuccess) {
Future.delayed(Duration(milliseconds: 500), () {
Future.delayed(const Duration(milliseconds: 500), () {
if (!context.mounted) return;
context.pop();
showBottomSheetWithBlur(
userRootNavigator: true,
@@ -69,6 +70,7 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
);
});
} else {
if (!context.mounted) return;
showErrorDialog(context, title: '${s.could_not_publish_recipe} ${state.entity.title}');
}
}
@@ -83,7 +85,7 @@ class _RecipeCreateScreenState extends State<RecipeCreateScreen> {
child: Container(
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: Text(
child: const Text(
'Опубликовать',
style: TextStyle(
fontSize: 16,

View File

@@ -50,12 +50,12 @@ class _ImageWidgetState extends State<ImageWidget> {
createRecipeCubit.replaceImage(null);
},
child: Container(
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
padding: const EdgeInsets.all(4),
decoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
child: Icon(Icons.close_rounded),
child: const Icon(Icons.close_rounded),
),
),
),
@@ -78,10 +78,11 @@ class _ImageWidgetState extends State<ImageWidget> {
createRecipeCubit.replaceImage(File(image.path));
createRecipeCubit.validateImage();
}
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: const Row(
children: const [
children: [
Icon(Icons.photo_camera),
SizedBox(width: 8),
Text('Фото'),
@@ -97,10 +98,11 @@ class _ImageWidgetState extends State<ImageWidget> {
createRecipeCubit.replaceImage(File(image.path));
createRecipeCubit.validateImage();
}
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: const Row(
children: const [
children: [
Icon(Icons.photo),
SizedBox(width: 8),
Text('Галерея'),

View File

@@ -41,8 +41,8 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Название'),
SizedBox(height: 4),
const Text('Название'),
const SizedBox(height: 4),
BlocBuilder<CreateRecipeCubit, CreateRecipeState>(
buildWhen: (previous, current) => previous.titleValidationError != current.titleValidationError,
builder: (context, state) {
@@ -59,7 +59,7 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
},
),
if (state.titleValidationError != null) ...[
SizedBox(height: 4),
const SizedBox(height: 4),
CustomErrorWidget(
error: state.titleValidationError!,
),
@@ -69,8 +69,8 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
},
),
const SizedBox(height: 12),
Text('Тип блюда'),
SizedBox(height: 4),
const Text('Тип блюда'),
const SizedBox(height: 4),
CustomDropDown(
items: items,
value: selectedType,
@@ -84,14 +84,14 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
},
),
const SizedBox(height: 12),
TagsWidget(),
const TagsWidget(),
const SizedBox(height: 12),
PortionWidget(),
const PortionWidget(),
const SizedBox(height: 12),
TimeOfCookWidget(),
const TimeOfCookWidget(),
const SizedBox(height: 12),
Text('Описание'),
SizedBox(height: 4),
const Text('Описание'),
const SizedBox(height: 4),
BlocBuilder<CreateRecipeCubit, CreateRecipeState>(
buildWhen: (previous, current) => previous.descriptionValidationError != current.descriptionValidationError,
builder: (context, state) {
@@ -110,7 +110,7 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
},
),
if (state.descriptionValidationError != null) ...[
SizedBox(height: 4),
const SizedBox(height: 4),
CustomErrorWidget(
error: state.descriptionValidationError!,
),
@@ -120,21 +120,21 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
},
),
const SizedBox(height: 12),
Text('Фото обложка'),
SizedBox(height: 4),
const Text('Фото обложка'),
const SizedBox(height: 4),
BlocBuilder<CreateRecipeCubit, CreateRecipeState>(
buildWhen: (previous, current) => previous.imageValidationError != current.imageValidationError || previous.entity.image != current.entity.image,
builder: (context, state) {
return Column(
children: [
Container(
child: ImageWidget(image: state.entity.image),
decoration: state.imageValidationError != null
? BoxDecoration(border: Border.all(width: 1, color: appTheme.red), borderRadius: BorderRadius.circular(8))
: null,
child: ImageWidget(image: state.entity.image),
),
if (state.imageValidationError != null) ...[
SizedBox(height: 4),
const SizedBox(height: 4),
CustomErrorWidget(
error: state.imageValidationError!,
),
@@ -144,8 +144,8 @@ class _InfoAboutRecipeWidgetState extends State<InfoAboutRecipeWidget> {
},
),
const SizedBox(height: 12),
Text('Ссылка на видео (если есть)'),
SizedBox(height: 4),
const Text('Ссылка на видео (если есть)'),
const SizedBox(height: 4),
CustomTextFormField(
hintText: 'Прикрепите ссылку на видео',
onChanged: (value) {

View File

@@ -37,8 +37,8 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
'Ингредиенты ',
style: TextStyle(
@@ -62,7 +62,7 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
children: <Widget>[
for (int index = 0; index < state.entity.ingredients.length; index += 1)
ListTile(
contentPadding: EdgeInsets.symmetric(horizontal: 16),
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
key: Key('$index'),
leading: Icon(
Icons.drag_handle_rounded,
@@ -90,7 +90,7 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
showModalBottomSheet(
useRootNavigator: true,
context: context,
shape: RoundedRectangleBorder(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
),
isScrollControlled: true,
@@ -106,7 +106,7 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
'Добавление ингредиента',
style: TextStyle(
fontSize: 20,
@@ -179,7 +179,7 @@ class _IngredientsWidgetState extends State<IngredientsWidget> {
borderRadius: BorderRadius.circular(20),
color: appTheme.blueA400,
),
child: Center(
child: const Center(
child: Text(
'Добавить',
style: TextStyle(

View File

@@ -38,8 +38,8 @@ class _PortionWidgetState extends State<PortionWidget> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Кол-во порций'),
SizedBox(height: 4),
const Text('Кол-во порций'),
const SizedBox(height: 4),
Column(
children: [
CustomTextFormField(
@@ -54,7 +54,7 @@ class _PortionWidgetState extends State<PortionWidget> {
},
),
if (state.servingsValidationError != null) ...[
SizedBox(height: 4),
const SizedBox(height: 4),
CustomErrorWidget(
error: state.servingsValidationError!,
),
@@ -70,15 +70,15 @@ class _PortionWidgetState extends State<PortionWidget> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Ккал в одной порции'),
SizedBox(height: 4),
const Text('Ккал в одной порции'),
const SizedBox(height: 4),
Column(
children: [
CustomTextFormField(
hintText: '100',
hasError: state.energyPerServingValidationError != null,
suffixText: 'Ккал',
textInputType: TextInputType.numberWithOptions(decimal: true),
textInputType: const TextInputType.numberWithOptions(decimal: true),
onChanged: (value) {
createRecipeCubit.replaceEnegryInPortion(double.parse(value));
if (state.energyPerServingValidationError != null) {
@@ -87,7 +87,7 @@ class _PortionWidgetState extends State<PortionWidget> {
},
),
if (state.energyPerServingValidationError != null) ...[
SizedBox(height: 4),
const SizedBox(height: 4),
CustomErrorWidget(
error: state.energyPerServingValidationError!,
),

View File

@@ -59,12 +59,12 @@ class _StepImageWidgetState extends State<StepImageWidget> {
createRecipeCubit.replaceImageInStep(null, widget.index);
},
child: Container(
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
padding: const EdgeInsets.all(4),
decoration: const BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
child: Icon(Icons.close_rounded),
child: const Icon(Icons.close_rounded),
),
),
),
@@ -86,10 +86,11 @@ class _StepImageWidgetState extends State<StepImageWidget> {
if (image != null) {
createRecipeCubit.replaceImageInStep(File(image!.path), widget.index);
}
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: const Row(
children: const [
children: [
Icon(Icons.photo_camera),
SizedBox(width: 8),
Text('Фото'),
@@ -104,10 +105,11 @@ class _StepImageWidgetState extends State<StepImageWidget> {
if (image != null) {
createRecipeCubit.replaceImageInStep(File(image!.path), widget.index);
}
if (!context.mounted) return;
Navigator.of(context).pop();
},
child: const Row(
children: const [
children: [
Icon(Icons.photo),
SizedBox(width: 8),
Text('Галерея'),

View File

@@ -35,7 +35,7 @@ class _StepsWidgetState extends State<StepsWidget> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
const Text(
'Пошаговая инструкция',
style: TextStyle(
fontSize: 20,
@@ -54,7 +54,7 @@ class _StepsWidgetState extends State<StepsWidget> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
padding: EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 4,
),
@@ -64,7 +64,7 @@ class _StepsWidgetState extends State<StepsWidget> {
),
child: Text(
'Шаг ${index + 1}',
style: TextStyle(
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
),
@@ -74,13 +74,13 @@ class _StepsWidgetState extends State<StepsWidget> {
onTap: () {
context.read<CreateRecipeCubit>().removeStep(state.entity.steps[index]);
},
child: Icon(Icons.delete_outline_rounded),
child: const Icon(Icons.delete_outline_rounded),
),
],
),
const SizedBox(height: 12),
Text('Описание'),
SizedBox(height: 4),
const Text('Описание'),
const SizedBox(height: 4),
CustomTextFormField(
hintText: 'Например: подготовьте ингредиенты',
maxLines: 5,
@@ -90,8 +90,8 @@ class _StepsWidgetState extends State<StepsWidget> {
},
),
const SizedBox(height: 12),
Text('Фото шага'),
SizedBox(height: 4),
const Text('Фото шага'),
const SizedBox(height: 4),
StepImageWidget(
index: index,
),
@@ -114,7 +114,7 @@ class _StepsWidgetState extends State<StepsWidget> {
child: Container(
padding: const EdgeInsets.all(16),
alignment: Alignment.center,
child: Text(
child: const Text(
'Добавить шаг',
style: TextStyle(
fontSize: 16,

View File

@@ -18,8 +18,8 @@ class _TagsWidgetState extends State<TagsWidget> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Теги'),
SizedBox(height: 4),
const Text('Теги'),
const SizedBox(height: 4),
CustomTextFormField(
hintText: 'Например: без майонеза',
controller: tagController,
@@ -52,7 +52,7 @@ class _TagsWidgetState extends State<TagsWidget> {
},
borderRadius: BorderRadius.circular(16),
child: Ink(
padding: EdgeInsets.symmetric(vertical: 4, horizontal: 12),
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: Colors.grey.shade200,

View File

@@ -34,13 +34,13 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
children: [
Row(
children: [
Text('Общее время приготовления'),
const Text('Общее время приготовления'),
const SizedBox(width: 8),
GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
builder: (context) => const AlertDialog(
content: Text(
'Общее время приготовления - это период времени от начала приготовления блюда до подачи его на стол.',
style: TextStyle(
@@ -60,7 +60,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
),
],
),
SizedBox(height: 4),
const SizedBox(height: 4),
Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -81,7 +81,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
},
),
if (state.cookingTimeValidationError != null) ...[
SizedBox(height: 4),
const SizedBox(height: 4),
CustomErrorWidget(
error: state.cookingTimeValidationError!,
),
@@ -107,7 +107,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
},
),
if (state.cookingTimeValidationError != null) ...[
SizedBox(height: 4),
const SizedBox(height: 4),
CustomErrorWidget(
error: state.cookingTimeValidationError!,
),
@@ -120,13 +120,13 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
const SizedBox(height: 12),
Row(
children: [
Text('Активное время приготовления'),
const Text('Активное время приготовления'),
const SizedBox(width: 8),
GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
builder: (context) => const AlertDialog(
content: Text(
'Активное время приготовления - это период времени, требующий активного участия в приготовлении блюда. Оно включает мытье и очистку продуктов, нарезку, шинковку, взбивание, перемешивание, размешивание, перекладывание и т.п.',
style: TextStyle(
@@ -146,7 +146,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
),
],
),
SizedBox(height: 4),
const SizedBox(height: 4),
Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -168,7 +168,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
},
),
if (state.activeTimeValidationError != null) ...[
SizedBox(height: 4),
const SizedBox(height: 4),
CustomErrorWidget(
error: state.activeTimeValidationError!,
),
@@ -195,7 +195,7 @@ class _TimeOfCookWidgetState extends State<TimeOfCookWidget> {
},
),
if (state.activeTimeValidationError != null) ...[
SizedBox(height: 4),
const SizedBox(height: 4),
CustomErrorWidget(
error: state.activeTimeValidationError!,
),

View File

@@ -61,7 +61,7 @@ class RecipeRepository {
'title': recipe.title,
'tags': recipe.tags,
'description_md': recipe.description,
'video_url': recipe.video_url,
'video_url': recipe.videoUrl,
'ingredients': ingredientsMap,
'steps': stepsMap,
'cooking_time': recipe.totalCookingTime,

View File

@@ -143,11 +143,11 @@ class _CreateRecipeService implements CreateRecipeService {
final _data = formData;
final _options = _setStreamType<void>(
Options(
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
method: 'POST',
headers: _headers,
extra: _extra,
contentType: 'multipart/form-data',
)
.compose(
_dio.options,
'/api/recipes/create',