From 8420188d9c91f76b81d5b6c4bdb95663bdcf5480 Mon Sep 17 00:00:00 2001 From: broodjeaap89 Date: Sun, 11 Jul 2021 11:56:09 +0200 Subject: [PATCH] added 'wait options' to addPizzaEventPage --- lib/entities/PizzaRecipe/RecipeStep.dart | 5 ++++- lib/pages/AddPizzaEventPage.dart | 26 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/entities/PizzaRecipe/RecipeStep.dart b/lib/entities/PizzaRecipe/RecipeStep.dart index a631f8f..4c4b8b3 100644 --- a/lib/entities/PizzaRecipe/RecipeStep.dart +++ b/lib/entities/PizzaRecipe/RecipeStep.dart @@ -6,8 +6,11 @@ class RecipeStep { final String waitUnit; final int waitMin; final int waitMax; + late int waitValue; final String description; final List subSteps; - RecipeStep(this.name, this.waitDescription, this.description, this.waitUnit, this.waitMin, this.waitMax, this.subSteps); + RecipeStep(this.name, this.description, this.waitDescription, this.waitUnit, this.waitMin, this.waitMax, this.subSteps) { + waitValue = waitMin; + } } \ No newline at end of file diff --git a/lib/pages/AddPizzaEventPage.dart b/lib/pages/AddPizzaEventPage.dart index 74e15c0..b66c3ad 100644 --- a/lib/pages/AddPizzaEventPage.dart +++ b/lib/pages/AddPizzaEventPage.dart @@ -156,6 +156,32 @@ class AddPizzaEventPageState extends State { ] ), Divider(), + 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(),