diff --git a/lib/entities/PizzaRecipe/Ingredient.dart b/lib/entities/PizzaRecipe/Ingredient.dart index fddfd30..d8af070 100644 --- a/lib/entities/PizzaRecipe/Ingredient.dart +++ b/lib/entities/PizzaRecipe/Ingredient.dart @@ -9,11 +9,12 @@ class Ingredient { Ingredient(this.name, this.unit, this.value); - Widget getIngredientWidget(int weight){ - return Row( + TableRow getIngredientWidget(int pizzaCount, int doughBallSize){ + return TableRow( children: [ - Text("${this.name.capitalize()}: "), - Text("${this.getAbsolute(weight)}$unit") + TableCell(child: Center(child: Text("${this.name.capitalize()}"))), + TableCell(child: Center(child: Text("${this.getAbsolute(doughBallSize)}$unit"))), + TableCell(child: Center(child: Text("${this.getAbsolute(pizzaCount * doughBallSize)}$unit"))), ], ); } diff --git a/lib/entities/PizzaRecipe/Ingredients.dart b/lib/entities/PizzaRecipe/Ingredients.dart index 2cab95a..e8d6920 100644 --- a/lib/entities/PizzaRecipe/Ingredients.dart +++ b/lib/entities/PizzaRecipe/Ingredients.dart @@ -7,10 +7,27 @@ class Ingredients { Ingredients(this.ingredients, this.method); - Widget getIngredientsWidget(int weight) { + Widget getIngredientsWidget(int pizzaCount, int doughBallSize) { return Container( - child: Column( - children: ingredients.values.map((ingredient) => ingredient.getIngredientWidget(weight)).toList() + child: Table( + border: TableBorder.all(), + columnWidths: const { + 0: FlexColumnWidth(2), + 1: FlexColumnWidth(2), + 2: FlexColumnWidth(2), + }, + children: + [ + TableRow( + children: [ + TableCell(child: Center(child: Text("Ingredient"))), + TableCell(child: Center(child: Text("Single Ball"))), + TableCell(child: Center(child: Text("Total"))), + ] + ) + + ] + + ingredients.values.map((ingredient) => ingredient.getIngredientWidget(pizzaCount, doughBallSize)).toList() ) ); } diff --git a/lib/entities/PizzaRecipe/PizzaRecipe.dart b/lib/entities/PizzaRecipe/PizzaRecipe.dart index 8f49054..9b2bb8d 100644 --- a/lib/entities/PizzaRecipe/PizzaRecipe.dart +++ b/lib/entities/PizzaRecipe/PizzaRecipe.dart @@ -16,8 +16,8 @@ class PizzaRecipe { PizzaRecipe(this.name, this.description, this.ingredients, this.recipeSteps); - Widget getIngredientsWidget(int weight){ - return ingredients.getIngredientsWidget(weight); + Widget getIngredientsWidget(int pizzaCount, int doughBallSize){ + return ingredients.getIngredientsWidget(pizzaCount, doughBallSize); } static Future fromYaml(yamlPath) async{ diff --git a/lib/pages/AddPizzaEventPage.dart b/lib/pages/AddPizzaEventPage.dart index a006b6f..6f25e01 100644 --- a/lib/pages/AddPizzaEventPage.dart +++ b/lib/pages/AddPizzaEventPage.dart @@ -156,7 +156,7 @@ class AddPizzaEventPageState extends State { ] ), Divider(), - this.initialized ? this.pizzaRecipe.getIngredientsWidget(this.doughBallSize * this.pizzaCount) : Container(), + this.initialized ? this.pizzaRecipe.getIngredientsWidget(this.pizzaCount, this.doughBallSize) : Container(), Spacer(), SizedBox( width: double.infinity,