feat(recipe): API for recipe create and edit

This commit is contained in:
2024-08-16 14:04:25 +03:00
parent 1c63127eb5
commit 92d5437e06
3 changed files with 6 additions and 13 deletions

View File

@@ -6,16 +6,9 @@ part of 'recipe_model.dart';
// JsonSerializableGenerator
// **************************************************************************
_$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(),
_$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(),
type: json['type'] as String?,
state: json['state'] as String?,
title: json['title'] as String?,
@@ -25,8 +18,7 @@ _$RecipeModelImpl _$$RecipeModelImplFromJson(Map<String, dynamic> json) =>
cooking_time: (json['cooking_time'] as num?)?.toInt(),
);
Map<String, dynamic> _$$RecipeModelImplToJson(_$RecipeModelImpl instance) =>
<String, dynamic>{
Map<String, dynamic> _$$RecipeModelImplToJson(_$RecipeModelImpl instance) => <String, dynamic>{
'ingredients': instance.ingredients,
'steps': instance.steps,
'type': instance.type,

View File

@@ -472,6 +472,8 @@ class RecipeCreateScreen extends StatelessWidget {
image: state.recipeImage?.path,
video_url: state.youtubeLinkController.text.isNotEmpty ? state.youtubeLinkController.text : null,
);
print(recipe.toJson());
print(recipe.toString());
print(recipe);
return recipe;
}

View File

@@ -487,7 +487,6 @@ class RecipeEditScreen extends StatelessWidget {
image: state.recipeImage?.path,
video_url: state.youtubeLinkController.text.isNotEmpty ? state.youtubeLinkController.text : null,
);
print(recipe.toJson());
return recipe;
}
}