Add edit button to plan_tile

This commit is contained in:
Brandon Presley 2023-11-30 13:07:14 +13:00
parent 6908623ba2
commit 9aed2b3ac1

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:fmassive/database.dart';
import 'package:fmassive/edit_plan.dart';
import 'package:fmassive/main.dart';
import 'package:fmassive/start_plan.dart';
import 'package:moor_flutter/moor_flutter.dart';
@ -19,6 +20,18 @@ class PlanTile extends StatelessWidget {
Widget build(BuildContext context) {
return MenuAnchor(
menuChildren: [
MenuItemButton(
child: const Text("Edit"),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
EditPlanPage(plan: plan.toCompanion(false)),
),
);
},
),
MenuItemButton(
onPressed: () async {
await db.plans.deleteOne(plan);