diff --git a/lib/main.dart b/lib/main.dart index d94ea15..4e6924d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,11 +2,13 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:smoke_cess_app/pages/main_page.dart'; import 'package:smoke_cess_app/providers/tasks_provider.dart'; +import 'package:smoke_cess_app/providers/timer_provider.dart'; import 'package:smoke_cess_app/services/notification_service.dart'; import 'package:timezone/data/latest.dart' as tz; import 'globals.dart' as globals; import 'providers/page_provider.dart'; import 'providers/settings_provider.dart'; +import 'providers/workout_provider.dart'; void main() { // to ensure all the widgets are initialized. @@ -25,6 +27,7 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { + TimerProvider timerProvider = TimerProvider(); return MaterialApp( title: _title, home: MultiProvider( @@ -37,7 +40,10 @@ class MyApp extends StatelessWidget { ), ChangeNotifierProvider( create: (context) => PageProvider(), - ) + ), + ChangeNotifierProvider(create: (context) => timerProvider), + ChangeNotifierProvider( + create: (context) => WorkoutProvider(timerProvider)), ], child: const MyHomePage(), )); diff --git a/lib/widgets/workout_form.dart b/lib/widgets/workout_form.dart index 980c51a..e06c4c2 100644 --- a/lib/widgets/workout_form.dart +++ b/lib/widgets/workout_form.dart @@ -1,8 +1,4 @@ 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'; @@ -11,23 +7,15 @@ class WorkoutForm extends StatelessWidget { @override Widget build(BuildContext context) { - TimerProvider timerProvider = TimerProvider(); - return MultiProvider( - providers: [ - ChangeNotifierProvider(create: (context) => timerProvider), - ChangeNotifierProvider( - create: (context) => WorkoutProvider(timerProvider)), + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Align( + alignment: Alignment.topLeft, + child: MuteButton(), + ), + WorkoutTimerWidget() ], - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Align( - alignment: Alignment.topLeft, - child: MuteButton(), - ), - WorkoutTimerWidget() - ], - ), ); } }