From a5df4a0d8a6b23030e96963b633d9cb717be4c4e Mon Sep 17 00:00:00 2001 From: broodjeaap89 Date: Sun, 11 Jul 2021 14:26:10 +0200 Subject: [PATCH] The 'wait options' are now in a listview, so it doesn't overflow when there's a lot of steps in a recipe --- assets/recipes/many_step_pizza.yaml | 131 ++++++++++++++ lib/pages/AddPizzaEventPage.dart | 262 +++++++++++++++------------- 2 files changed, 269 insertions(+), 124 deletions(-) create mode 100644 assets/recipes/many_step_pizza.yaml diff --git a/assets/recipes/many_step_pizza.yaml b/assets/recipes/many_step_pizza.yaml new file mode 100644 index 0000000..d97d44f --- /dev/null +++ b/assets/recipes/many_step_pizza.yaml @@ -0,0 +1,131 @@ +recipe: + name: "Many Step Pizza" + description: > + A Neapolitan Style pizza with a multi day cold rise + ingredients: + method: ratio + items: + - name: flour + unit: g + value: 0.595 + - name: water + unit: ml + value: 0.386 + - name: salt + unit: g + value: 0.0178 + - name: yeast + unit: g + value: 0.0012 + steps: + - name: Make the dough + wait: + description: How many days cold rise? + unit: days + min: 1 + max: 5 + description: > + Combine all the ingredients to make the dough, we start with just the water and salt and add the yeast after adding some of the flour to not kill the yeast. + substeps: + - name: Salt+Water + description: > + Combine the salt and the water in a bowl, stir until the salt dissolves. + - name: +20% flour + description: > + Add ~20% of the flour to the water/salt mixture and mix everything together. + - name: Yeast + description: > + Add the yeast to the mixture. + - name: Flour + description: > + Add the rest of the flour to the mixture, knead the dough for 15-20 minutes. + - name: Fridge + description: > + Place the dough in a sealed/covered container in the fridge. + - name: Make the dough2 + wait: + description: How many days cold rise again? + unit: days + min: 1 + max: 5 + description: > + Combine all the ingredients to make the dough, we start with just the water and salt and add the yeast after adding some of the flour to not kill the yeast. + substeps: + - name: Salt+Water + description: > + Combine the salt and the water in a bowl, stir until the salt dissolves. + - name: +20% flour + description: > + Add ~20% of the flour to the water/salt mixture and mix everything together. + - name: Yeast + description: > + Add the yeast to the mixture. + - name: Flour + description: > + Add the rest of the flour to the mixture, knead the dough for 15-20 minutes. + - name: Fridge + description: > + Place the dough in a sealed/covered container in the fridge. + - name: Warm rise + wait: + description: How many hours of room temperature rise? + unit: hours + min: 3 + max: 6 + description: > + Take the dough out of the fridge and let it come to room temperature for a final rise before baking + substeps: + - name: Split + description: > + Split the dough into smaller balls and place them into a covered/sealed container(s) + - name: Warm rise2 + wait: + description: How many hours of room temperature rise again? + unit: hours + min: 3 + max: 6 + description: > + Take the dough out of the fridge and let it come to room temperature for a final rise before baking + substeps: + - name: Split + description: > + Split the dough into smaller balls and place them into a covered/sealed container(s) + - name: Preheat Oven + wait: + description: How long does your oven take to preheat? + unit: minutes + min: 30 + max: 120 + description: > + Preheat the oven in advance to ensure it's as hot as it can be + A high (250 to 300 degrees celsius) is recommended) + - name: Preheat Oven + wait: + description: How long does your oven take to preheat? + unit: minutes + min: 30 + max: 120 + description: > + Preheat the oven in advance to ensure it's as hot as it can be + A high (250 to 300 degrees celsius) is recommended) + - name: Preheat Oven + wait: + description: How long does your oven take to preheat? + unit: minutes + min: 30 + max: 120 + description: > + Preheat the oven in advance to ensure it's as hot as it can be + A high (250 to 300 degrees celsius) is recommended) + - name: Preheat Oven + wait: + description: How long does your oven take to preheat? + unit: minutes + min: 30 + max: 120 + description: > + Preheat the oven in advance to ensure it's as hot as it can be + A high (250 to 300 degrees celsius) is recommended) + - name: Pizza Time! + description: > + Time to make pizza! \ No newline at end of file diff --git a/lib/pages/AddPizzaEventPage.dart b/lib/pages/AddPizzaEventPage.dart index b66c3ad..6745339 100644 --- a/lib/pages/AddPizzaEventPage.dart +++ b/lib/pages/AddPizzaEventPage.dart @@ -50,139 +50,153 @@ class AddPizzaEventPageState extends State { padding: EdgeInsets.fromLTRB(40, 10, 40, 10), child: Column( children: [ - Row( + Expanded( + flex: 30, + child: Column( children: [ - Icon(Icons.title), - Container(width: 25), - Expanded( - child: TextField( - decoration: InputDecoration( - hintText: "Event Name", - errorText: this.nameValidation ? "Name can\'t be empty" : null - ), - onChanged: (String newName) { - setState(() { - name = newName; - }); - }, - ), - ) - ] - ), - Row( - children: [ - Icon(FontAwesome5.pizza_slice), - Container(width: 25), - Expanded( - child: this.initialized ? // Only render the dropdown if the recipes have been loaded from storage - DropdownButton( - value: this.pizzaRecipe.name, - onChanged: (String? newType) { - setState(() => this.pizzaRecipe = this.pizzaTypes.firstWhere((pizzaRecipe) => pizzaRecipe.name == newType)); - }, - items: this.pizzaTypes.map((pizzaRecipe) { - return DropdownMenuItem( - value: pizzaRecipe.name, - child: Text(pizzaRecipe.name) - ); - }).toList() - ) : CircularProgressIndicator() - ) - ] - ), - Row( - children: [ - Icon(FontAwesome5.hashtag), - Expanded( - child: Slider( - value: pizzaCount.toDouble(), - min: 1, - max: 20, - divisions: 19, - label: this.pizzaCount.toString(), - onChanged: (double newPizzaCount) { - setState(() {this.pizzaCount = newPizzaCount.round();}); - }, - ) - ), - Container( - width: 25, - child: Text(this.pizzaCount.toString()) - ) - ] - ), - Row( - children: [ - Icon(FontAwesome5.weight_hanging), - Expanded( - child: Slider( - value: doughBallSize.toDouble(), - min: 100, - max: 400, - divisions: 30, - label: this.doughBallSize.toString(), - onChanged: (double newDoughBallSize) { - setState(() {this.doughBallSize = newDoughBallSize.round();}); - }, - ) - ), - Container( - width: 25, - child: Text(this.doughBallSize.toString()) - ) - ] - ), - Row( - children: [ - Icon(FontAwesome5.calendar_alt), - Expanded( - child: InkWell( - child: Center( - child: Text(dateFormatter.format(this.eventTime)), - ), - onTap: () { - DatePicker.showDateTimePicker(context, - showTitleActions: true, - minTime: DateTime.now(), - currentTime: this.eventTime.difference(DateTime.now()).isNegative ? DateTime.now() : this.eventTime, - maxTime: DateTime.now().add(Duration(days: 365*10)), - onConfirm: (newEventTime) { - setState((){ this.eventTime = newEventTime; }); - } - ); - } - ) - ) - ] - ), - Divider(), - this.initialized ? Column( - children: this.pizzaRecipe.recipeSteps.where((recipeStep) => recipeStep.waitDescription.length > 0).map((recipeStep) { - return [ - Text(recipeStep.waitDescription), - Row( + Row( children: [ + Icon(Icons.title), + Container(width: 25), Expanded( - child: Slider( - value: recipeStep.waitValue.toDouble(), - min: recipeStep.waitMin.toDouble(), - max: recipeStep.waitMax.toDouble(), - divisions: recipeStep.waitMax - recipeStep.waitMin, - label: recipeStep.waitValue.toString(), - onChanged: (newValue) => setState(() => recipeStep.waitValue = newValue.toInt()), - ) + child: TextField( + decoration: InputDecoration( + hintText: "Event Name", + errorText: this.nameValidation ? "Name can\'t be empty" : null + ), + onChanged: (String newName) { + setState(() { + name = newName; + }); + }, + ), + ) + ] + ), + Row( + children: [ + Icon(FontAwesome5.pizza_slice), + Container(width: 25), + Expanded( + child: this.initialized ? // Only render the dropdown if the recipes have been loaded from storage + DropdownButton( + value: this.pizzaRecipe.name, + onChanged: (String? newType) { + setState(() => this.pizzaRecipe = this.pizzaTypes.firstWhere((pizzaRecipe) => pizzaRecipe.name == newType)); + }, + items: this.pizzaTypes.map((pizzaRecipe) { + return DropdownMenuItem( + value: pizzaRecipe.name, + child: Text(pizzaRecipe.name) + ); + }).toList() + ) : CircularProgressIndicator() + ) + ] + ), + Row( + children: [ + Icon(FontAwesome5.hashtag), + Expanded( + child: Slider( + value: pizzaCount.toDouble(), + min: 1, + max: 20, + divisions: 19, + label: this.pizzaCount.toString(), + onChanged: (double newPizzaCount) { + setState(() {this.pizzaCount = newPizzaCount.round();}); + }, + ) ), Container( width: 25, - child: Text(recipeStep.waitValue.toString()) + child: Text(this.pizzaCount.toString()) ) ] - ) - ]; - }).expand((option) => option).toList() - ) : Container(), + ), + Row( + children: [ + Icon(FontAwesome5.weight_hanging), + Expanded( + child: Slider( + value: doughBallSize.toDouble(), + min: 100, + max: 400, + divisions: 30, + label: this.doughBallSize.toString(), + onChanged: (double newDoughBallSize) { + setState(() {this.doughBallSize = newDoughBallSize.round();}); + }, + ) + ), + Container( + width: 25, + child: Text(this.doughBallSize.toString()) + ) + ] + ), + Row( + children: [ + Icon(FontAwesome5.calendar_alt), + Expanded( + child: InkWell( + child: Center( + child: Text(dateFormatter.format(this.eventTime)), + ), + onTap: () { + DatePicker.showDateTimePicker(context, + showTitleActions: true, + minTime: DateTime.now(), + currentTime: this.eventTime.difference(DateTime.now()).isNegative ? DateTime.now() : this.eventTime, + maxTime: DateTime.now().add(Duration(days: 365*10)), + onConfirm: (newEventTime) { + setState((){ this.eventTime = newEventTime; }); + } + ); + } + ) + ) + ] + ), + ] + ) + ), Divider(), - this.initialized ? this.pizzaRecipe.getIngredientsTable(this.pizzaCount, this.doughBallSize) : Container(), + Expanded( + flex: 45, + child: ListView( + children: [ + this.initialized ? Column( + children: this.pizzaRecipe.recipeSteps.where((recipeStep) => recipeStep.waitDescription.length > 0).map((recipeStep) { + return [ + Text(recipeStep.waitDescription), + Row( + children: [ + Expanded( + child: Slider( + value: recipeStep.waitValue.toDouble(), + min: recipeStep.waitMin.toDouble(), + max: recipeStep.waitMax.toDouble(), + divisions: recipeStep.waitMax - recipeStep.waitMin, + label: recipeStep.waitValue.toString(), + onChanged: (newValue) => setState(() => recipeStep.waitValue = newValue.toInt()), + ) + ), + Container( + width: 25, + child: Text(recipeStep.waitValue.toString()) + ) + ] + ) + ]; + }).expand((option) => option).toList() + ) : Container(), + Divider(), + this.initialized ? this.pizzaRecipe.getIngredientsTable(this.pizzaCount, this.doughBallSize) : Container(), + ] + ) + ), Divider(), Spacer(), SizedBox(