// Helpful guides: // - https://flutter.dev/docs/cookbook/forms/validation import 'package:flutter/material.dart'; void main() { runApp(const MainApp()); } class MainApp extends StatelessWidget { const MainApp({super.key}); @override Widget build(BuildContext context) { const inputWidth = 400.0; const inputHeight = 50.0; const recurrenceValues = [ DropdownMenuEntry(value: Recurrence.daily, label: "Daily"), DropdownMenuEntry(value: Recurrence.weekly, label: "Weekly"), DropdownMenuEntry(value: Recurrence.biweekly, label: "Biweekly"), DropdownMenuEntry(value: Recurrence.montly, label: "Monthly"), DropdownMenuEntry(value: Recurrence.yearly, label: "Yearly") ]; var cost; return const MaterialApp( home: Scaffold( body: Center( child: Column(mainAxisSize: MainAxisSize.min, spacing: 10, children: [ Text('Input an expense below!'), SizedBox( width: inputWidth, height: inputHeight, child: TextField( keyboardType: TextInputType.text, decoration: InputDecoration(hintText: "Expense Name"), // https://docs.flutter.dev/cookbook/forms/retrieve-input )), SizedBox( width: inputWidth, height: inputHeight, child: TextField( keyboardType: TextInputType.numberWithOptions(decimal: true), decoration: InputDecoration(hintText: "Expense Cost"), ), ), DropdownMenu( dropdownMenuEntries: recurrenceValues, hintText: "Recurrence", width: inputWidth, ), SizedBox( width: inputWidth, height: inputHeight, child: TextField( keyboardType: TextInputType.text, decoration: InputDecoration(hintText: "Expense Description"), )), ]), ), ), ); } } // https://www.tutorialspoint.com/dart_programming/dart_programming_enumeration.htm enum Recurrence { daily, weekly, biweekly, montly, yearly } class Expense { String name; double cost; Recurrence recurrence; String description; Expense(this.name, this.cost, this.recurrence, this.description); }