diff --git a/lib/UI/workout/workout_page.dart b/lib/UI/workout/workout_page.dart index bb52219..7444f1a 100644 --- a/lib/UI/workout/workout_page.dart +++ b/lib/UI/workout/workout_page.dart @@ -17,9 +17,10 @@ import 'package:exerlog/src/widgets/theme/theme_provider.dart'; import 'package:flutter/material.dart'; class WorkoutPage extends StatefulWidget { - WorkoutPage(this.workout, {Key? key}) : super(key: key); + WorkoutPage(this.workout, {Key? key, this.isTemplateMode = false}) : super(key: key); Workout? workout; + bool isTemplateMode; @override _WorkoutPageState createState() => _WorkoutPageState(); @@ -139,7 +140,7 @@ class _WorkoutPageState extends State { child: Text('Something went wrong'), ); } else { - if (snapshot.data!.isEmpty) { + if (!widget.isTemplateMode) { firstLoad = false; Future.delayed( Duration.zero, diff --git a/lib/src/feature/calendar/view/calendar_screen.dart b/lib/src/feature/calendar/view/calendar_screen.dart index 62ba8c1..44f7db1 100644 --- a/lib/src/feature/calendar/view/calendar_screen.dart +++ b/lib/src/feature/calendar/view/calendar_screen.dart @@ -52,13 +52,28 @@ class _CalendarScreenState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ CalendarWidget(), - RaisedGradientButton( - width: context.width * .8, - onPressed: _navigateToWorkoutScreen, - child: Text( - Texts.startNewWorkout.toUpperCase(), - style: buttonTextSmall, - ), + Column( + children: [ + RaisedGradientButton( + width: context.width * .8, + onPressed: _navigateToExerciseScreen, + child: Text( + Texts.startNewWorkout.toUpperCase(), + style: buttonTextSmall, + ), + ), + const SizedBox( + height: 15, + ), + RaisedGradientButton( + width: context.width * .8, + onPressed: _navigateToWorkoutScreen, + child: Text( + Texts.startFromTemplate.toUpperCase(), + style: buttonTextSmall, + ), + ), + ], ) ], ), @@ -68,7 +83,7 @@ class _CalendarScreenState extends ConsumerState { ); } - void _navigateToWorkoutScreen() { + void _navigateToExerciseScreen() { Navigator.of(context).push( MaterialPageRoute( builder: (BuildContext context) => WorkoutPage(null), @@ -76,6 +91,14 @@ class _CalendarScreenState extends ConsumerState { ); } + void _navigateToWorkoutScreen() { + Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => WorkoutPage(null, isTemplateMode: true), + ), + ); + } + void _showNoNetworkConnectionSnackBar() => ScaffoldMessenger.of(context).showSnackBar( noNetworkConnectionSnackBar(AppTheme.of(context)), diff --git a/lib/src/utils/text_constants.dart b/lib/src/utils/text_constants.dart index 799fabc..e3f2523 100644 --- a/lib/src/utils/text_constants.dart +++ b/lib/src/utils/text_constants.dart @@ -5,6 +5,7 @@ class Texts { /// Calendar Screen static const String startNewWorkout = 'Start new workout'; + static const String startFromTemplate = 'Start from template'; /// Workout Screen }