Add TaskProvider to Workout

main
Kai Mannweiler 2023-03-02 20:35:20 +01:00
parent 7689de73ac
commit afe481305c
1 changed files with 4 additions and 0 deletions

View File

@ -2,7 +2,9 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:smoke_cess_app/providers/tasks_provider.dart';
import 'package:smoke_cess_app/providers/workout_provider.dart';
import 'package:smoke_cess_app/services/pages_service.dart';
import 'package:smoke_cess_app/widgets/timer_widget.dart';
import '../providers/timer_provider.dart';
@ -15,6 +17,7 @@ class WorkoutTimerWidget extends StatelessWidget {
Widget build(BuildContext context) {
TimerProvider timerProvider = context.watch<TimerProvider>();
WorkoutProvider workoutProvider = context.watch<WorkoutProvider>();
TasksProvider tasksProvider = context.read<TasksProvider>();
if (workoutProvider.isPhaseComplete && !workoutProvider.isWorkoutComplete) {
Timer(const Duration(milliseconds: 1), () => workoutProvider.nextPhase());
@ -26,6 +29,7 @@ class WorkoutTimerWidget extends StatelessWidget {
() => showMotivationPopup(context, (double value) {
workoutProvider.motivationAfter = value.toInt();
workoutProvider.saveWorkout();
tasksProvider.setTaskDone(Pages.timer);
}, 'Motivation nach dem Training'));
}