Commit 8bc392a
Changed files (9)
lib
components
model
screens
subsettings
lib/components/measurement_list/measurement_list_entry.dart
@@ -1,5 +1,5 @@
import 'package:blood_pressure_app/model/blood_pressure.dart';
-import 'package:blood_pressure_app/model/storage/settings_store.dart';
+import 'package:blood_pressure_app/model/storage/storage.dart';
import 'package:blood_pressure_app/screens/add_measurement.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
lib/components/settings/settings_widgets.dart
@@ -15,7 +15,7 @@
/// List tiles that find no use in the app:
/// - [CheckboxListTile]
/// - [RadioListTile]
-library settings;
+library settings_widgets;
import 'package:flutter/material.dart';
lib/components/export_item_order.dart
@@ -4,9 +4,7 @@ import 'dart:async';
import 'package:badges/badges.dart' as badges;
import 'package:blood_pressure_app/components/consistent_future_builder.dart';
import 'package:blood_pressure_app/model/export_options.dart';
-import 'package:blood_pressure_app/model/storage/export_csv_settings_store.dart';
-import 'package:blood_pressure_app/model/storage/export_pdf_settings_store.dart';
-import 'package:blood_pressure_app/model/storage/export_settings_store.dart';
+import 'package:blood_pressure_app/model/storage/storage.dart';
import 'package:blood_pressure_app/screens/subsettings/export_column_data.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
lib/model/storage/common_settings_interfaces.dart
@@ -1,6 +1,3 @@
-/// This library hosts interfaces with attributes that different settings classes provide.
-library;
-
import 'package:blood_pressure_app/model/storage/export_csv_settings_store.dart';
import 'package:blood_pressure_app/model/storage/export_pdf_settings_store.dart';
lib/model/storage/settings_store.dart
@@ -4,20 +4,11 @@ import 'package:blood_pressure_app/model/horizontal_graph_line.dart';
import 'package:blood_pressure_app/model/storage/convert_util.dart';
import 'package:flutter/material.dart';
-/// Stores settings that are directly controllable by the user through the Settings screen.
+/// Stores settings that are directly controllable by the user through the settings screen.
///
-/// This class should not be used to save persistent state that the user doesn't know about. To do this use one of the
-/// other classes in the storage directory or add a table to config_db and create your own class. Keeping data modular
-/// helps to reduce the amount of data saved to the database and makes the internal purpose of a setting more clear.
+/// This class should not be used to save persistent state that the user doesn't know about.
///
-/// Steps for expanding this class:
-/// - [ ] Add private variable with default value
-/// - [ ] Add getter and setter, where setter calls `notifyListeners()`
-/// - [ ] Add as nullable to constructor definition and if != null assign it to the private variable in the body
-/// - [ ] Add parsable representation (string, boolean or integer) to the .toMap
-/// - [ ] Parse it in the .fromMap factory method
-/// - [ ] Make sure edge cases are handled in .fromMap (does not exist (update), not parsable (user))
-/// - [ ] To verify everything was done correctly, tests should be expanded with the newly added fields (json_serialization_test.dart)
+/// The [storage] library comment has more information on the architecture for adding persistent fields.
class Settings extends ChangeNotifier {
/// Creates a settings object with the default values.
///
lib/model/storage/storage.dart
@@ -0,0 +1,25 @@
+/// Persistently stored information that is not a measurement.
+///
+/// To store new information use one of the existing classes in the storage directory or in case there is no fitting
+/// class, add a table to config_db and create a new class. For streamlined import it should be reexported here.
+///
+/// Steps for expanding a storage class:
+/// - Add private variable with default value
+/// - Add getter and setter, where setter calls `notifyListeners()`
+/// - Add as nullable to constructor definition and if != null assign it to the private variable in the body
+/// - Add parsable representation (string, boolean or integer) to the .toMap
+/// - Parse it in the .fromMap factory method
+/// - Make sure edge cases are handled in .fromMap (does not exist (update), not parsable (user))
+/// - To verify everything was done correctly, tests should be expanded with the newly added fields (json_serialization_test.dart)
+///
+/// Keeping data modular reduces the amount of data saved to the database and makes the purpose of a setting more clear.
+library storage;
+
+export 'common_settings_interfaces.dart';
+export 'db/config_dao.dart';
+export 'export_csv_settings_store.dart';
+export 'export_pdf_settings_store.dart';
+export 'export_settings_store.dart';
+export 'intervall_store.dart';
+export 'settings_store.dart';
+export 'update_legacy_settings.dart';
\ No newline at end of file
lib/model/horizontal_graph_line.dart
@@ -1,10 +1,16 @@
+import 'package:blood_pressure_app/model/blood_pressure.dart';
import 'package:flutter/material.dart';
class HorizontalGraphLine {
+ HorizontalGraphLine(this.color, this.height);
+
+ /// Color of the line.
Color color;
- int height;
- HorizontalGraphLine(this.color, this.height);
+ /// Height to display the line in.
+ ///
+ /// Usually on the same scale as [BloodPressureRecord]
+ int height;
HorizontalGraphLine.fromJson(Map<String, dynamic> json)
: color = Color(json['color']),
lib/screens/subsettings/export_import_screen.dart
@@ -6,12 +6,7 @@ import 'package:blood_pressure_app/components/settings/settings_widgets.dart';
import 'package:blood_pressure_app/model/blood_pressure.dart';
import 'package:blood_pressure_app/model/export_import.dart';
import 'package:blood_pressure_app/model/export_options.dart';
-import 'package:blood_pressure_app/model/storage/common_settings_interfaces.dart';
-import 'package:blood_pressure_app/model/storage/export_csv_settings_store.dart';
-import 'package:blood_pressure_app/model/storage/export_pdf_settings_store.dart';
-import 'package:blood_pressure_app/model/storage/export_settings_store.dart';
-import 'package:blood_pressure_app/model/storage/intervall_store.dart';
-import 'package:blood_pressure_app/model/storage/settings_store.dart';
+import 'package:blood_pressure_app/model/storage/storage.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:jsaver/jSaver.dart';
lib/screens/settings.dart
@@ -6,7 +6,7 @@ import 'package:blood_pressure_app/components/dialoges/input_dialoge.dart';
import 'package:blood_pressure_app/components/settings/settings_widgets.dart';
import 'package:blood_pressure_app/model/blood_pressure.dart';
import 'package:blood_pressure_app/model/iso_lang_names.dart';
-import 'package:blood_pressure_app/model/storage/settings_store.dart';
+import 'package:blood_pressure_app/model/storage/storage.dart';
import 'package:blood_pressure_app/platform_integration/platform_client.dart';
import 'package:blood_pressure_app/screens/subsettings/delete_data.dart';
import 'package:blood_pressure_app/screens/subsettings/export_import_screen.dart';