added decimal places when ingredient is less then 5% of total weight
This commit is contained in:
parent
3b10525171
commit
b9a78665fa
3 changed files with 13 additions and 6 deletions
|
@ -25,13 +25,21 @@ class Ingredient extends HiveObject {
|
|||
return TableRow(
|
||||
children: <Widget>[
|
||||
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"))),
|
||||
TableCell(child: Center(child: Text("${this.getAbsoluteString(doughBallSize)}$unit"))),
|
||||
TableCell(child: Center(child: Text("${this.getAbsoluteString(pizzaCount * doughBallSize)}$unit"))),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
int getAbsolute(int weight) {
|
||||
return (this.value * weight).toInt();
|
||||
double getAbsolute(int weight) {
|
||||
return (this.value * weight);
|
||||
}
|
||||
|
||||
String getAbsoluteString(int weight){
|
||||
double ingredientWeight = this.getAbsolute(weight);
|
||||
if (this.value < 0.05){
|
||||
return ingredientWeight.toStringAsFixed(2);
|
||||
}
|
||||
return ingredientWeight.toStringAsFixed(0);
|
||||
}
|
||||
}
|
|
@ -108,7 +108,7 @@ class PizzaEventPageState extends State<PizzaEventPage> {
|
|||
return TableRow(
|
||||
children: <TableCell>[
|
||||
TableCell(child: Text(ingredient.name)),
|
||||
TableCell(child: Text("${ingredient.getAbsolute(totalWeight)}")),
|
||||
TableCell(child: Text("${ingredient.getAbsoluteString(totalWeight)}")),
|
||||
TableCell(child: Center(child: Checkbox(
|
||||
value: ingredient.bought,
|
||||
onChanged: (bool? newValue) {
|
||||
|
|
1
todo.md
1
todo.md
|
@ -5,6 +5,5 @@
|
|||
- make the recipeStep+substep page from a notification
|
||||
- PageView with 'complete' button that completes steps
|
||||
|
||||
- add decimals to ingredients table when below a certain % or <5g whatever
|
||||
|
||||
- theres a bug when waiting on the confirmation screen for a new pizza event too long, where the scheduled date is in the past
|
Loading…
Add table
Reference in a new issue