extracted workoutform

main
Kai Mannweiler 2023-03-03 13:44:17 +01:00
parent ccf34c07e8
commit 4b1eb20ca1
4 changed files with 41 additions and 23 deletions

View File

@ -2,31 +2,20 @@ import 'package:flutter/material.dart';
import 'package:provider/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/services/pages_service.dart';
import 'package:smoke_cess_app/widgets/mute_button.dart';
import 'package:smoke_cess_app/widgets/workout_form.dart';
import 'package:smoke_cess_app/widgets/workout_timer_widget.dart';
import 'package:smoke_cess_app/widgets/workout_view.dart';
import '../widgets/view_form_page.dart';
class IntervalTimerPage extends StatelessWidget {
const IntervalTimerPage({super.key});
@override
Widget build(BuildContext context) {
TimerProvider timerProvider = TimerProvider();
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => timerProvider),
ChangeNotifierProvider(
create: (context) => WorkoutProvider(timerProvider)),
],
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Align(
alignment: Alignment.topLeft,
child: MuteButton(),
),
WorkoutTimerWidget()
],
),
);
return const ViewFormPage(
form: WorkoutForm(), view: WorkoutView(), page: Pages.timer);
}
}

View File

@ -20,7 +20,7 @@ class MyHomePageState extends State<MyHomePage> {
bool _isConfigured = false;
void _onItemTapped(int index) {
PageProvider pageProvider = context.watch<PageProvider>();
PageProvider pageProvider = context.read<PageProvider>();
setState(() {
if (_isConfigured) {
pageProvider.showForm = false;

View File

@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/timer_provider.dart';
import '../providers/workout_provider.dart';
import 'mute_button.dart';
import 'workout_timer_widget.dart';
class WorkoutForm extends StatelessWidget {
const WorkoutForm({super.key});
@override
Widget build(BuildContext context) {
TimerProvider timerProvider = TimerProvider();
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => timerProvider),
ChangeNotifierProvider(
create: (context) => WorkoutProvider(timerProvider)),
],
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Align(
alignment: Alignment.topLeft,
child: MuteButton(),
),
WorkoutTimerWidget()
],
),
);
}
}

View File

@ -27,10 +27,6 @@ class WorkoutView extends StatelessWidget {
yValueMapper: (Workout value, _) => value.motivationAfter)
],
),
Column(
children: tasksModel.sleepHistory.map((sleep) {
return Text('${sleep.date}: ${sleep.sleepQualitiyValue}');
}).toList())
],
);
}