Add the enum properly.

This commit is contained in:
Hyperling 2025-01-30 20:32:04 -07:00
parent 19e10e6792
commit b07a8f9c0a

View File

@ -16,11 +16,11 @@ class MainApp extends StatelessWidget {
const inputHeight = 50.0; const inputHeight = 50.0;
const recurrenceValues = <DropdownMenuEntry>[ const recurrenceValues = <DropdownMenuEntry>[
DropdownMenuEntry(value: "D", label: "Daily"), DropdownMenuEntry(value: Recurrence.daily, label: "Daily"),
DropdownMenuEntry(value: "W", label: "Weekly"), DropdownMenuEntry(value: Recurrence.weekly, label: "Weekly"),
DropdownMenuEntry(value: "B", label: "Biweekly"), DropdownMenuEntry(value: Recurrence.biweekly, label: "Biweekly"),
DropdownMenuEntry(value: "M", label: "Monthly"), DropdownMenuEntry(value: Recurrence.montly, label: "Monthly"),
DropdownMenuEntry(value: "Y", label: "Yearly") DropdownMenuEntry(value: Recurrence.yearly, label: "Yearly")
]; ];
var cost; var cost;
@ -66,10 +66,19 @@ class MainApp extends StatelessWidget {
} }
} }
// https://www.tutorialspoint.com/dart_programming/dart_programming_enumeration.htm
enum Recurrence {
daily,
weekly,
biweekly,
montly,
yearly
}
class Expense { class Expense {
String name; String name;
double cost; double cost;
Enum recurrence; Recurrence recurrence;
String description; String description;
Expense(this.name, this.cost, this.recurrence, this.description); Expense(this.name, this.cost, this.recurrence, this.description);