- Added ExpenseDetailDialog for displaying expense details and actions. - Created ExpensesTab to list expenses for a group. - Developed GroupExpensesPage to manage group expenses with tabs for expenses, balances, and settlements. - Introduced SettlementsTab to show optimized repayment plans. - Refactored create_trip_content.dart to remove CountBloc and related logic. - Added Account model to manage user accounts and group members. - Replaced CountRepository with AccountRepository for account-related operations. - Removed CountService and CountRepository as part of the refactor. - Updated main.dart and home.dart to integrate new account management components.
48 lines
998 B
Dart
48 lines
998 B
Dart
import 'group_member.dart';
|
|
|
|
class Account {
|
|
final String id;
|
|
final String tripId;
|
|
final String groupId;
|
|
final List<GroupMember> members;
|
|
|
|
Account({
|
|
required this.id,
|
|
required this.tripId,
|
|
required this.groupId,
|
|
List<GroupMember>? members,
|
|
}) : members = members ?? [];
|
|
|
|
|
|
factory Account.fromMap(Map<String, dynamic> map) {
|
|
return Account(
|
|
id: map['id'] as String,
|
|
tripId: map['tripId'] as String,
|
|
groupId: map['groupId'] as String,
|
|
members: [],
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
'tripId': tripId,
|
|
'groupId': groupId,
|
|
'members': members.map((member) => member.toMap()).toList(),
|
|
};
|
|
}
|
|
|
|
Account copyWith({
|
|
String? id,
|
|
String? tripId,
|
|
String? groupId,
|
|
List<GroupMember>? members,
|
|
}) {
|
|
return Account(
|
|
id: id ?? this.id,
|
|
tripId: tripId ?? this.tripId,
|
|
groupId: groupId ?? this.groupId,
|
|
members: members ?? this.members,
|
|
);
|
|
}
|
|
} |