initial commit

Signed-off-by: Menno van Leeuwen <menno@vleeuwen.me>
This commit is contained in:
2025-08-26 01:21:26 +02:00
commit f8c19f9051
132 changed files with 7054 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
class SupplementIntake {
final int? id;
final int supplementId;
final DateTime takenAt;
final double dosageTaken; // Total dosage amount taken
final int unitsTaken; // Number of units taken
final String? notes;
SupplementIntake({
this.id,
required this.supplementId,
required this.takenAt,
required this.dosageTaken,
required this.unitsTaken,
this.notes,
});
Map<String, dynamic> toMap() {
return {
'id': id,
'supplementId': supplementId,
'takenAt': takenAt.toIso8601String(),
'dosageTaken': dosageTaken,
'unitsTaken': unitsTaken,
'notes': notes,
};
}
factory SupplementIntake.fromMap(Map<String, dynamic> map) {
return SupplementIntake(
id: map['id'],
supplementId: map['supplementId'],
takenAt: DateTime.parse(map['takenAt']),
dosageTaken: map['dosageTaken'],
unitsTaken: map['unitsTaken'] ?? 1, // Default for backwards compatibility
notes: map['notes'],
);
}
SupplementIntake copyWith({
int? id,
int? supplementId,
DateTime? takenAt,
double? dosageTaken,
int? unitsTaken,
String? notes,
}) {
return SupplementIntake(
id: id ?? this.id,
supplementId: supplementId ?? this.supplementId,
takenAt: takenAt ?? this.takenAt,
dosageTaken: dosageTaken ?? this.dosageTaken,
unitsTaken: unitsTaken ?? this.unitsTaken,
notes: notes ?? this.notes,
);
}
}