From 19e10e67926219e1c73b18751eea0e054588e427 Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 30 Jan 2025 20:27:03 -0700 Subject: [PATCH] Test UI done enough, start working on how to get the input into an Expense. --- lib/main.dart | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 91044dd..babf2ba 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,7 +12,10 @@ class MainApp extends StatelessWidget { @override Widget build(BuildContext context) { - const recurranceValues = [ + const inputWidth = 400.0; + const inputHeight = 50.0; + + const recurrenceValues = [ DropdownMenuEntry(value: "D", label: "Daily"), DropdownMenuEntry(value: "W", label: "Weekly"), DropdownMenuEntry(value: "B", label: "Biweekly"), @@ -20,35 +23,38 @@ class MainApp extends StatelessWidget { DropdownMenuEntry(value: "Y", 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: 400, - height: 50, + width: inputWidth, + height: inputHeight, child: TextField( keyboardType: TextInputType.text, decoration: InputDecoration(hintText: "Expense Name"), + // https://docs.flutter.dev/cookbook/forms/retrieve-input + )), SizedBox( - width: 400, - height: 50, + width: inputWidth, + height: inputHeight, child: TextField( keyboardType: TextInputType.numberWithOptions(decimal: true), decoration: InputDecoration(hintText: "Expense Cost"), ), ), DropdownMenu( - dropdownMenuEntries: recurranceValues, - hintText: "Recurrance", - width: 400, - menuHeight: 50, + dropdownMenuEntries: recurrenceValues, + hintText: "Recurrence", + width: inputWidth, ), SizedBox( - width: 400, - height: 50, + width: inputWidth, + height: inputHeight, child: TextField( keyboardType: TextInputType.text, decoration: InputDecoration(hintText: "Expense Description"), @@ -59,3 +65,12 @@ class MainApp extends StatelessWidget { ); } } + +class Expense { + String name; + double cost; + Enum recurrence; + String description; + + Expense(this.name, this.cost, this.recurrence, this.description); +}