Skip to content

Commit

Permalink
Added no transaction support
Browse files Browse the repository at this point in the history
  • Loading branch information
tuhinpal committed Jul 30, 2023
1 parent 1c57d80 commit ac0b8c3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/screens/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,30 @@ class _MainScreenState extends State<MainScreen> {
transactionDate.year == month.year;
}).toList();

// if there are no transactions for the month, render a message
if (monthTransactions.isEmpty) {
return const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'No transactions for this month',
style: TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 8.0),
Text(
'Start adding transactions by clicking the +',
style: TextStyle(
fontSize: 14.0,
color: Colors.grey,
),
)
],
);
}

// Group transactions by date
Map<String, List<Transaction>> groupedTransactions =
groupTransactionsByDate(monthTransactions);
Expand Down

0 comments on commit ac0b8c3

Please sign in to comment.