Commit ba4e8ca
Changed files (6)
lib
test
model
lib/l10n/app_en.arb
@@ -419,5 +419,7 @@
"addLine": "Add line",
"@addLine": {},
"useLegacyList": "Use legacy list",
- "@useLegacyList": {}
+ "@useLegacyList": {},
+ "addMeasurement": "Add measurement",
+ "@addMeasurement": {}
}
lib/model/ram_only_implementations.dart
@@ -63,7 +63,6 @@ class RamSettings extends ChangeNotifier implements Settings {
bool _followSystemDarkMode = true;
double _graphLineThickness = 3;
TimeStep _graphStepSize = TimeStep.day;
- double _iconSize = 30;
MaterialColor _pulColor = Colors.pink;
MaterialColor _sysColor = Colors.pink;
int _sysWarn = 120;
@@ -232,15 +231,6 @@ class RamSettings extends ChangeNotifier implements Settings {
notifyListeners();
}
- @override
- double get iconSize => _iconSize;
-
- @override
- set iconSize(double value) {
- _iconSize = value;
- notifyListeners();
- }
-
@override
MaterialColor get pulColor => _pulColor;
lib/model/settings_store.dart
@@ -60,6 +60,9 @@ class Settings extends ChangeNotifier {
await _prefs.setStringList('exportItemsCsv', _prefs.getStringList('exportItems') ?? ExportFields.defaultCsv);
toAwait.add(_prefs.remove('exportItems'));
}
+ if (keys.contains('iconSize')) {
+ toAwait.add(_prefs.remove('iconSize'));
+ }
// reset variables for new version. Necessary for reusing variable names in new version and avoid having unexpected
// breaking values in the preferences
@@ -300,15 +303,6 @@ class Settings extends ChangeNotifier {
notifyListeners();
}
- double get iconSize {
- return _prefs.getInt('iconSize')?.toDouble() ?? 30;
- }
-
- set iconSize(double newSize) {
- _prefs.setInt('iconSize', newSize.toInt());
- notifyListeners();
- }
-
int get sysWarn {
return _prefs.getInt('sysWarn') ?? 120;
}
lib/screens/home.dart
@@ -98,7 +98,8 @@ class AppHome extends StatelessWidget {
dimension: 75,
child: FittedBox(
child: FloatingActionButton(
- tooltip: 'Add measurement', // TODO
+ heroTag: "floatingActionAdd",
+ tooltip: localizations.addMeasurement,
autofocus: true,
onPressed: () {
Navigator.push(
@@ -114,6 +115,7 @@ class AppHome extends StatelessWidget {
height: 10,
),
FloatingActionButton(
+ heroTag: "floatingActionStatistics",
tooltip: localizations.statistics,
backgroundColor: const Color(0xFF6F6F6F),
onPressed: () {
@@ -125,6 +127,7 @@ class AppHome extends StatelessWidget {
height: 10,
),
FloatingActionButton(
+ heroTag: "floatingActionSettings",
tooltip: localizations.settings,
backgroundColor: const Color(0xFF6F6F6F),
child: const Icon(Icons.settings, color: Colors.black),
lib/screens/settings.dart
@@ -90,18 +90,6 @@ class SettingsPage extends StatelessWidget {
settings.language = value;
},
),
- SliderSettingsTile(
- key: const Key('iconSize'),
- title: Text(AppLocalizations.of(context)!.iconSize),
- leading: const Icon(Icons.zoom_in),
- onChanged: (double value) {
- settings.iconSize = value;
- },
- initialValue: settings.iconSize,
- start: 15,
- end: 70,
- stepSize: 5,
- ),
SliderSettingsTile(
key: const Key('graphLineThickness'),
title: Text(AppLocalizations.of(context)!.graphLineThickness),
@@ -332,14 +320,14 @@ class SettingsPage extends StatelessWidget {
title: Text(AppLocalizations.of(context)!.sourceCode),
leading: const Icon(Icons.merge),
onPressed: (context) async {
+ final localizations = AppLocalizations.of(context)!;
+ final scaffoldMessenger = ScaffoldMessenger.of(context);
var url = Uri.parse('https://github.com/NobodyForNothing/blood-pressure-monitor-fl');
if (await canLaunchUrl(url)) {
await launchUrl(url, mode: LaunchMode.externalApplication);
} else {
- if (!context.mounted) return;
- ScaffoldMessenger.of(context).showSnackBar(SnackBar(
- content: Text(AppLocalizations.of(context)!
- .errCantOpenURL('https://github.com/NobodyForNothing/blood-pressure-monitor-fl'))));
+ scaffoldMessenger.showSnackBar(SnackBar(
+ content: Text(localizations.errCantOpenURL(url.toString()))));
}
},
),
test/model/settings_test.dart
@@ -34,7 +34,6 @@ void main() {
expect(s.pulColor.value, 0xFFF44336);
expect(s.allowManualTimeInput, true);
expect(s.dateFormatString, 'yyyy-MM-dd HH:mm');
- expect(s.iconSize, 30);
expect(s.sysWarn, 120);
expect(s.diaWarn, 80);
expect(s.validateInputs, true);
@@ -78,7 +77,6 @@ void main() {
s.pulColor = createMaterialColor(0xFF942DA7);
s.allowManualTimeInput = false;
s.dateFormatString = 'yy:dd @ H:mm.ss';
- s.iconSize = 50;
s.sysWarn = 314;
s.diaWarn = 159;
s.validateInputs = false;
@@ -105,7 +103,6 @@ void main() {
expect(s.diaColor.value, 0xFF942DA6);
expect(s.pulColor.value, 0xFF942DA7);
expect(s.allowManualTimeInput, false);
- expect(s.iconSize, 50);
expect(s.sysWarn, 314);
expect(s.diaWarn, 159);
expect(s.validateInputs, false);
@@ -143,7 +140,6 @@ void main() {
s.pulColor = createMaterialColor(0xFF942DA7);
s.allowManualTimeInput = false;
s.dateFormatString = 'yy:dd @ H:mm.ss';
- s.iconSize = 10;
s.sysWarn = 314;
s.diaWarn = 159;
s.validateInputs = false;
@@ -161,7 +157,7 @@ void main() {
s.allowMissingValues = true;
s.language = const Locale('de');
- expect(i, 28);
+ expect(i, 27);
});
});
@@ -186,7 +182,6 @@ void main() {
expect(s.pulColor.value, 0xFFF44336);
expect(s.allowManualTimeInput, true);
expect(s.dateFormatString, 'yyyy-MM-dd HH:mm');
- expect(s.iconSize, 30);
expect(s.sysWarn, 120);
expect(s.diaWarn, 80);
expect(s.validateInputs, true);
@@ -230,7 +225,6 @@ void main() {
s.pulColor = createMaterialColor(0xFF942DA7);
s.allowManualTimeInput = false;
s.dateFormatString = 'yy:dd @ H:mm.ss';
- s.iconSize = 50;
s.sysWarn = 314;
s.diaWarn = 159;
s.validateInputs = false;
@@ -257,7 +251,6 @@ void main() {
expect(s.diaColor.value, 0xFF942DA6);
expect(s.pulColor.value, 0xFF942DA7);
expect(s.allowManualTimeInput, false);
- expect(s.iconSize, 50);
expect(s.sysWarn, 314);
expect(s.diaWarn, 159);
expect(s.validateInputs, false);
@@ -295,7 +288,6 @@ void main() {
s.pulColor = createMaterialColor(0xFF942DA7);
s.allowManualTimeInput = false;
s.dateFormatString = 'yy:dd @ H:mm.ss';
- s.iconSize = 10;
s.sysWarn = 314;
s.diaWarn = 159;
s.validateInputs = false;
@@ -313,7 +305,7 @@ void main() {
s.allowMissingValues = true;
s.language = const Locale('de');
- expect(i, 28);
+ expect(i, 27);
});
});
}