From 92d5437e060139aaed40c29eda1bb80119052236 Mon Sep 17 00:00:00 2001 From: maxxkim Date: Fri, 16 Aug 2024 14:04:25 +0300 Subject: [PATCH] feat(recipe): API for recipe create and edit --- lib/features/recipes/models/recipe_model.g.dart | 16 ++++------------ .../presentation/pages/recipe_create_screen.dart | 2 ++ .../presentation/pages/recipe_edit_screen.dart | 1 - 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/features/recipes/models/recipe_model.g.dart b/lib/features/recipes/models/recipe_model.g.dart index d5ab9c96..ac7c7c2d 100644 --- a/lib/features/recipes/models/recipe_model.g.dart +++ b/lib/features/recipes/models/recipe_model.g.dart @@ -6,16 +6,9 @@ part of 'recipe_model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$RecipeModelImpl _$$RecipeModelImplFromJson(Map json) => - _$RecipeModelImpl( - ingredients: (json['ingredients'] as List?) - ?.map((e) => - e == null ? null : Ingredient.fromJson(e as Map)) - .toList(), - steps: (json['steps'] as List?) - ?.map((e) => - e == null ? null : Step.fromJson(e as Map)) - .toList(), +_$RecipeModelImpl _$$RecipeModelImplFromJson(Map json) => _$RecipeModelImpl( + ingredients: (json['ingredients'] as List?)?.map((e) => e == null ? null : Ingredient.fromJson(e as Map)).toList(), + steps: (json['steps'] as List?)?.map((e) => e == null ? null : Step.fromJson(e as Map)).toList(), type: json['type'] as String?, state: json['state'] as String?, title: json['title'] as String?, @@ -25,8 +18,7 @@ _$RecipeModelImpl _$$RecipeModelImplFromJson(Map json) => cooking_time: (json['cooking_time'] as num?)?.toInt(), ); -Map _$$RecipeModelImplToJson(_$RecipeModelImpl instance) => - { +Map _$$RecipeModelImplToJson(_$RecipeModelImpl instance) => { 'ingredients': instance.ingredients, 'steps': instance.steps, 'type': instance.type, diff --git a/lib/features/recipes/presentation/pages/recipe_create_screen.dart b/lib/features/recipes/presentation/pages/recipe_create_screen.dart index 24e9f277..13c52ae6 100644 --- a/lib/features/recipes/presentation/pages/recipe_create_screen.dart +++ b/lib/features/recipes/presentation/pages/recipe_create_screen.dart @@ -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; } diff --git a/lib/features/recipes/presentation/pages/recipe_edit_screen.dart b/lib/features/recipes/presentation/pages/recipe_edit_screen.dart index 5e5cfeec..aa93f72f 100644 --- a/lib/features/recipes/presentation/pages/recipe_edit_screen.dart +++ b/lib/features/recipes/presentation/pages/recipe_edit_screen.dart @@ -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; } }