diff --git a/lib/main.dart b/lib/main.dart index 73d53e2..6e80a13 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -118,11 +118,9 @@ class _HomePageState extends State { }); }, ), - body: Center( - child: Container( - color: Theme.of(context).colorScheme.primaryContainer, - child: page, - ), + body: Container( + color: Theme.of(context).colorScheme.primaryContainer, + child: Center(child: page), ), floatingActionButton: floatingButton, ); diff --git a/lib/pages/expense.dart b/lib/pages/expense.dart index 3da7eb0..d3b4f47 100644 --- a/lib/pages/expense.dart +++ b/lib/pages/expense.dart @@ -12,29 +12,31 @@ class ExpensePage extends StatelessWidget { @override Widget build(BuildContext context) { - return ListView.builder( - itemCount: expenses.length, - itemBuilder: (_, index) { - final Expense curr = expenses[index]; - return Center( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4), - color: Colors.greenAccent, - ), - child: Column( - children: [ - Text(curr.name), - Text("${curr.cost.toString()} ${curr.frequency.title}"), - ], - ), - ), - ), - ); - }, - ); + return expenses.isEmpty + ? Text("Add expenses to get started!") + : ListView.builder( + itemCount: expenses.length, + itemBuilder: (_, index) { + final Expense curr = expenses[index]; + return Center( + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + color: Colors.greenAccent, + ), + child: Column( + children: [ + Text(curr.name), + Text("${curr.cost.toString()} ${curr.frequency.title}"), + ], + ), + ), + ), + ); + }, + ); } }