diff --git a/lib/providers/workout_provider.dart b/lib/providers/workout_provider.dart index 73b32f8..4c89b84 100644 --- a/lib/providers/workout_provider.dart +++ b/lib/providers/workout_provider.dart @@ -25,6 +25,7 @@ class WorkoutProvider extends ChangeNotifier { WorkoutProvider(this.timerProvider); + //TODO: outsource all Maps to JSON File! final List _workoutPhases = [ 'Warm-Up', 'High Intensity', @@ -48,6 +49,12 @@ class WorkoutProvider extends ChangeNotifier { 'Low Intensity': AssetSource('workout.mp3'), 'Cool-down': AssetSource('cool_down.mp3') }; + final Map _phaseColors = { + 'Warm-Up': Colors.green, + 'High Intensity': Colors.red, + 'Low Intensity': Colors.orange, + 'Cool-down': Colors.blue + }; int _workoutPhaseIndex = 0; String get currentPhase => _workoutPhases[_workoutPhaseIndex]; @@ -55,6 +62,7 @@ class WorkoutProvider extends ChangeNotifier { _phasesDuration[currentPhase] ?? const Duration(seconds: 0); bool get isPhaseComplete => timerProvider.elapsedSeconds - currentPhaseDuration.inSeconds == 0; + Color get currentPhaseColor => _phaseColors[currentPhase] ?? Colors.blue; void nextPhase() { _audioPlayer.stop(); diff --git a/lib/widgets/workout_timer_widget.dart b/lib/widgets/workout_timer_widget.dart index d789c15..df9fae4 100644 --- a/lib/widgets/workout_timer_widget.dart +++ b/lib/widgets/workout_timer_widget.dart @@ -33,6 +33,7 @@ class WorkoutTimerWidget extends StatelessWidget { height: 100, width: 100, child: CircularProgressIndicator( + color: workoutProvider.currentPhaseColor, value: (workoutProvider.currentPhaseDuration.inSeconds .toDouble() - timerProvider.elapsedSeconds) /