Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/UI/workout/workout_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -139,7 +140,7 @@ class _WorkoutPageState extends State<WorkoutPage> {
child: Text('Something went wrong'),
);
} else {
if (snapshot.data!.isEmpty) {
if (!widget.isTemplateMode) {
firstLoad = false;
Future<void>.delayed(
Duration.zero,
Expand Down
39 changes: 31 additions & 8 deletions lib/src/feature/calendar/view/calendar_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,28 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget> [
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,
),
),
],
)
],
),
Expand All @@ -68,14 +83,22 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
);
}

void _navigateToWorkoutScreen() {
void _navigateToExerciseScreen() {
Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (BuildContext context) => WorkoutPage(null),
),
);
}

void _navigateToWorkoutScreen() {
Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (BuildContext context) => WorkoutPage(null, isTemplateMode: true),
),
);
}

void _showNoNetworkConnectionSnackBar() =>
ScaffoldMessenger.of(context).showSnackBar(
noNetworkConnectionSnackBar(AppTheme.of(context)),
Expand Down
1 change: 1 addition & 0 deletions lib/src/utils/text_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Texts {

/// Calendar Screen
static const String startNewWorkout = 'Start new workout';
static const String startFromTemplate = 'Start from template';
/// Workout Screen

}