Add TaskProvider to Workout
parent
7689de73ac
commit
afe481305c
|
@ -2,7 +2,9 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.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/providers/workout_provider.dart';
|
||||||
|
import 'package:smoke_cess_app/services/pages_service.dart';
|
||||||
import 'package:smoke_cess_app/widgets/timer_widget.dart';
|
import 'package:smoke_cess_app/widgets/timer_widget.dart';
|
||||||
|
|
||||||
import '../providers/timer_provider.dart';
|
import '../providers/timer_provider.dart';
|
||||||
|
@ -15,6 +17,7 @@ class WorkoutTimerWidget extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
TimerProvider timerProvider = context.watch<TimerProvider>();
|
TimerProvider timerProvider = context.watch<TimerProvider>();
|
||||||
WorkoutProvider workoutProvider = context.watch<WorkoutProvider>();
|
WorkoutProvider workoutProvider = context.watch<WorkoutProvider>();
|
||||||
|
TasksProvider tasksProvider = context.read<TasksProvider>();
|
||||||
|
|
||||||
if (workoutProvider.isPhaseComplete && !workoutProvider.isWorkoutComplete) {
|
if (workoutProvider.isPhaseComplete && !workoutProvider.isWorkoutComplete) {
|
||||||
Timer(const Duration(milliseconds: 1), () => workoutProvider.nextPhase());
|
Timer(const Duration(milliseconds: 1), () => workoutProvider.nextPhase());
|
||||||
|
@ -26,6 +29,7 @@ class WorkoutTimerWidget extends StatelessWidget {
|
||||||
() => showMotivationPopup(context, (double value) {
|
() => showMotivationPopup(context, (double value) {
|
||||||
workoutProvider.motivationAfter = value.toInt();
|
workoutProvider.motivationAfter = value.toInt();
|
||||||
workoutProvider.saveWorkout();
|
workoutProvider.saveWorkout();
|
||||||
|
tasksProvider.setTaskDone(Pages.timer);
|
||||||
}, 'Motivation nach dem Training'));
|
}, 'Motivation nach dem Training'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue