cleaned up some code things for the ingredients table
This commit is contained in:
parent
4ad9db0fdf
commit
77dd896fcd
3 changed files with 21 additions and 23 deletions
|
@ -9,7 +9,7 @@ class Ingredient {
|
||||||
|
|
||||||
Ingredient(this.name, this.unit, this.value);
|
Ingredient(this.name, this.unit, this.value);
|
||||||
|
|
||||||
TableRow getIngredientWidget(int pizzaCount, int doughBallSize){
|
TableRow getIngredientTableRow(int pizzaCount, int doughBallSize){
|
||||||
return TableRow(
|
return TableRow(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
TableCell(child: Center(child: Text("${this.name.capitalize()}"))),
|
TableCell(child: Center(child: Text("${this.name.capitalize()}"))),
|
||||||
|
|
|
@ -7,28 +7,26 @@ class Ingredients {
|
||||||
|
|
||||||
Ingredients(this.ingredients, this.method);
|
Ingredients(this.ingredients, this.method);
|
||||||
|
|
||||||
Widget getIngredientsWidget(int pizzaCount, int doughBallSize) {
|
Table getIngredientsTable(int pizzaCount, int doughBallSize) {
|
||||||
return Container(
|
return Table(
|
||||||
child: Table(
|
border: TableBorder.all(),
|
||||||
border: TableBorder.all(),
|
columnWidths: const <int, TableColumnWidth>{
|
||||||
columnWidths: const <int, TableColumnWidth>{
|
0: FlexColumnWidth(2),
|
||||||
0: FlexColumnWidth(2),
|
1: FlexColumnWidth(2),
|
||||||
1: FlexColumnWidth(2),
|
2: FlexColumnWidth(2),
|
||||||
2: FlexColumnWidth(2),
|
},
|
||||||
},
|
children:
|
||||||
children:
|
<TableRow>[
|
||||||
<TableRow>[
|
TableRow(
|
||||||
TableRow(
|
children: <TableCell>[
|
||||||
children: <TableCell>[
|
TableCell(child: Center(child: Text("Ingredient"))),
|
||||||
TableCell(child: Center(child: Text("Ingredient"))),
|
TableCell(child: Center(child: Text("Single Ball"))),
|
||||||
TableCell(child: Center(child: Text("Single Ball"))),
|
TableCell(child: Center(child: Text("Total"))),
|
||||||
TableCell(child: Center(child: Text("Total"))),
|
]
|
||||||
]
|
)
|
||||||
)
|
|
||||||
|
|
||||||
] +
|
] +
|
||||||
ingredients.values.map((ingredient) => ingredient.getIngredientWidget(pizzaCount, doughBallSize)).toList()
|
ingredients.values.map((ingredient) => ingredient.getIngredientTableRow(pizzaCount, doughBallSize)).toList()
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,7 +17,7 @@ class PizzaRecipe {
|
||||||
PizzaRecipe(this.name, this.description, this.ingredients, this.recipeSteps);
|
PizzaRecipe(this.name, this.description, this.ingredients, this.recipeSteps);
|
||||||
|
|
||||||
Widget getIngredientsWidget(int pizzaCount, int doughBallSize){
|
Widget getIngredientsWidget(int pizzaCount, int doughBallSize){
|
||||||
return ingredients.getIngredientsWidget(pizzaCount, doughBallSize);
|
return ingredients.getIngredientsTable(pizzaCount, doughBallSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<PizzaRecipe> fromYaml(yamlPath) async{
|
static Future<PizzaRecipe> fromYaml(yamlPath) async{
|
||||||
|
|
Loading…
Add table
Reference in a new issue