Commit b7dd69f

derdilla <82763757+NobodyForNothing@users.noreply.github.com>
2023-11-08 14:20:11
implement needle pin width setting
Signed-off-by: derdilla <82763757+NobodyForNothing@users.noreply.github.com>
1 parent 240d913
Changed files (3)
lib/components/measurement_graph.dart
@@ -110,7 +110,7 @@ class _LineChartState extends State<_LineChart> {
           _buildRegressionLine(pulSpots),
       ]);
     }
-    bars.addAll(_buildNeedlePins(allRecords, minValue, maxValue));
+    bars.addAll(_buildNeedlePins(allRecords, minValue, maxValue, settings));
     return bars;
   }
 
@@ -150,7 +150,7 @@ class _LineChartState extends State<_LineChart> {
     );
   }
 
-  List<LineChartBarData> _buildNeedlePins(Iterable<BloodPressureRecord> allRecords, int min, int max) {
+  List<LineChartBarData> _buildNeedlePins(Iterable<BloodPressureRecord> allRecords, int min, int max, Settings settings,) {
     final pins = <LineChartBarData>[];
     for (final r in allRecords.where((e) => e.needlePin != null)) {
       pins.add(LineChartBarData(
@@ -158,7 +158,7 @@ class _LineChartState extends State<_LineChart> {
           FlSpot(r.creationTime.millisecondsSinceEpoch.toDouble(), min.toDouble()),
           FlSpot(r.creationTime.millisecondsSinceEpoch.toDouble(), max + 5)
         ],
-        barWidth: 20,
+        barWidth: settings.needlePinBarWidth,
         dotData: const FlDotData(show: false),
         color: r.needlePin!.color.withAlpha(100),
       ));
lib/l10n/app_en.arb
@@ -435,5 +435,9 @@
   "errExportColumnWithThisNameAlreadyExists": "Export column with this name already exists.",
   "@errExportColumnWithThisNameAlreadyExists": {},
   "enterTimeFormatDesc": "A formatter string is a blend of predefined ICU/Skeleton strings and any additional text you''d like to include.\n\n[If you''re curious about the complete list of valid formats, you can find them right here.](screen://TimeFormattingHelp)\n\nJust a friendly reminder, using longer or shorter format Strings won''t magically alter the width of the table columns, which might lead to some awkward line breaks and text not showing.\n\ndefault: \"yy-MM-dd HH:mm\"",
-  "@enterTimeFormatDesc": {}
+  "@enterTimeFormatDesc": {},
+  "needlePinBarWidth": "Color thickness",
+  "@needlePinBarWidth": {},
+  "needlePinBarWidthDesc": "The width of the lines colored entries make on the graph.",
+  "@needlePinBarWidthDesc": {}
 }
lib/screens/settings.dart
@@ -94,6 +94,19 @@ class SettingsPage extends StatelessWidget {
                 value: settings.graphLineThickness,
                 min: 1,
                 max: 5,
+                stepSize: 0.5,
+              ),
+              SliderListTile(
+                key: const Key('needlePinBarWidth'),
+                title: Text(localizations.needlePinBarWidth),
+                subtitle: Text(localizations.needlePinBarWidthDesc),
+                leading: const Icon(Icons.line_weight),
+                onChanged: (double value) {
+                  settings.needlePinBarWidth = value;
+                },
+                value: settings.needlePinBarWidth,
+                min: 1,
+                max: 20,
                 stepSize: 1,
               ),
               SliderListTile(