save workout when completed
parent
fa8d2f6314
commit
d1600b174e
|
@ -35,13 +35,13 @@ class WorkoutProvider extends ChangeNotifier {
|
|||
|
||||
final List<String> _workoutPhases = [
|
||||
'Warm-Up',
|
||||
/*'High Intensity',
|
||||
'Low Intensity',
|
||||
'High Intensity',
|
||||
'Low Intensity',
|
||||
'High Intensity',
|
||||
'Low Intensity',
|
||||
'High Intensity', */
|
||||
'High Intensity',
|
||||
'Low Intensity',
|
||||
'High Intensity',
|
||||
'Cool-down'
|
||||
];
|
||||
int _workoutPhaseIndex = 0;
|
||||
|
@ -89,7 +89,7 @@ class WorkoutProvider extends ChangeNotifier {
|
|||
isWorkoutComplete = true;
|
||||
_audioPlayer.stop();
|
||||
timerProvider.stopTimer();
|
||||
//notifyListeners();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void saveWorkout() {
|
||||
|
|
|
@ -4,8 +4,8 @@ import 'package:smoke_cess_app/providers/input_provider.dart';
|
|||
import 'package:smoke_cess_app/widgets/slider.dart';
|
||||
|
||||
Future showMotivationPopup(
|
||||
BuildContext context, Function onSave, String title) async {
|
||||
return await showDialog(
|
||||
BuildContext context, Function onSave, String title) {
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ChangeNotifierProvider(
|
||||
|
|
|
@ -20,16 +20,24 @@ class WorkoutTimerWidget extends StatelessWidget {
|
|||
Timer(const Duration(milliseconds: 1), () => workoutProvider.nextPhase());
|
||||
}
|
||||
|
||||
void handleStartStopWorkout() async {
|
||||
if (workoutProvider.isWorkoutComplete) {
|
||||
Timer(
|
||||
const Duration(milliseconds: 1),
|
||||
() => showMotivationPopup(context, (double value) {
|
||||
workoutProvider.motivationAfter = value.toInt();
|
||||
workoutProvider.saveWorkout();
|
||||
}, 'Motivation nach dem Training'));
|
||||
}
|
||||
|
||||
void handleStartStopWorkout() {
|
||||
if (!workoutProvider.isWorkoutStarted) {
|
||||
await showMotivationPopup(
|
||||
context,
|
||||
(double value) => workoutProvider.motivationBefore = value.toInt(),
|
||||
'Motivation vor dem Training');
|
||||
showMotivationPopup(context, (double value) {
|
||||
workoutProvider.motivationBefore = value.toInt();
|
||||
workoutProvider.startWorkout();
|
||||
}, 'Motivation vor dem Training');
|
||||
} else {
|
||||
workoutProvider.stopWorkout();
|
||||
await showMotivationPopup(
|
||||
showMotivationPopup(
|
||||
context,
|
||||
(double value) => workoutProvider.motivationAfter = value.toInt(),
|
||||
'Motivation nach dem Training');
|
||||
|
|
Loading…
Reference in New Issue