forked from eatvio/eatvio_app
feat(blogPost): add recipes
This commit is contained in:
47
lib/features/feed/models/recipes_model.dart
Normal file
47
lib/features/feed/models/recipes_model.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'recipes_model.freezed.dart';
|
||||
part 'recipes_model.g.dart';
|
||||
|
||||
@freezed
|
||||
class Recipes with _$Recipes {
|
||||
const factory Recipes({
|
||||
required int id,
|
||||
required String image,
|
||||
required String state,
|
||||
@JsonKey(name: "cooking_time") required int cookingTime,
|
||||
required List<Ingredient> ingredients,
|
||||
required String description,
|
||||
required List<Step> steps,
|
||||
@JsonKey(name: "video_url") required String videoUrl,
|
||||
@JsonKey(name: "created_at") required DateTime createdAt,
|
||||
@JsonKey(name: "updated_at") required DateTime updatedAt,
|
||||
required String title,
|
||||
required String type,
|
||||
required String slug,
|
||||
@JsonKey(name: "comments_count") required int commentsCount,
|
||||
}) = _Recipes;
|
||||
|
||||
factory Recipes.fromJson(Map<String, Object?> json) => _$RecipesFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Ingredient with _$Ingredient {
|
||||
const factory Ingredient({
|
||||
required String name,
|
||||
String? unit,
|
||||
required String portion,
|
||||
}) = _Ingredient;
|
||||
|
||||
factory Ingredient.fromJson(Map<String, Object?> json) => _$IngredientFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
class Step with _$Step {
|
||||
const factory Step({
|
||||
required String image,
|
||||
required String description,
|
||||
}) = _Step;
|
||||
|
||||
factory Step.fromJson(Map<String, Object?> json) => _$StepFromJson(json);
|
||||
}
|
||||
Reference in New Issue
Block a user