wip refactor timer
parent
68033a64a5
commit
02ffb9b2f7
|
@ -1,8 +1,11 @@
|
|||
import 'dart:async';
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:smoke_cess_app/widgets/popup_for_start_and_stop.dart';
|
||||
|
||||
import '../providers/input_provider.dart';
|
||||
|
||||
class IntervalTimerPage extends StatefulWidget {
|
||||
const IntervalTimerPage({Key? key}) : super(key: key);
|
||||
|
||||
|
@ -44,9 +47,11 @@ class _IntervalTimerPageState extends State<IntervalTimerPage> {
|
|||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return const TimerStartStopPopup(
|
||||
return ChangeNotifierProvider(
|
||||
create: (context) => InputProvider(),
|
||||
child: const TimerStartStopPopup(
|
||||
title: 'Motivation vor dem Training',
|
||||
);
|
||||
));
|
||||
},
|
||||
);
|
||||
_isPaused = false;
|
||||
|
@ -161,8 +166,9 @@ class _IntervalTimerPageState extends State<IntervalTimerPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
return Center(
|
||||
child: ChangeNotifierProvider(
|
||||
create: (context) => InputProvider(),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
@ -191,8 +197,9 @@ class _IntervalTimerPageState extends State<IntervalTimerPage> {
|
|||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
_isPaused ? Icons.play_arrow_rounded : Icons.stop_rounded),
|
||||
icon: Icon(_isPaused
|
||||
? Icons.play_arrow_rounded
|
||||
: Icons.stop_rounded),
|
||||
iconSize: 48.0,
|
||||
onPressed: () {
|
||||
if (_isPaused) {
|
||||
|
|
|
@ -1,41 +1,26 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:smoke_cess_app/widgets/slider.dart';
|
||||
import 'package:smoke_cess_app/widgets/submit_form_button.dart';
|
||||
import 'package:smoke_cess_app/widgets/text_formfield.dart';
|
||||
|
||||
class TimerStartStopPopup extends StatefulWidget {
|
||||
class TimerStartStopPopup extends StatelessWidget {
|
||||
final String title;
|
||||
|
||||
const TimerStartStopPopup({Key? key, required this.title}) : super(key: key);
|
||||
|
||||
@override
|
||||
TimerStartStopPopupState createState() => TimerStartStopPopupState();
|
||||
}
|
||||
|
||||
class TimerStartStopPopupState extends State<TimerStartStopPopup> {
|
||||
final MySlider slider = MySlider();
|
||||
|
||||
void submitForm(BuildContext context) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
void onFormFieldSave(String? newValue) => newValue!;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(widget.title),
|
||||
title: Text(title),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: const [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: MySlider(),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(height: 16),
|
||||
MyTextFormField('Beschreibe deinen Motivation'),
|
||||
SubmitFormButton(() => submitForm(context)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue