From da7c820dbd0f744222207d5c191b06e8ffce2e9e Mon Sep 17 00:00:00 2001 From: Crondung <1922635@stud.hs-mannheim.de> Date: Wed, 1 Mar 2023 12:57:02 +0100 Subject: [PATCH] better positioning, fixed endless workout --- lib/providers/workout_provider.dart | 1 + lib/widgets/workout_timer_widget.dart | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/providers/workout_provider.dart b/lib/providers/workout_provider.dart index f9fc206..73b32f8 100644 --- a/lib/providers/workout_provider.dart +++ b/lib/providers/workout_provider.dart @@ -67,6 +67,7 @@ class WorkoutProvider extends ChangeNotifier { }); } else { _audioPlayer.play(_finishedSoundSource); + stopWorkout(); } } diff --git a/lib/widgets/workout_timer_widget.dart b/lib/widgets/workout_timer_widget.dart index 3eb1368..d789c15 100644 --- a/lib/widgets/workout_timer_widget.dart +++ b/lib/widgets/workout_timer_widget.dart @@ -23,10 +23,26 @@ class WorkoutTimerWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Text(workoutProvider.currentPhase), - CircularProgressIndicator( - value: timerProvider.elapsedSeconds / - workoutProvider.currentPhaseDuration.inSeconds), - TimerWidget(duration: workoutProvider.currentPhaseDuration), + const SizedBox( + height: 20, + ), + Stack( + alignment: Alignment.center, + children: [ + SizedBox( + height: 100, + width: 100, + child: CircularProgressIndicator( + value: (workoutProvider.currentPhaseDuration.inSeconds + .toDouble() - + timerProvider.elapsedSeconds) / + workoutProvider.currentPhaseDuration.inSeconds)), + TimerWidget(duration: workoutProvider.currentPhaseDuration), + ], + ), + const SizedBox( + height: 20, + ), ElevatedButton( onPressed: !workoutProvider.isWorkoutStarted ? () => workoutProvider.startWorkout()