Attempting to move the input form to a popup.

This commit is contained in:
Hyperling 2025-02-01 16:50:37 -07:00
parent d722172cb3
commit c44d4553c3

View File

@ -50,9 +50,11 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
Widget page;
Widget? dialog;
switch (pageSelected) {
case 0:
page = ExpensePage();
dialog = ExpenseInputForm();
case 1:
page = IncomePage();
case 2:
@ -65,6 +67,19 @@ class _HomePageState extends State<HomePage> {
throw UnimplementedError('No widget for page $pageSelected yet!');
}
Widget newExpense() {
return AlertDialog(title: Text("Add New Value"), content: dialog);
}
Widget? floatingButton;
if (dialog != null) {
floatingButton = IconButton(
onPressed: newExpense,
icon: Icon(Icons.add),
color: Theme.of(context).colorScheme.onSurface,
);
}
return LayoutBuilder(builder: (context, constraints) {
return Scaffold(
body: Row(
@ -110,7 +125,7 @@ class _HomePageState extends State<HomePage> {
),
],
),
//floatingActionButton: IconButton(onPressed: appState.newExpense(), icon: Icon(Icons.add)),
floatingActionButton: floatingButton,
);
});
}