Skip to content

Commit

Permalink
make more UI changes and remove reset steps button because it is redu…
Browse files Browse the repository at this point in the history
…ndant. Steps and timer are resetted when starting a new recording
  • Loading branch information
o-bagge committed Mar 13, 2024
1 parent 0efd07f commit 8de13dd
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions open_earable/lib/apps/stepCounter/step_counter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class _StepCounterState extends State<StepCounter> {
} else {
_startTimer();
setState(() {
_countedSteps = 0;
_startStepCount = true;
});
}
Expand All @@ -109,20 +110,7 @@ class _StepCounterState extends State<StepCounter> {
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
}

/**
Expand Down Expand Up @@ -296,10 +284,10 @@ class _StepCounterState extends State<StepCounter> {
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(),
Expand All @@ -318,10 +306,6 @@ class _StepCounterState extends State<StepCounter> {
onPressed: startStopStepCount,
label: _startStepCount ? "Stop Counting" : "Start Counting",
),
_buildButton(
onPressed: _startStepCount ? null : _resetStepCount,
label: "Reset Steps",
),
],
);
}
Expand All @@ -337,7 +321,7 @@ class _StepCounterState extends State<StepCounter> {
subtitle: Center(
child: Text(
trailingText,
style: TextStyle(fontSize: fontSize * 0.6),
style: TextStyle(fontSize: fontSize * 0.5),
textAlign: TextAlign.center,
)),
);
Expand Down

0 comments on commit 8de13dd

Please sign in to comment.