create project

This commit is contained in:
2026-05-19 11:46:42 +08:00
commit dcdf1f60b1
60 changed files with 9309 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
class FamilyMember {
final String userId;
final String nickname;
final String role;
final String joinedAt;
const FamilyMember({
required this.userId,
required this.nickname,
this.role = 'member',
this.joinedAt = '',
});
factory FamilyMember.fromJson(Map<String, dynamic> json) {
return FamilyMember(
userId: json['userId'] as String? ?? '',
nickname: json['nickname'] as String? ?? '',
role: json['role'] as String? ?? 'member',
joinedAt: json['joinedAt'] as String? ?? '',
);
}
}
class Family {
final String id;
final String name;
final String inviteCode;
final String createdBy;
final String createdAt;
final List<FamilyMember> members;
const Family({
required this.id,
required this.name,
required this.inviteCode,
this.createdBy = '',
this.createdAt = '',
this.members = const [],
});
factory Family.fromJson(Map<String, dynamic> json) {
return Family(
id: json['id'] as String? ?? '',
name: json['name'] as String? ?? '',
inviteCode: json['inviteCode'] as String? ?? '',
createdBy: json['createdBy'] as String? ?? '',
createdAt: json['createdAt'] as String? ?? '',
members: (json['members'] as List<dynamic>?)
?.map((m) => FamilyMember.fromJson(m as Map<String, dynamic>))
.toList() ?? [],
);
}
}