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