return slider value after popup
parent
556daa9e90
commit
cd88b483cf
|
@ -1,7 +1,6 @@
|
|||
import 'dart:async';
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:smoke_cess_app/providers/input_provider.dart';
|
||||
import 'package:smoke_cess_app/providers/timer_provider.dart';
|
||||
import 'package:smoke_cess_app/providers/workout_provider.dart';
|
||||
import 'package:smoke_cess_app/widgets/mute_button.dart';
|
||||
|
@ -17,7 +16,7 @@ class IntervalTimerPage extends StatelessWidget {
|
|||
providers: [
|
||||
ChangeNotifierProvider(create: (context) => timerProvider),
|
||||
ChangeNotifierProvider(
|
||||
create: (context) => WorkoutProvider(timerProvider))
|
||||
create: (context) => WorkoutProvider(timerProvider)),
|
||||
],
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:smoke_cess_app/providers/input_provider.dart';
|
||||
import 'package:smoke_cess_app/widgets/slider.dart';
|
||||
import 'package:smoke_cess_app/widgets/text_formfield.dart';
|
||||
|
||||
|
@ -9,18 +11,24 @@ class TimerStartStopPopup extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
InputProvider inputProvider = context.watch<InputProvider>();
|
||||
|
||||
return AlertDialog(
|
||||
title: Text(title),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: MySlider(),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
MyTextFormField('Beschreibe deinen Motivation'),
|
||||
const SizedBox(height: 16),
|
||||
const MyTextFormField('Beschreibe deinen Motivation'),
|
||||
ElevatedButton(
|
||||
onPressed: () =>
|
||||
Navigator.pop(context, inputProvider.sliderValue),
|
||||
child: const Text('Speichern'))
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -5,11 +5,15 @@ import 'package:provider/provider.dart';
|
|||
import 'package:smoke_cess_app/providers/workout_provider.dart';
|
||||
import 'package:smoke_cess_app/widgets/timer_widget.dart';
|
||||
|
||||
import '../providers/input_provider.dart';
|
||||
import '../providers/timer_provider.dart';
|
||||
import 'popup_for_start_and_stop.dart';
|
||||
|
||||
class WorkoutTimerWidget extends StatelessWidget {
|
||||
const WorkoutTimerWidget({super.key});
|
||||
|
||||
void _onStartButtonPressed(BuildContext context) {}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
TimerProvider timerProvider = context.watch<TimerProvider>();
|
||||
|
@ -46,7 +50,21 @@ class WorkoutTimerWidget extends StatelessWidget {
|
|||
),
|
||||
ElevatedButton(
|
||||
onPressed: !workoutProvider.isWorkoutStarted
|
||||
? () => workoutProvider.startWorkout()
|
||||
? () async {
|
||||
double sliderValue = await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ChangeNotifierProvider(
|
||||
create: (context) => InputProvider(),
|
||||
child: const TimerStartStopPopup(
|
||||
title: 'Motivation vor dem Training',
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
print(sliderValue);
|
||||
workoutProvider.startWorkout();
|
||||
}
|
||||
: () => workoutProvider.stopWorkout(),
|
||||
child: Text(timerProvider.started ? 'Stop' : 'Start'))
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue