Commit a28879c

derdilla <82763757+NobodyForNothing@users.noreply.github.com>
2023-12-22 11:19:13
fix todos
Signed-off-by: derdilla <82763757+NobodyForNothing@users.noreply.github.com>
1 parent 9a1d141
lib/components/dialoges/input_dialoge.dart
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:flutter_gen/gen_l10n/app_localizations.dart';
 
-// TODO: redo dialoges in flutter style
 class InputDialoge extends StatefulWidget {
   final String hintText;
   final String? initialValue;
lib/components/export_warn_banner.dart
@@ -17,9 +17,7 @@ class ExportWarnBanner extends StatefulWidget {
     required this.csvExportSettings,
     required this.availableColumns});
   // TODO: consider attempting to import a file with that config and checking success.
-  // This would allow fore more detailed error messages as well.
-
-  // TODO: warn about potential quality loss when using TimeColumn
+  // This would allow for more detailed error messages as well.
 
   final ExportSettings exportSettings;
   final CsvExportSettings csvExportSettings;
lib/model/export_import/import_field_type.dart
@@ -17,11 +17,11 @@ enum RowDataFieldType {
   pul,
   /// Guarantees [String] is returned.
   notes,
-  @Deprecated('use needlePin instead. Can be removed in code as all colors can be expressed as needle pins') // TODO: implement conversion to needle pin?
+  @Deprecated('use needlePin instead. Can be removed in code as all colors can be expressed as needle pins')
   /// Guarantees [Color] is returned.
   color,
   /// Guarantees that the returned type is of type [MeasurementNeedlePin].
-  needlePin;  // TODO implement in ScriptedFormatter
+  needlePin;
 
   String localize(AppLocalizations localizations) {
     switch(this) {
lib/model/export_import/pdf_converter.dart
@@ -71,7 +71,7 @@ class PdfConverter {
       margin: const pw.EdgeInsets.all(20),
       child: pw.TableHelper.fromTextArray(
           data: [
-            ['',localizations.sysLong, localizations.diaLong, localizations.pulLong], // TODO: localizations.pulsePressure],
+            ['',localizations.sysLong, localizations.diaLong, localizations.pulLong],
             [localizations.average, analyzer.avgSys, analyzer.avgDia, analyzer.avgPul],
             [localizations.maximum, analyzer.maxSys, analyzer.maxDia, analyzer.maxPul],
             [localizations.minimum, analyzer.minSys, analyzer.minDia, analyzer.minPul],
lib/model/export_import/record_formatter.dart
@@ -32,7 +32,7 @@ abstract interface class Formatter {
 class ScriptedFormatter implements Formatter {
   ScriptedFormatter(this.pattern);
 
-  /// Pattern used for formatting values. TODO: explain
+  /// Pattern used for formatting values.
   final String pattern;
 
   @override
@@ -178,7 +178,8 @@ class ScriptedTimeFormatter implements Formatter {
   final DateFormat timeFormatter;
   
   @override
-  (RowDataFieldType, dynamic)? decode(String pattern) { // TODO: empty strings should not decode at all
+  (RowDataFieldType, dynamic)? decode(String pattern) {
+    if (pattern.isEmpty) return null;
     try {
       return (RowDataFieldType.timestamp, timeFormatter.parseLoose(pattern));
     } on FormatException {
lib/model/export_import/record_parsing_result.dart
@@ -44,7 +44,6 @@ class RecordParsingErrorEmptyFile implements RecordParsingError {}
 class RecordParsingErrorTimeNotRestoreable implements RecordParsingError {}
 
 /// There is no column with this csv title that can be reversed.
-/// TODO: remove reversed limitation
 class RecordParsingErrorUnknownColumn implements RecordParsingError {
   RecordParsingErrorUnknownColumn(this.title);
   
lib/model/storage/db/config_db.dart
@@ -122,7 +122,7 @@ class ConfigDB {
     // When adding more versions the upgrade procedure proposed in https://stackoverflow.com/a/75153875/21489239
     // might be useful, to avoid duplicated code. Currently this would only lead to complexity without benefits.
     assert(newVersion == 3);
-    if (oldVersion == 1) { // TODO: migrate data, delete old table and test update
+    if (oldVersion == 1) {
       await db.execute(_settingsTableCreationString);
       await db.execute(_exportSettingsTableCreationString);
       await db.execute(_exportCsvSettingsTableCreationString);
lib/model/storage/export_columns_store.dart
@@ -5,7 +5,7 @@ import 'package:blood_pressure_app/model/export_import/column.dart';
 import 'package:flutter/material.dart';
 
 /// Class for managing columns available to the user.
-class ExportColumnsManager extends ChangeNotifier { // TODO: separate ExportColumnsManager for export and import ?
+class ExportColumnsManager extends ChangeNotifier {
   /// Create a new manager for export columns.
   ///
   /// It will be filled with the default columns but won't contain initial user columns.
lib/model/storage/export_pdf_settings_store.dart
@@ -25,6 +25,8 @@ class PdfExportSettings extends ChangeNotifier implements CustomFieldsSettings {
     if (headerFontSize != null) _headerFontSize = headerFontSize;
     if (cellFontSize != null) _cellFontSize = cellFontSize;
     if (exportFieldsConfiguration != null) _exportFieldsConfiguration = exportFieldsConfiguration;
+
+    _exportFieldsConfiguration.addListener(() => notifyListeners());
   }
 
   factory PdfExportSettings.fromMap(Map<String, dynamic> map) => PdfExportSettings(
@@ -112,7 +114,6 @@ class PdfExportSettings extends ChangeNotifier implements CustomFieldsSettings {
 
   ActiveExportColumnConfiguration _exportFieldsConfiguration = ActiveExportColumnConfiguration();
   @override
-  // TODO: implement exportFieldsConfiguration
   ActiveExportColumnConfiguration get exportFieldsConfiguration => _exportFieldsConfiguration;
 
   // Procedure for adding more entries described in the settings_store.dart doc comment
lib/model/storage/update_legacy_settings.dart
@@ -47,7 +47,7 @@ Future<void> updateLegacySettings(Settings settings, ExportSettings exportSettin
         await sharedPreferences.remove(key);
         break;
       case 'exportItems':
-        //csvExportSettings.customFields = sharedPreferences.getStringList(key)!; TODO: update
+        // can't be migrated as internalIdentifier changed
         await sharedPreferences.remove(key);
         break;
       case 'darkMode':
@@ -121,7 +121,7 @@ Future<void> updateLegacySettings(Settings settings, ExportSettings exportSettin
           sharedPreferences.getBool(key)! ? ExportImportPreset.none : ExportImportPreset.bloodPressureApp;
         break;
       case 'exportItemsCsv':
-        // csvExportSettings.customFields = sharedPreferences.getStringList(key)!;TODO: update
+        // can't be migrated as internalIdentifier changed
         break;
       case 'exportCsvHeadline':
         csvExportSettings.exportHeadline = sharedPreferences.getBool(key)!;
@@ -173,7 +173,7 @@ Future<void> updateLegacySettings(Settings settings, ExportSettings exportSettin
               ? ExportImportPreset.none : ExportImportPreset.bloodPressureApp;
         break;
       case 'exportItemsPdf':
-        // pdfExportSettings.customFields = sharedPreferences.getStringList(key)!; TODO: update
+        // can't be migrated as internalIdentifier changed
         break;
       case 'horizontalGraphLines':
         settings.horizontalGraphLines = sharedPreferences.getStringList(key)!.map((e) =>
lib/screens/subsettings/export_import/export_button_bar.dart
@@ -97,7 +97,7 @@ class ExportButtonBar extends StatelessWidget {
                     });
                     if (result.hasError()) return;
                     final model = Provider.of<BloodPressureModel>(context, listen: false);
-                    for (final record in importedRecords) { // TODO: background thread
+                    for (final record in importedRecords) {
                       await model.add(record);
                     }
                     messenger.showSnackBar(SnackBar(content: Text(
lib/screens/statistics.dart
@@ -162,8 +162,6 @@ class Statistic extends StatelessWidget {
   final Widget caption;
   final Widget child;
   /// Reduces the padding at the sites to allow packing [Statistic] widgets tighter together.
-  ///
-  /// TODO: should not depend on property and padding should be added outside of Statistic
   final bool smallEdges;
 
   const Statistic({super.key, required this.caption, required this.child, this.smallEdges = false});
test/model/intervall_store_test.dart
@@ -96,7 +96,6 @@ void main() {
       expect(last30DaysIntervall.currentRange.duration.inDays, 30);
       expect(customIntervall.currentRange.duration.inMilliseconds, 24 * 60 * 60 * 1000);
     });
-    // TODO: test if it's the most recent intervall
   });
 
 }
\ No newline at end of file