From cc417776c7855700a76a661d4f8671b671c275da Mon Sep 17 00:00:00 2001 From: Rahmadhany Triastanto Date: Wed, 10 Jan 2024 06:15:09 +0700 Subject: [PATCH] adding ingredients --- lib/recipe.dart | 115 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 2 deletions(-) diff --git a/lib/recipe.dart b/lib/recipe.dart index 923880c..2cd7bd5 100644 --- a/lib/recipe.dart +++ b/lib/recipe.dart @@ -1,39 +1,150 @@ class Recipe { String label; String imageUrl; - // TODO: Add servings and ingredients + int servings; + List ingredients; Recipe( this.label, this.imageUrl, + this.servings, + this.ingredients, ); static List samples = [ Recipe( 'Spaghetti and Meatballs', 'assets/2126711929_ef763de2b3_w.jpg', + 4, + [ + Ingredient( + 1, + 'box', + 'Spaghetti', + ), + Ingredient( + 4, + '', + 'Frozen Meatballs', + ), + Ingredient( + 0.5, + 'jar', + 'sauce', + ), + ], ), Recipe( 'Tomato Soup', 'assets/27729023535_a57606c1be.jpg', + 2, + [ + Ingredient( + 1, + 'can', + 'Tomato Soup', + ), + ], ), Recipe( 'Grilled Cheese', 'assets/3187380632_5056654a19_b.jpg', + 1, + [ + Ingredient( + 2, + 'slices', + 'Cheese', + ), + Ingredient( + 2, + 'slices', + 'Bread', + ), + ], ), Recipe( 'Chocolate Chip Cookies', 'assets/15992102771_b92f4cc00a_b.jpg', + 24, + [ + Ingredient( + 4, + 'cups', + 'flour', + ), + Ingredient( + 2, + 'cups', + 'sugar', + ), + Ingredient( + 0.5, + 'cups', + 'chocolate chips', + ), + ], ), Recipe( 'Taco Salad', 'assets/8533381643_a31a99e8a6_c.jpg', + 1, + [ + Ingredient( + 4, + 'oz', + 'nachos', + ), + Ingredient( + 3, + 'oz', + 'taco meat', + ), + Ingredient( + 0.5, + 'cup', + 'cheese', + ), + Ingredient( + 0.25, + 'cup', + 'chopped tomatoes', + ), + ], ), Recipe( 'Hawaiian Pizza', 'assets/15452035777_294cefced5_c.jpg', + 4, + [ + Ingredient( + 1, + 'item', + 'pizza', + ), + Ingredient( + 1, + 'cup', + 'pineapple', + ), + Ingredient( + 8, + 'oz', + 'ham', + ), + ], ), ]; } -// TODO: Add ingredient() here +class Ingredient { + double quantity; + String measure; + String name; + + Ingredient( + this.quantity, + this.measure, + this.name, + ); +}