- Implemented ExpensesTab to display a list of expenses with details. - Created GroupExpensesPage to manage group expenses with a tabbed interface. - Added SettlementsTab to show optimized settlements between users. - Developed data models for Expense and Balance, including necessary methods for serialization. - Introduced CountRepository for Firestore interactions related to expenses. - Added CountService to handle business logic for expenses and settlements. - Integrated image picker for receipt uploads. - Updated main.dart to include CountBloc and CountRepository. - Enhanced pubspec.yaml with new dependencies for image picking and Firebase storage. Not Tested yet
35 lines
754 B
Dart
35 lines
754 B
Dart
class Balance {
|
|
final String userId;
|
|
final String userName;
|
|
final double totalPaid;
|
|
final double totalOwed;
|
|
final double balance;
|
|
|
|
Balance({
|
|
required this.userId,
|
|
required this.userName,
|
|
required this.totalPaid,
|
|
required this.totalOwed,
|
|
}) : balance = totalPaid - totalOwed;
|
|
|
|
bool get shouldReceive => balance > 0;
|
|
bool get shouldPay => balance < 0;
|
|
double get absoluteBalance => balance.abs();
|
|
}
|
|
|
|
class Settlement {
|
|
final String fromUserId;
|
|
final String fromUserName;
|
|
final String toUserId;
|
|
final String toUserName;
|
|
final double amount;
|
|
|
|
Settlement({
|
|
required this.fromUserId,
|
|
required this.fromUserName,
|
|
required this.toUserId,
|
|
required this.toUserName,
|
|
required this.amount,
|
|
});
|
|
}
|