- 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
92 lines
1.8 KiB
Dart
92 lines
1.8 KiB
Dart
import 'dart:io';
|
|
import 'package:equatable/equatable.dart';
|
|
import '../../data/models/expense.dart';
|
|
|
|
abstract class CountEvent extends Equatable {
|
|
const CountEvent();
|
|
|
|
@override
|
|
List<Object?> get props => [];
|
|
}
|
|
|
|
class LoadExpenses extends CountEvent {
|
|
final String groupId;
|
|
final bool includeArchived;
|
|
|
|
const LoadExpenses(this.groupId, {this.includeArchived = false});
|
|
|
|
@override
|
|
List<Object?> get props => [groupId, includeArchived];
|
|
}
|
|
|
|
class CreateExpense extends CountEvent {
|
|
final Expense expense;
|
|
final File? receiptImage;
|
|
|
|
const CreateExpense({
|
|
required this.expense,
|
|
this.receiptImage,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [expense, receiptImage];
|
|
}
|
|
|
|
class UpdateExpense extends CountEvent {
|
|
final Expense expense;
|
|
final File? newReceiptImage;
|
|
|
|
const UpdateExpense({
|
|
required this.expense,
|
|
this.newReceiptImage,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [expense, newReceiptImage];
|
|
}
|
|
|
|
class DeleteExpense extends CountEvent {
|
|
final String groupId;
|
|
final String expenseId;
|
|
|
|
const DeleteExpense({
|
|
required this.groupId,
|
|
required this.expenseId,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [groupId, expenseId];
|
|
}
|
|
|
|
class ArchiveExpense extends CountEvent {
|
|
final String groupId;
|
|
final String expenseId;
|
|
|
|
const ArchiveExpense({
|
|
required this.groupId,
|
|
required this.expenseId,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [groupId, expenseId];
|
|
}
|
|
|
|
class MarkSplitAsPaid extends CountEvent {
|
|
final String groupId;
|
|
final String expenseId;
|
|
final String userId;
|
|
|
|
const MarkSplitAsPaid({
|
|
required this.groupId,
|
|
required this.expenseId,
|
|
required this.userId,
|
|
});
|
|
|
|
@override
|
|
List<Object?> get props => [groupId, expenseId, userId];
|
|
}
|
|
|
|
class LoadExchangeRates extends CountEvent {
|
|
const LoadExchangeRates();
|
|
}
|