fixed bug where waiting on the confirm screen could place the first step into the past

This commit is contained in:
broodjeaap89 2021-08-31 19:36:23 +02:00
parent 196f2f1d97
commit d6fb1403de

View file

@ -170,6 +170,15 @@ class AddPizzaEventPageState extends State<AddPizzaEventPage> {
return;
}
// if the user waited to long on the confirmation dialog that the first step time is now in the past
var durationUntilFirstStep = Duration(seconds: this.widget.pizzaRecipe.getCurrentDuration().inSeconds);
var firstStepDateTime = eventTime.subtract(durationUntilFirstStep);
if (firstStepDateTime.isBefore(DateTime.now())){
eventTime = DateTime.now()
.add(durationUntilFirstStep)
.add(const Duration(minutes: 1));
}
var pizzaEventsBox = Hive.box<PizzaEvent>("PizzaEvents");
PizzaEvent pizzaEvent = PizzaEvent(
this.name,