From 1b9741fe5132e0668bfa6afe74ebd63f54c3ea0f Mon Sep 17 00:00:00 2001 From: broodjeaap89 Date: Tue, 14 Sep 2021 21:36:45 +0200 Subject: [PATCH] archive button is not available if the pizza event is in the future --- lib/pages/pizza_events_page.dart | 4 ++-- todo.md | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/pages/pizza_events_page.dart b/lib/pages/pizza_events_page.dart index 79fe02c..18aaeab 100644 --- a/lib/pages/pizza_events_page.dart +++ b/lib/pages/pizza_events_page.dart @@ -51,14 +51,14 @@ class PizzaEventsState extends State { }, child: const Text("View"), ), - TextButton( + if (pizzaEvent.dateTime.isBefore(DateTime.now())) TextButton( onPressed: () { Navigator.pop(context); pizzaEvent.archived = true; pizzaEvent.save(); }, child: const Text("Archive"), - ), + ) else const SizedBox(), TextButton( onPressed: () { Navigator.pop(context); diff --git a/todo.md b/todo.md index 1ae68c0..4caad5c 100644 --- a/todo.md +++ b/todo.md @@ -13,6 +13,4 @@ - refactor to const page names instead of loose strings everywhere ('/path/page') - also do this with hive box names -## Bug -- when deleting recipes, it deletes 2, but not when deleting the last one -- user should only be able to archive a pizza event that has taken place (dateTime>now) \ No newline at end of file +## Bug \ No newline at end of file