Commit 7c85cd7

derdilla <82763757+NobodyForNothing@users.noreply.github.com>
2024-03-16 13:35:05
implement note type
Signed-off-by: derdilla <82763757+NobodyForNothing@users.noreply.github.com>
1 parent 2545815
Changed files (5)
health_data_store/lib/src/types/blood_pressure_record.dart
@@ -1,4 +1,3 @@
-
 import 'package:freezed_annotation/freezed_annotation.dart';
 
 part 'blood_pressure_record.freezed.dart';
@@ -18,4 +17,3 @@ class BloodPressureRecord with _$BloodPressureRecord {
     int? pul,
   }) = _BloodPressureRecord;
 }
-// TODO: create class for note and color/pin
health_data_store/lib/src/types/medicine.dart
@@ -9,10 +9,11 @@ class Medicine with _$Medicine {
   const factory Medicine({
     /// Name of the medicine.
     required String designation,
-    /// Additional data associated with this medicine.
+    /// ARGB color in number format.
     ///
-    /// For example serialized colors or tags.
-    String? data,
+    /// Can also be obtained through the `dart:ui` Colors `value` attribute.
+    /// Sample value: `0xFF42A5F5`
+    int? color,
     /// Default dosis of medication.
     int? dosis,
   }) = _Medicine;
health_data_store/lib/src/types/medicine_intake.dart
@@ -1,4 +1,3 @@
-
 import 'package:freezed_annotation/freezed_annotation.dart';
 import 'package:health_data_store/src/types/medicine.dart';
 
health_data_store/lib/src/types/note.dart
@@ -0,0 +1,20 @@
+import 'package:freezed_annotation/freezed_annotation.dart';
+
+part 'note.freezed.dart';
+
+/// Supporting information left by the enduser.
+@freezed
+class Note with _$Note {
+  /// Create supporting information from the enduser.
+  const factory Note({
+    /// Timestamp when the note was taken.
+    required DateTime time,
+    /// Content of the note.
+    String? note,
+    /// ARGB color in number format.
+    ///
+    /// Can also be obtained through the `dart:ui` Colors `value` attribute.
+    /// Sample value: `0xFF42A5F5`
+    int? color,
+  }) = _Notes;
+}
health_data_store/test/src/types/note_test.dart
@@ -0,0 +1,21 @@
+import 'package:health_data_store/src/types/note.dart';
+import 'package:test/test.dart';
+
+void main() {
+  test('should initialize', () {
+    final time = DateTime.now();
+    final note = Note(
+      time: time,
+      note: 'testNote',
+      color: 0xFF42A5F5,
+    );
+    expect(note.time, equals(time));
+    expect(note.color, equals(0xFF42A5F5));
+    expect(note.note, equals('testNote'));
+    expect(note, equals(Note(
+      time: time,
+      note: 'testNote',
+      color: 0xFF42A5F5,
+    )));
+  });
+}