diff --git a/lib/entities/PizzaRecipe/RecipeSubStep.g.dart b/lib/entities/PizzaRecipe/RecipeSubStep.g.dart index 7b5e659..7b38a68 100644 --- a/lib/entities/PizzaRecipe/RecipeSubStep.g.dart +++ b/lib/entities/PizzaRecipe/RecipeSubStep.g.dart @@ -19,17 +19,19 @@ class RecipeSubStepAdapter extends TypeAdapter { return RecipeSubStep( fields[0] as String, fields[1] as String, - ); + )..completedOn = fields[2] as DateTime?; } @override void write(BinaryWriter writer, RecipeSubStep obj) { writer - ..writeByte(2) + ..writeByte(3) ..writeByte(0) ..write(obj.name) ..writeByte(1) - ..write(obj.description); + ..write(obj.description) + ..writeByte(2) + ..write(obj.completedOn); } @override diff --git a/lib/main.dart b/lib/main.dart index e1a3093..744029c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -16,16 +16,17 @@ import 'package:pizzaplanner/util.dart'; void main() async { await Hive.initFlutter(); + Hive.registerAdapter(PizzaEventAdapter()); Hive.registerAdapter(PizzaRecipeAdapter()); Hive.registerAdapter(RecipeStepAdapter()); Hive.registerAdapter(RecipeSubStepAdapter()); Hive.registerAdapter(IngredientAdapter()); - Hive.registerAdapter(PizzaEventAdapter()); await Hive.openBox("PizzaEvents"); var pizzaRecipesBox = await Hive.openBox("PizzaRecipes"); if (pizzaRecipesBox.isEmpty){ + print("Load pizzas from yamls"); pizzaRecipesBox.addAll(await getRecipes()); } diff --git a/lib/pages/PizzaEventPage.dart b/lib/pages/PizzaEventPage.dart index a1447f7..4d70737 100644 --- a/lib/pages/PizzaEventPage.dart +++ b/lib/pages/PizzaEventPage.dart @@ -53,7 +53,6 @@ class PizzaEventPageState extends State { } else { subStep.completedOn = null; } - await this.widget.pizzaEvent.delete(); await this.widget.pizzaEvent.save(); setState(() {}); },