Commit bd0135a
Changed files (21)
app
integration_test
lib
features
export_import
model
test
data_util
features
statistics
app/integration_test/screenshot_stats.dart
@@ -29,7 +29,7 @@ void main() {
localizationsDelegates: [AppLocalizations.delegate,], locale: Locale('en'),
home: MultiProvider(
providers: [
- ChangeNotifierProvider(create: (c) => IntervallStoreManager(IntervallStorage(), IntervallStorage(), IntervallStorage())),
+ ChangeNotifierProvider(create: (c) => IntervalStoreManager(IntervalStorage(), IntervalStorage(), IntervalStorage())),
ChangeNotifierProvider(create: (c) => Settings()),
],
child: RepositoryProvider<BloodPressureRepository>(
app/lib/data_util/blood_pressure_builder.dart
@@ -1,7 +1,7 @@
import 'dart:collection';
import 'package:blood_pressure_app/data_util/repository_builder.dart';
-import 'package:blood_pressure_app/model/storage/intervall_store.dart';
+import 'package:blood_pressure_app/model/storage/interval_store.dart';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:health_data_store/health_data_store.dart';
@@ -19,7 +19,7 @@ class BloodPressureBuilder extends StatelessWidget {
final Widget Function(BuildContext context, UnmodifiableListView<BloodPressureRecord> records) onData;
/// Which measurements to load.
- final IntervallStoreManagerLocation rangeType;
+ final IntervalStoreManagerLocation rangeType;
@override
Widget build(BuildContext context) =>
app/lib/data_util/interval_picker.dart
@@ -1,24 +1,24 @@
import 'package:blood_pressure_app/model/datarange_extension.dart';
-import 'package:blood_pressure_app/model/storage/intervall_store.dart';
+import 'package:blood_pressure_app/model/storage/interval_store.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import 'package:week_of_year/date_week_extensions.dart';
-/// A selector for [IntervallStorage] values.
+/// A selector for [IntervalStorage] values.
///
-/// Allows selection [IntervallStorage.currentRange] and moving intervall wise
+/// Allows selection [IntervalStorage.currentRange] and moving intervall wise
/// in both directions.
class IntervalPicker extends StatelessWidget {
- /// Create a selector for [IntervallStorage] values.
+ /// Create a selector for [IntervalStorage] values.
const IntervalPicker({super.key, required this.type});
/// Which range to display and modify.
- final IntervallStoreManagerLocation type;
+ final IntervalStoreManagerLocation type;
@override
- Widget build(BuildContext context) => Consumer<IntervallStoreManager>(
+ Widget build(BuildContext context) => Consumer<IntervalStoreManager>(
builder: (context, intervallStoreManager, _) {
final intervall = intervallStoreManager.get(type);
final loc = AppLocalizations.of(context)!;
app/lib/data_util/repository_builder.dart
@@ -1,5 +1,5 @@
import 'package:blood_pressure_app/data_util/consistent_future_builder.dart';
-import 'package:blood_pressure_app/model/storage/intervall_store.dart';
+import 'package:blood_pressure_app/model/storage/interval_store.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:health_data_store/health_data_store.dart';
@@ -14,7 +14,7 @@ class RepositoryBuilder<T, R extends Repository<T>> extends StatefulWidget {
});
/// Which measurements to load.
- final IntervallStoreManagerLocation rangeType;
+ final IntervalStoreManagerLocation rangeType;
/// The build strategy once the data loaded.
final Widget Function(BuildContext, List<T>) onData;
@@ -33,7 +33,7 @@ class _RepositoryBuilderState<T, R extends Repository<T>> extends State<Reposito
}
@override
- Widget build(BuildContext context) => Consumer<IntervallStoreManager>(
+ Widget build(BuildContext context) => Consumer<IntervalStoreManager>(
builder: (context, intervallManager, child) {
final range = intervallManager.get(widget.rangeType).currentRange;
return StreamBuilder(
app/lib/features/settings/delete_data_screen.dart
@@ -40,7 +40,7 @@ class _DeleteDataScreenState extends State<DeleteDataScreen> {
context.read<ExportSettings>().reset();
context.read<CsvExportSettings>().reset();
context.read<PdfExportSettings>().reset();
- context.read<IntervallStoreManager>().reset();
+ context.read<IntervalStoreManager>().reset();
context.read<ExportColumnsManager>().reset();
messanger.showSnackBar(SnackBar(
content: Text(localizations.deletionConfirmed),
app/lib/features/settings/export_import_screen.dart
@@ -43,7 +43,7 @@ class ExportImportScreen extends StatelessWidget {
),
Disabled(
disabled: settings.exportFormat == ExportFormat.db,
- child: const IntervalPicker(type: IntervallStoreManagerLocation.exportPage,),
+ child: const IntervalPicker(type: IntervalStoreManagerLocation.exportPage,),
),
ListTile(
title: Text(localizations.exportDir),
app/lib/model/storage/db/config_dao.dart
@@ -3,7 +3,7 @@ import 'package:blood_pressure_app/model/storage/export_columns_store.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/interval_store.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
import 'package:sqflite/sqflite.dart';
@@ -229,9 +229,9 @@ class ConfigDao {
);
}
- final Map<(int, int), IntervallStorage> _intervallStorageInstances = {};
+ final Map<(int, int), IntervalStorage> _intervallStorageInstances = {};
- /// Loads a [IntervallStorage] object of a [profileID] from the database.
+ /// Loads a [IntervalStorage] object of a [profileID] from the database.
///
/// The [storageID] allows for associating multiple intervalls with one profile.
///
@@ -241,21 +241,21 @@ class ConfigDao {
/// Changes to the database will not propagate to the object.
///
/// This should not be invoked directly in order to centralise [storageID] allocation. Currently this is done by
- /// the [IntervallStoreManager] class.
- Future<IntervallStorage> loadIntervallStorage(int profileID, int storageID) async {
+ /// the [IntervalStoreManager] class.
+ Future<IntervalStorage> loadIntervalStorage(int profileID, int storageID) async {
if (_intervallStorageInstances.containsKey((profileID, storageID))) return _intervallStorageInstances[(profileID, storageID)]!;
final dbEntry = await _configDB.database.query(
- ConfigDB.selectedIntervallStorageTable,
+ ConfigDB.selectedIntervalStorageTable,
columns: ['stepSize', 'start', 'end'],
where: 'profile_id = ? AND storage_id = ?',
whereArgs: [profileID, storageID],
);
- late final IntervallStorage intervallStorage;
+ late final IntervalStorage intervallStorage;
if (dbEntry.isEmpty) {
- intervallStorage = IntervallStorage();
+ intervallStorage = IntervalStorage();
} else {
assert(dbEntry.length == 1, 'Keys should ensure only one entry is possible.');
- intervallStorage = IntervallStorage.fromMap(dbEntry.first);
+ intervallStorage = IntervalStorage.fromMap(dbEntry.first);
}
_updateIntervallStorage(profileID, storageID, intervallStorage);
@@ -266,10 +266,10 @@ class ConfigDao {
return intervallStorage;
}
- /// Update specific [IntervallStorage] for a profile in the database.
+ /// Update specific [IntervalStorage] for a profile in the database.
///
/// Adds an entry if necessary.
- Future<void> _updateIntervallStorage(int profileID, int storageID, IntervallStorage intervallStorage) async {
+ Future<void> _updateIntervallStorage(int profileID, int storageID, IntervalStorage intervallStorage) async {
if (!_configDB.database.isOpen) return;
final Map<String, dynamic> columnValueMap = {
'profile_id': profileID,
@@ -277,7 +277,7 @@ class ConfigDao {
};
columnValueMap.addAll(intervallStorage.toMap());
await _configDB.database.insert(
- ConfigDB.selectedIntervallStorageTable,
+ ConfigDB.selectedIntervalStorageTable,
columnValueMap,
conflictAlgorithm: ConflictAlgorithm.replace,
);
app/lib/model/storage/db/config_db.dart
@@ -58,7 +58,7 @@ class ConfigDB {
/// Name of the table for storing time intervals to display.
///
- /// It is used to store json representations of [IntervallStorage] objects. Data is saved as fields, to save space
+ /// It is used to store json representations of [IntervalStorage] objects. Data is saved as fields, to save space
/// on the disk and because no changes in the data format are expected. The field names are made to match the variable
/// names in the class.
///
@@ -67,8 +67,8 @@ class ConfigDB {
///
/// Format: `CREATE TABLE selectedIntervallStorage(profile_id INTEGER, storage_id INTEGER, stepSize INTEGER,`
/// ` start INTEGER, end INTEGER, PRIMARY KEY(profile_id, storage_id))`
- static const String selectedIntervallStorageTable = 'selectedIntervallStorage';
- static const String _selectedIntervallStorageCreationString = 'CREATE TABLE selectedIntervallStorage(profile_id '
+ static const String selectedIntervalStorageTable = 'selectedIntervallStorage';
+ static const String _selectedIntervalStorageCreationString = 'CREATE TABLE selectedIntervallStorage(profile_id '
'INTEGER, storage_id INTEGER, stepSize INTEGER, start INTEGER, end INTEGER, '
'PRIMARY KEY(profile_id, storage_id))';
@@ -116,7 +116,7 @@ class ConfigDB {
await db.execute(_exportSettingsTableCreationString);
await db.execute(_exportCsvSettingsTableCreationString);
await db.execute(_exportPdfSettingsTableCreationString);
- await db.execute(_selectedIntervallStorageCreationString);
+ await db.execute(_selectedIntervalStorageCreationString);
await db.execute(_exportColumnsTableCreationString);
}
@@ -129,7 +129,7 @@ class ConfigDB {
await db.execute(_exportSettingsTableCreationString);
await db.execute(_exportCsvSettingsTableCreationString);
await db.execute(_exportPdfSettingsTableCreationString);
- await db.execute(_selectedIntervallStorageCreationString);
+ await db.execute(_selectedIntervalStorageCreationString);
await db.execute(_exportColumnsTableCreationString);
await db.database.setVersion(2);
} else if (oldVersion == 2) {
app/lib/model/storage/intervall_store.dart → app/lib/model/storage/interval_store.dart
@@ -7,24 +7,24 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:health_data_store/health_data_store.dart';
/// Class for storing the current interval, as it is needed in start page, statistics and export.
-class IntervallStorage extends ChangeNotifier {
+class IntervalStorage extends ChangeNotifier {
/// Create a instance from a map created by [toMap].
- factory IntervallStorage.fromMap(Map<String, dynamic> map) => IntervallStorage(
+ factory IntervalStorage.fromMap(Map<String, dynamic> map) => IntervalStorage(
stepSize: TimeStep.deserialize(map['stepSize']),
range: ConvertUtil.parseRange(map['start'], map['end']),
);
/// Create a instance from a [String] created by [toJson].
- factory IntervallStorage.fromJson(String json) {
+ factory IntervalStorage.fromJson(String json) {
try {
- return IntervallStorage.fromMap(jsonDecode(json));
+ return IntervalStorage.fromMap(jsonDecode(json));
} catch (exception) {
- return IntervallStorage();
+ return IntervalStorage();
}
}
/// Create a storage to interact with a display intervall.
- IntervallStorage({TimeStep? stepSize, DateRange? range}) :
+ IntervalStorage({TimeStep? stepSize, DateRange? range}) :
_stepSize = stepSize ?? TimeStep.last7Days {
_currentRange = range ?? _getMostRecentDisplayIntervall();
}
@@ -49,7 +49,7 @@ class IntervallStorage extends ChangeNotifier {
/// sets the stepSize to the new value and resets the currentRange to the most recent one.
void changeStepSize(TimeStep value) {
_stepSize = value;
- setToMostRecentIntervall();
+ setToMostRecentInterval();
}
DateRange get currentRange => _currentRange;
@@ -60,7 +60,7 @@ class IntervallStorage extends ChangeNotifier {
}
/// Sets internal _currentRange to the most recent intervall and notifies listeners.
- void setToMostRecentIntervall() {
+ void setToMostRecentInterval() {
_currentRange = _getMostRecentDisplayIntervall();
notifyListeners();
}
@@ -192,51 +192,46 @@ enum TimeStep {
}
/// Class that stores the interval objects that are needed in the app and provides named access to them.
-class IntervallStoreManager extends ChangeNotifier {
- /// Constructor for creating [IntervallStoreManager] from items.
+class IntervalStoreManager extends ChangeNotifier {
+ /// Constructor for creating [IntervalStoreManager] from items.
///
- /// Consider using [IntervallStoreManager.load] for loading [IntervallStorage] objects from the database, as it
+ /// Consider using [IntervalStoreManager.load] for loading [IntervalStorage] objects from the database, as it
/// automatically uses the correct storage ids.
- IntervallStoreManager(this.mainPage, this.exportPage, this.statsPage) {
+ IntervalStoreManager(this.mainPage, this.exportPage, this.statsPage) {
mainPage.addListener(notifyListeners);
exportPage.addListener(notifyListeners);
statsPage.addListener(notifyListeners);
}
- static Future<IntervallStoreManager> load(ConfigDao configDao, int profileID) async =>
- IntervallStoreManager(
- await configDao.loadIntervallStorage(profileID, 0),
- await configDao.loadIntervallStorage(profileID, 1),
- await configDao.loadIntervallStorage(profileID, 2),
+ static Future<IntervalStoreManager> load(ConfigDao configDao, int profileID) async =>
+ IntervalStoreManager(
+ await configDao.loadIntervalStorage(profileID, 0),
+ await configDao.loadIntervalStorage(profileID, 1),
+ await configDao.loadIntervalStorage(profileID, 2),
);
- IntervallStorage get(IntervallStoreManagerLocation type) {
- switch (type) {
- case IntervallStoreManagerLocation.mainPage:
- return mainPage;
- case IntervallStoreManagerLocation.exportPage:
- return exportPage;
- case IntervallStoreManagerLocation.statsPage:
- return statsPage;
- }
- }
+ IntervalStorage get(IntervalStoreManagerLocation type) => switch (type) {
+ IntervalStoreManagerLocation.mainPage => mainPage,
+ IntervalStoreManagerLocation.exportPage => exportPage,
+ IntervalStoreManagerLocation.statsPage => statsPage,
+ };
/// Reset all fields to their default values.
void reset() {
- mainPage = IntervallStorage();
- exportPage = IntervallStorage();
- statsPage = IntervallStorage();
+ mainPage = IntervalStorage();
+ exportPage = IntervalStorage();
+ statsPage = IntervalStorage();
notifyListeners();
}
/// Intervall for the page with graph and list.
- IntervallStorage mainPage;
+ IntervalStorage mainPage;
/// Intervall for all exports.
- IntervallStorage exportPage;
+ IntervalStorage exportPage;
/// Intervall to display statistics in.
- IntervallStorage statsPage;
+ IntervalStorage statsPage;
@override
void dispose() {
@@ -247,8 +242,8 @@ class IntervallStoreManager extends ChangeNotifier {
}
}
-/// Locations supported by [IntervallStoreManager].
-enum IntervallStoreManagerLocation {
+/// Locations supported by [IntervalStoreManager].
+enum IntervalStoreManagerLocation {
mainPage,
exportPage,
statsPage,
app/lib/model/storage/storage.dart
@@ -21,6 +21,6 @@ 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 'interval_store.dart';
export 'settings_store.dart';
export 'update_legacy_settings.dart';
app/lib/model/storage/update_legacy_settings.dart
@@ -10,7 +10,7 @@ import 'package:blood_pressure_app/model/storage/export_columns_store.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/interval_store.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
@@ -19,7 +19,7 @@ import 'package:sqflite/sqflite.dart';
/// Function for upgrading shared preferences from pre 1.5.4 (Oct 23) versions.
Future<void> updateLegacySettings(Settings settings, ExportSettings exportSettings, CsvExportSettings csvExportSettings,
- PdfExportSettings pdfExportSettings, IntervallStoreManager intervallStoreManager,) async {
+ PdfExportSettings pdfExportSettings, IntervalStoreManager intervallStoreManager,) async {
final SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
final List<Future> futures = [];
app/lib/screens/home_screen.dart
@@ -7,7 +7,7 @@ import 'package:blood_pressure_app/data_util/repository_builder.dart';
import 'package:blood_pressure_app/features/measurement_list/compact_measurement_list.dart';
import 'package:blood_pressure_app/features/measurement_list/measurement_list.dart';
import 'package:blood_pressure_app/features/statistics/value_graph.dart';
-import 'package:blood_pressure_app/model/storage/intervall_store.dart';
+import 'package:blood_pressure_app/model/storage/interval_store.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
import 'package:blood_pressure_app/screens/settings_screen.dart';
import 'package:blood_pressure_app/screens/statistics_screen.dart';
@@ -36,11 +36,11 @@ class AppHome extends StatelessWidget {
width: MediaQuery.of(context).size.width,
// TODO: stop duplicating this complex construct
child: RepositoryBuilder<MedicineIntake, MedicineIntakeRepository>(
- rangeType: IntervallStoreManagerLocation.mainPage,
+ rangeType: IntervalStoreManagerLocation.mainPage,
onData: (context, List<MedicineIntake> intakes) => RepositoryBuilder<Note, NoteRepository>(
- rangeType: IntervallStoreManagerLocation.mainPage,
+ rangeType: IntervalStoreManagerLocation.mainPage,
onData: (context, List<Note> notes) => BloodPressureBuilder(
- rangeType: IntervallStoreManagerLocation.mainPage,
+ rangeType: IntervalStoreManagerLocation.mainPage,
onData: (BuildContext context, UnmodifiableListView<BloodPressureRecord> records) => BloodPressureValueGraph(
records: records,
colors: notes,
@@ -50,7 +50,7 @@ class AppHome extends StatelessWidget {
),
),
),
- const IntervalPicker(type: IntervallStoreManagerLocation.mainPage),
+ const IntervalPicker(type: IntervalStoreManagerLocation.mainPage),
],
),
);
@@ -73,16 +73,16 @@ class AppHome extends StatelessWidget {
return Center(
child: Padding(
padding: const EdgeInsets.only(top: 20),
- child: Consumer<IntervallStoreManager>(builder: (context, intervalls, child) =>
+ child: Consumer<IntervalStoreManager>(builder: (context, intervalls, child) =>
Column(children: [
_buildValueGraph(context),
Expanded(
child: BloodPressureBuilder(
- rangeType: IntervallStoreManagerLocation.mainPage,
+ rangeType: IntervalStoreManagerLocation.mainPage,
onData: (context, records) => RepositoryBuilder<MedicineIntake, MedicineIntakeRepository>(
- rangeType: IntervallStoreManagerLocation.mainPage,
+ rangeType: IntervalStoreManagerLocation.mainPage,
onData: (BuildContext context, List<MedicineIntake> intakes) => RepositoryBuilder<Note, NoteRepository>(
- rangeType: IntervallStoreManagerLocation.mainPage,
+ rangeType: IntervalStoreManagerLocation.mainPage,
onData: (BuildContext context, List<Note> notes) {
final entries = FullEntryList.merged(records, notes, intakes);
entries.sort((a, b) => b.time.compareTo(a.time)); // newest first
app/lib/screens/statistics_screen.dart
@@ -2,7 +2,7 @@ import 'package:blood_pressure_app/data_util/blood_pressure_builder.dart';
import 'package:blood_pressure_app/data_util/interval_picker.dart';
import 'package:blood_pressure_app/features/statistics/blood_pressure_distribution.dart';
import 'package:blood_pressure_app/model/blood_pressure_analyzer.dart';
-import 'package:blood_pressure_app/model/storage/intervall_store.dart';
+import 'package:blood_pressure_app/model/storage/interval_store.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
@@ -27,7 +27,7 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
title: Text(localizations.statistics),
),
body: BloodPressureBuilder(
- rangeType: IntervallStoreManagerLocation.statsPage,
+ rangeType: IntervalStoreManagerLocation.statsPage,
onData: (context, data) {
final analyzer = BloodPressureAnalyser(data.toList());
return ListView(
@@ -120,7 +120,7 @@ class _StatisticsScreenState extends State<StatisticsScreen> {
bottomNavigationBar: Container(
height: 70,
margin: const EdgeInsets.only(top: 15, bottom: 5),
- child: const IntervalPicker(type: IntervallStoreManagerLocation.statsPage,),
+ child: const IntervalPicker(type: IntervalStoreManagerLocation.statsPage,),
),
);
}
app/lib/app.dart
@@ -45,7 +45,7 @@ class _AppState extends State<App> {
ExportSettings? _exportSettings;
CsvExportSettings? _csvExportSettings;
PdfExportSettings? _pdfExportSettings;
- IntervallStoreManager? _intervallStorageManager;
+ IntervalStoreManager? _intervalStorageManager;
ExportColumnsManager? _exportColumnsManager;
@override
@@ -58,7 +58,7 @@ class _AppState extends State<App> {
_exportSettings?.dispose();
_csvExportSettings?.dispose();
_pdfExportSettings?.dispose();
- _intervallStorageManager?.dispose();
+ _intervalStorageManager?.dispose();
_exportColumnsManager?.dispose();
super.dispose();
}
@@ -94,7 +94,7 @@ class _AppState extends State<App> {
_exportSettings ??= await configDao.loadExportSettings(0);
_csvExportSettings ??= await configDao.loadCsvExportSettings(0);
_pdfExportSettings ??= await configDao.loadPdfExportSettings(0);
- _intervallStorageManager ??= await IntervallStoreManager.load(configDao, 0);
+ _intervalStorageManager ??= await IntervalStoreManager.load(configDao, 0);
_exportColumnsManager ??= await configDao.loadExportColumnsManager(0);
} catch (e, stack) {
await ErrorReporting.reportCriticalError('Error loading config db', '$e\n$stack',);
@@ -129,7 +129,7 @@ class _AppState extends State<App> {
// update logic
if (_settings!.lastVersion == 0) {
- await updateLegacySettings(_settings!, _exportSettings!, _csvExportSettings!, _pdfExportSettings!, _intervallStorageManager!);
+ await updateLegacySettings(_settings!, _exportSettings!, _csvExportSettings!, _pdfExportSettings!, _intervalStorageManager!);
await updateLegacyExport(_configDB!, _exportColumnsManager!);
_settings!.lastVersion = 30;
@@ -151,8 +151,8 @@ class _AppState extends State<App> {
_settings!.lastVersion = int.parse((await PackageInfo.fromPlatform()).buildNumber);
- // Reset the step size intervall to current on startup
- _intervallStorageManager!.mainPage.setToMostRecentIntervall();
+ // Reset the step size interval to current on startup
+ _intervalStorageManager!.mainPage.setToMostRecentInterval();
} catch (e, stack) {
await ErrorReporting.reportCriticalError('Error performing upgrades:', '$e\n$stack',);
}
@@ -170,7 +170,7 @@ class _AppState extends State<App> {
ChangeNotifierProvider.value(value: _exportSettings!),
ChangeNotifierProvider.value(value: _csvExportSettings!),
ChangeNotifierProvider.value(value: _pdfExportSettings!),
- ChangeNotifierProvider.value(value: _intervallStorageManager!),
+ ChangeNotifierProvider.value(value: _intervalStorageManager!),
ChangeNotifierProvider.value(value: _exportColumnsManager!),
],
child: _buildAppRoot(),
app/test/data_util/interval_picker_test.dart
@@ -1,5 +1,5 @@
import 'package:blood_pressure_app/data_util/interval_picker.dart';
-import 'package:blood_pressure_app/model/storage/intervall_store.dart';
+import 'package:blood_pressure_app/model/storage/interval_store.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -11,8 +11,8 @@ import '../util.dart';
void main() {
testWidgets('shows controls and dropdown', (tester) async {
await tester.pumpWidget(materialApp(ChangeNotifierProvider(
- create: (_) => IntervallStoreManager(IntervallStorage(),IntervallStorage(),IntervallStorage()),
- child: IntervalPicker(type: IntervallStoreManagerLocation.mainPage)
+ create: (_) => IntervalStoreManager(IntervalStorage(),IntervalStorage(),IntervalStorage()),
+ child: IntervalPicker(type: IntervalStoreManagerLocation.mainPage)
)));
expect(find.byType(DropdownButton<TimeStep>), findsOneWidget);
expect(find.byIcon(Icons.chevron_left), findsOneWidget);
@@ -23,13 +23,13 @@ void main() {
);
});
testWidgets('shows custom intervall start and end', (tester) async {
- final s = IntervallStoreManager(IntervallStorage(),IntervallStorage(),IntervallStorage());
+ final s = IntervalStoreManager(IntervalStorage(),IntervalStorage(),IntervalStorage());
s.mainPage.changeStepSize(TimeStep.custom);
s.mainPage.currentRange = DateRange(start: DateTime(2000), end: DateTime(2001));
await tester.pumpWidget(materialApp(ChangeNotifierProvider.value(
value: s,
- child: IntervalPicker(type: IntervallStoreManagerLocation.mainPage)
+ child: IntervalPicker(type: IntervalStoreManagerLocation.mainPage)
)));
final localizations = await AppLocalizations.delegate.load(const Locale('en'));
@@ -37,12 +37,12 @@ void main() {
expect(find.text(localizations.custom), findsOneWidget);
});
testWidgets('allows switching interval', (tester) async {
- final s = IntervallStoreManager(IntervallStorage(),IntervallStorage(),IntervallStorage());
+ final s = IntervalStoreManager(IntervalStorage(),IntervalStorage(),IntervalStorage());
s.mainPage.changeStepSize(TimeStep.last7Days);
await tester.pumpWidget(materialApp(ChangeNotifierProvider.value(
value: s,
- child: IntervalPicker(type: IntervallStoreManagerLocation.mainPage)
+ child: IntervalPicker(type: IntervalStoreManagerLocation.mainPage)
)));
final localizations = await AppLocalizations.delegate.load(const Locale('en'));
app/test/features/statistics/statistics_test.dart
@@ -1,7 +1,7 @@
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/interval_store.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
import 'package:blood_pressure_app/screens/statistics_screen.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -73,7 +73,7 @@ Future<void> _initStatsPage(WidgetTester tester, List<BloodPressureRecord> recor
ExportSettings? exportSettings,
CsvExportSettings? csvExportSettings,
PdfExportSettings? pdfExportSettings,
- IntervallStoreManager? intervallStoreManager,
+ IntervalStoreManager? intervallStoreManager,
}) async {
await tester.pumpWidget(await appBaseWithData(const StatisticsScreen(),
records: records,
app/test/model/config_db_test.dart
@@ -4,7 +4,7 @@ import 'package:blood_pressure_app/model/storage/export_columns_store.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/interval_store.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -31,7 +31,7 @@ void main() {
expect(tableNames.contains(ConfigDB.exportSettingsTable), true);
expect(tableNames.contains(ConfigDB.exportCsvSettingsTable), true);
expect(tableNames.contains(ConfigDB.exportPdfSettingsTable), true);
- expect(tableNames.contains(ConfigDB.selectedIntervallStorageTable), true);
+ expect(tableNames.contains(ConfigDB.selectedIntervalStorageTable), true);
expect(tableNames.contains(ConfigDB.exportColumnsTable), true);
});
test('should save and load table entries', () async {
@@ -62,7 +62,7 @@ void main() {
expect((await dao.loadExportSettings(0)).toJson(), ExportSettings().toJson());
expect((await dao.loadCsvExportSettings(0)).toJson(), CsvExportSettings().toJson());
expect((await dao.loadPdfExportSettings(0)).toJson(), PdfExportSettings().toJson());
- expect((await dao.loadIntervallStorage(0,0)).stepSize, IntervallStorage().stepSize);
+ expect((await dao.loadIntervalStorage(0,0)).stepSize, IntervalStorage().stepSize);
expect((await dao.loadExportColumnsManager(0)).userColumns, ExportColumnsManager().userColumns);
});
test('should save changes', () async {
app/test/model/intervall_store_test.dart
@@ -1,11 +1,11 @@
-import 'package:blood_pressure_app/model/storage/intervall_store.dart';
+import 'package:blood_pressure_app/model/storage/interval_store.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:health_data_store/health_data_store.dart';
void main() {
test('base constructor should initialize with values', () {
- final storageObject = IntervallStorage(stepSize: TimeStep.month, range: DateRange(
+ final storageObject = IntervalStorage(stepSize: TimeStep.month, range: DateRange(
start: DateTime.fromMillisecondsSinceEpoch(1234),
end: DateTime.fromMillisecondsSinceEpoch(5678),
),);
@@ -16,7 +16,7 @@ void main() {
});
test('base constructor should initialize to default without values', () {
- final storageObject = IntervallStorage();
+ final storageObject = IntervalStorage();
expect(storageObject.stepSize, TimeStep.last7Days);
expect(storageObject.currentRange.start.millisecondsSinceEpoch, lessThanOrEqualTo(DateTime
.now()
@@ -25,8 +25,8 @@ void main() {
test('base constructor should initialize with only incomplete parameters', () {
// only tests for no crashes
- IntervallStorage(stepSize: TimeStep.last30Days);
- IntervallStorage(range: DateRange(
+ IntervalStorage(stepSize: TimeStep.last30Days);
+ IntervalStorage(range: DateRange(
start: DateTime.fromMillisecondsSinceEpoch(1234),
end: DateTime.fromMillisecondsSinceEpoch(5678),
),);
@@ -34,12 +34,12 @@ void main() {
test('intervall lengths should match step size', () {
- final dayIntervall = IntervallStorage(stepSize: TimeStep.day);
- final weekIntervall = IntervallStorage(stepSize: TimeStep.week);
- final monthIntervall = IntervallStorage(stepSize: TimeStep.month);
- final yearIntervall = IntervallStorage(stepSize: TimeStep.year);
- final last7DaysIntervall = IntervallStorage(stepSize: TimeStep.last7Days);
- final last30DaysIntervall = IntervallStorage(stepSize: TimeStep.last30Days);
+ final dayIntervall = IntervalStorage(stepSize: TimeStep.day);
+ final weekIntervall = IntervalStorage(stepSize: TimeStep.week);
+ final monthIntervall = IntervalStorage(stepSize: TimeStep.month);
+ final yearIntervall = IntervalStorage(stepSize: TimeStep.year);
+ final last7DaysIntervall = IntervalStorage(stepSize: TimeStep.last7Days);
+ final last30DaysIntervall = IntervalStorage(stepSize: TimeStep.last30Days);
expect(dayIntervall.currentRange.duration.inHours, 24);
expect(weekIntervall.currentRange.duration.inDays, 7);
@@ -50,13 +50,13 @@ void main() {
});
test('intervall lengths should still be correct after moving', () {
- final dayIntervall = IntervallStorage(stepSize: TimeStep.day);
- final weekIntervall = IntervallStorage(stepSize: TimeStep.week);
- final monthIntervall = IntervallStorage(stepSize: TimeStep.month);
- final yearIntervall = IntervallStorage(stepSize: TimeStep.year);
- final last7DaysIntervall = IntervallStorage(stepSize: TimeStep.last7Days);
- final last30DaysIntervall = IntervallStorage(stepSize: TimeStep.last30Days);
- final customIntervall = IntervallStorage(stepSize: TimeStep.custom, range: DateRange(
+ final dayIntervall = IntervalStorage(stepSize: TimeStep.day);
+ final weekIntervall = IntervalStorage(stepSize: TimeStep.week);
+ final monthIntervall = IntervalStorage(stepSize: TimeStep.month);
+ final yearIntervall = IntervalStorage(stepSize: TimeStep.year);
+ final last7DaysIntervall = IntervalStorage(stepSize: TimeStep.last7Days);
+ final last30DaysIntervall = IntervalStorage(stepSize: TimeStep.last30Days);
+ final customIntervall = IntervalStorage(stepSize: TimeStep.custom, range: DateRange(
start: DateTime.fromMillisecondsSinceEpoch(1234),
end: DateTime.fromMillisecondsSinceEpoch(1234 + 24 * 60 * 60 * 1000), // one day
),);
app/test/model/json_serialization_test.dart
@@ -6,7 +6,7 @@ import 'package:blood_pressure_app/model/storage/export_columns_store.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/interval_store.dart';
import 'package:blood_pressure_app/model/storage/settings_store.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -15,15 +15,15 @@ import 'package:health_data_store/health_data_store.dart';
void main() {
group('IntervallStorage', () {
test('should create json without error', () {
- final intervall = IntervallStorage(stepSize: TimeStep.year);
+ final intervall = IntervalStorage(stepSize: TimeStep.year);
final json = intervall.toJson();
expect(json.length, greaterThan(0));
});
test('should load same data from json', () {
- final initialData = IntervallStorage();
+ final initialData = IntervalStorage();
final json = initialData.toJson();
- final recreatedData = IntervallStorage.fromJson(json);
+ final recreatedData = IntervalStorage.fromJson(json);
expect(initialData.stepSize, recreatedData.stepSize);
expect(initialData.currentRange.start.millisecondsSinceEpoch,
@@ -33,12 +33,12 @@ void main() {
});
test('should load same data from json in edge cases', () {
- final initialData = IntervallStorage(stepSize: TimeStep.month, range: DateRange(
+ final initialData = IntervalStorage(stepSize: TimeStep.month, range: DateRange(
start: DateTime.fromMillisecondsSinceEpoch(1234),
end: DateTime.fromMillisecondsSinceEpoch(5678),
),);
final json = initialData.toJson();
- final recreatedData = IntervallStorage.fromJson(json);
+ final recreatedData = IntervalStorage.fromJson(json);
expect(initialData.stepSize, TimeStep.month);
expect(recreatedData.currentRange.start.millisecondsSinceEpoch, 1234);
@@ -46,18 +46,18 @@ void main() {
});
test('should not crash when parsing incorrect json', () {
- IntervallStorage.fromJson('banana');
- IntervallStorage.fromJson('{"stepSize" = 1}');
- IntervallStorage.fromJson('{"stepSize": 1');
- IntervallStorage.fromJson('{stepSize: 1}');
- IntervallStorage.fromJson('green{stepSize: 1}');
+ IntervalStorage.fromJson('banana');
+ IntervalStorage.fromJson('{"stepSize" = 1}');
+ IntervalStorage.fromJson('{"stepSize": 1');
+ IntervalStorage.fromJson('{stepSize: 1}');
+ IntervalStorage.fromJson('green{stepSize: 1}');
});
test('should not crash when parsing invalid values and ignore them', () {
- final v1 = IntervallStorage.fromJson('{"stepSize": true}');
- final v2 = IntervallStorage.fromJson('{"stepSize": "month"}');
- final v3 = IntervallStorage.fromJson('{"start": "month", "end": 10.5}');
- final v4 = IntervallStorage.fromJson('{"start": 18.6, "end": 90.65}');
+ final v1 = IntervalStorage.fromJson('{"stepSize": true}');
+ final v2 = IntervalStorage.fromJson('{"stepSize": "month"}');
+ final v3 = IntervalStorage.fromJson('{"start": "month", "end": 10.5}');
+ final v4 = IntervalStorage.fromJson('{"start": 18.6, "end": 90.65}');
expect(v1.stepSize, TimeStep.last7Days);
expect(v2.stepSize, TimeStep.last7Days);
app/test/util.dart
@@ -15,13 +15,13 @@ Widget materialApp(Widget child, {
ExportSettings? exportSettings,
CsvExportSettings? csvExportSettings,
PdfExportSettings? pdfExportSettings,
- IntervallStoreManager? intervallStoreManager,
+ IntervalStoreManager? intervallStoreManager,
}) {
settings ??= Settings();
exportSettings ??= ExportSettings();
csvExportSettings ??= CsvExportSettings();
pdfExportSettings ??= PdfExportSettings();
- intervallStoreManager ??= IntervallStoreManager(IntervallStorage(), IntervallStorage(), IntervallStorage());
+ intervallStoreManager ??= IntervalStoreManager(IntervalStorage(), IntervalStorage(), IntervalStorage());
return MultiProvider(
providers: [
ChangeNotifierProvider.value(value: settings),
@@ -44,7 +44,7 @@ Future<Widget> appBase(Widget child, {
ExportSettings? exportSettings,
CsvExportSettings? csvExportSettings,
PdfExportSettings? pdfExportSettings,
- IntervallStoreManager? intervallStoreManager,
+ IntervalStoreManager? intervallStoreManager,
BloodPressureRepository? bpRepo,
MedicineRepository? medRepo,
MedicineIntakeRepository? intakeRepo,
@@ -76,7 +76,7 @@ Future<Widget> appBaseWithData(Widget child, {
ExportSettings? exportSettings,
CsvExportSettings? csvExportSettings,
PdfExportSettings? pdfExportSettings,
- IntervallStoreManager? intervallStoreManager,
+ IntervalStoreManager? intervallStoreManager,
List<BloodPressureRecord>? records,
List<Medicine>? meds,
List<MedicineIntake>? intakes,