archive button is not available if the pizza event is in the future

This commit is contained in:
broodjeaap89 2021-09-14 21:36:45 +02:00
parent f7bc15d18a
commit 1b9741fe51
2 changed files with 3 additions and 5 deletions

View file

@ -51,14 +51,14 @@ class PizzaEventsState extends State<PizzaEventsPage> {
},
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);

View file

@ -14,5 +14,3 @@
- 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)