feat: adds RDA for intake of vitamins and certain elements based on

canada health values
This commit is contained in:
2025-08-28 15:29:20 +02:00
parent 6524e625d8
commit 31e04fe260
24 changed files with 2542 additions and 369 deletions

View File

@@ -2,8 +2,8 @@ import 'dart:convert';
import 'package:uuid/uuid.dart';
import 'ingredient.dart';
import '../services/database_sync_service.dart';
import 'ingredient.dart';
class Supplement {
final int? id;
@@ -69,8 +69,7 @@ class Supplement {
}
Map<String, dynamic> toMap() {
return {
'id': id,
final map = <String, dynamic>{
'name': name,
'brand': brand,
'ingredients': jsonEncode(ingredients.map((ingredient) => ingredient.toMap()).toList()),
@@ -86,6 +85,12 @@ class Supplement {
'syncStatus': syncStatus.name,
'isDeleted': isDeleted ? 1 : 0,
};
if (id != null) {
map['id'] = id;
}
return map;
}
factory Supplement.fromMap(Map<String, dynamic> map) {
@@ -133,6 +138,7 @@ class Supplement {
Supplement copyWith({
int? id,
bool setNullId = false,
String? name,
String? brand,
List<Ingredient>? ingredients,
@@ -144,12 +150,13 @@ class Supplement {
DateTime? createdAt,
bool? isActive,
String? syncId,
bool newSyncId = false,
DateTime? lastModified,
RecordSyncStatus? syncStatus,
bool? isDeleted,
}) {
return Supplement(
id: id ?? this.id,
id: setNullId ? null : (id ?? this.id),
name: name ?? this.name,
brand: brand ?? this.brand,
ingredients: ingredients ?? this.ingredients,
@@ -160,7 +167,7 @@ class Supplement {
notes: notes ?? this.notes,
createdAt: createdAt ?? this.createdAt,
isActive: isActive ?? this.isActive,
syncId: syncId ?? this.syncId,
syncId: newSyncId ? null : (syncId ?? this.syncId),
lastModified: lastModified ?? this.lastModified,
syncStatus: syncStatus ?? this.syncStatus,
isDeleted: isDeleted ?? this.isDeleted,