From 8de13dde557372cf270e55653fdd4207e2331791 Mon Sep 17 00:00:00 2001 From: Oliver Bagge Date: Wed, 13 Mar 2024 19:08:37 +0100 Subject: [PATCH] make more UI changes and remove reset steps button because it is redundant. Steps and timer are resetted when starting a new recording --- .../lib/apps/stepCounter/step_counter.dart | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/open_earable/lib/apps/stepCounter/step_counter.dart b/open_earable/lib/apps/stepCounter/step_counter.dart index d3e92a4..14c9f73 100644 --- a/open_earable/lib/apps/stepCounter/step_counter.dart +++ b/open_earable/lib/apps/stepCounter/step_counter.dart @@ -85,6 +85,7 @@ class _StepCounterState extends State { } else { _startTimer(); setState(() { + _countedSteps = 0; _startStepCount = true; }); } @@ -109,20 +110,7 @@ class _StepCounterState extends State { if (duration.inSeconds != 0) { return (60.0 * steps / duration.inSeconds.toDouble()).toStringAsFixed(2); } - return ""; // Wenn durch 0 geteilt wird - } - - /** - * Setzt den Schrittzähler zurück, falls gerade keine Schritte gezählt werden - */ - void _resetStepCount() { - if (_startStepCount) { - return; - } - setState(() { - _countedSteps = 0; - _duration = Duration.zero; - }); + return "0"; // Wenn durch 0 geteilt wird } /** @@ -296,10 +284,10 @@ class _StepCounterState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Spacer(), - _buildListTile(_formatDuration(_duration), "Stopped Time", 45), - _buildListTile(_countedSteps.toString(), "Counted Steps", 45), + _buildListTile(_formatDuration(_duration), "Stopped Time", 60), + _buildListTile(_countedSteps.toString(), "Counted Steps", 60), _buildListTile(_formatAvgCadence(_countedSteps, _duration), - "Avg. Cadence", 45), + "Avg. Cadence\n(Steps per Minute)", 60), Spacer(), _buildControlButtons(), Spacer(), @@ -318,10 +306,6 @@ class _StepCounterState extends State { onPressed: startStopStepCount, label: _startStepCount ? "Stop Counting" : "Start Counting", ), - _buildButton( - onPressed: _startStepCount ? null : _resetStepCount, - label: "Reset Steps", - ), ], ); } @@ -337,7 +321,7 @@ class _StepCounterState extends State { subtitle: Center( child: Text( trailingText, - style: TextStyle(fontSize: fontSize * 0.6), + style: TextStyle(fontSize: fontSize * 0.5), textAlign: TextAlign.center, )), );