cleaned up some code things for the ingredients table

This commit is contained in:
broodjeaap89 2021-07-11 11:17:39 +02:00
parent 4ad9db0fdf
commit 77dd896fcd
3 changed files with 21 additions and 23 deletions

View file

@ -9,7 +9,7 @@ class Ingredient {
Ingredient(this.name, this.unit, this.value);
TableRow getIngredientWidget(int pizzaCount, int doughBallSize){
TableRow getIngredientTableRow(int pizzaCount, int doughBallSize){
return TableRow(
children: <Widget>[
TableCell(child: Center(child: Text("${this.name.capitalize()}"))),

View file

@ -7,9 +7,8 @@ class Ingredients {
Ingredients(this.ingredients, this.method);
Widget getIngredientsWidget(int pizzaCount, int doughBallSize) {
return Container(
child: Table(
Table getIngredientsTable(int pizzaCount, int doughBallSize) {
return Table(
border: TableBorder.all(),
columnWidths: const <int, TableColumnWidth>{
0: FlexColumnWidth(2),
@ -27,8 +26,7 @@ class Ingredients {
)
] +
ingredients.values.map((ingredient) => ingredient.getIngredientWidget(pizzaCount, doughBallSize)).toList()
)
ingredients.values.map((ingredient) => ingredient.getIngredientTableRow(pizzaCount, doughBallSize)).toList()
);
}
}

View file

@ -17,7 +17,7 @@ class PizzaRecipe {
PizzaRecipe(this.name, this.description, this.ingredients, this.recipeSteps);
Widget getIngredientsWidget(int pizzaCount, int doughBallSize){
return ingredients.getIngredientsWidget(pizzaCount, doughBallSize);
return ingredients.getIngredientsTable(pizzaCount, doughBallSize);
}
static Future<PizzaRecipe> fromYaml(yamlPath) async{