diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart
index 7b823f23..0d19bd03 100644
--- a/lib/widgets/workouts/gym_mode.dart
+++ b/lib/widgets/workouts/gym_mode.dart
@@ -15,7 +15,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-
import 'dart:async';
import 'package:flutter/material.dart';
@@ -46,11 +45,9 @@ import 'package:wger/widgets/workouts/forms.dart';
class GymMode extends StatefulWidget {
final Day _workoutDay;
late TimeOfDay _start;
-
GymMode(this._workoutDay) {
_start = TimeOfDay.now();
}
-
@override
_GymModeState createState() => _GymModeState();
}
@@ -60,11 +57,9 @@ class _GymModeState extends State {
/// Map with the first (navigation) page for each exercise
Map _exercisePages = new Map();
-
PageController _controller = PageController(
initialPage: 0,
);
-
@override
void dispose() {
_controller.dispose();
@@ -74,12 +69,10 @@ class _GymModeState extends State {
@override
void initState() {
super.initState();
-
// Calculate amount of elements for progress indicator
for (var set in widget._workoutDay.sets) {
_totalElements = _totalElements + set.settingsComputed.length;
}
-
// Calculate the pages for the navigation
//
// This duplicates the code below in the getContent method, but it seems to
@@ -88,8 +81,8 @@ class _GymModeState extends State {
for (var set in widget._workoutDay.sets) {
var firstPage = true;
for (var setting in set.settingsComputed) {
- final exercise = Provider.of(context, listen: false)
- .findById(setting.exerciseId);
+ final exercise =
+ Provider.of(context, listen: false).findById(setting.exerciseId);
if (firstPage) {
_exercisePages[exercise.name] = currentPage;
@@ -108,10 +101,8 @@ class _GymModeState extends State {
// Returns the list of exercise overview, sets and pause pages
List getContent() {
- final exerciseProvider =
- Provider.of(context, listen: false);
- final workoutProvider =
- Provider.of(context, listen: false);
+ final exerciseProvider = Provider.of(context, listen: false);
+ final workoutProvider = Provider.of(context, listen: false);
var currentElement = 1;
List out = [];
@@ -202,10 +193,7 @@ class StartPage extends StatelessWidget {
s.exerciseObj.name,
style: Theme.of(context).textTheme.headline6,
),
- ...set
- .getSmartRepr(s.exerciseObj)
- .map((e) => Text(e))
- .toList(),
+ ...set.getSmartRepr(s.exerciseObj).map((e) => Text(e)).toList(),
SizedBox(height: 15),
],
);
@@ -220,8 +208,7 @@ class StartPage extends StatelessWidget {
ElevatedButton(
child: Text(AppLocalizations.of(context).start),
onPressed: () {
- _controller.nextPage(
- duration: Duration(milliseconds: 200), curve: Curves.bounceIn);
+ _controller.nextPage(duration: Duration(milliseconds: 200), curve: Curves.bounceIn);
},
),
NavigationFooter(
@@ -355,8 +342,7 @@ class _LogPageState extends State {
),
onPressed: () {
try {
- double newValue =
- double.parse(_weightController.text) - (2 * minPlateWeight);
+ double newValue = double.parse(_weightController.text) - (2 * minPlateWeight);
if (newValue > 0) {
setState(() {
widget._log.weight = newValue;
@@ -404,8 +390,7 @@ class _LogPageState extends State {
),
onPressed: () {
try {
- double newValue =
- double.parse(_weightController.text) + (2 * minPlateWeight);
+ double newValue = double.parse(_weightController.text) + (2 * minPlateWeight);
setState(() {
widget._log.weight = newValue;
_weightController.text = newValue.toString();
@@ -476,8 +461,7 @@ class _LogPageState extends State {
// Save the entry on the server
try {
- await Provider.of(context, listen: false)
- .addLog(widget._log);
+ await Provider.of(context, listen: false).addLog(widget._log);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
duration: Duration(seconds: 2), // default is 4
@@ -511,14 +495,11 @@ class _LogPageState extends State {
style: Theme.of(context).textTheme.headline6,
textAlign: TextAlign.center,
),
- ...widget._workoutPlan
- .filterLogsByExercise(widget._exercise, unique: true)
- .map((log) {
+ ...widget._workoutPlan.filterLogsByExercise(widget._exercise, unique: true).map((log) {
return ListTile(
title: Text(log.singleLogRepTextNoNl),
- subtitle: Text(
- DateFormat.yMd(Localizations.localeOf(context).languageCode)
- .format(log.date)),
+ subtitle:
+ Text(DateFormat.yMd(Localizations.localeOf(context).languageCode).format(log.date)),
trailing: Icon(Icons.copy),
onTap: () {
setState(() {
@@ -571,8 +552,7 @@ class _LogPageState extends State {
shape: BoxShape.circle,
),
child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 3),
+ padding: const EdgeInsets.symmetric(horizontal: 3),
child: SizedBox(
height: 35,
width: 35,
@@ -580,8 +560,7 @@ class _LogPageState extends State {
alignment: Alignment.center,
child: Text(
key.toString(),
- style: TextStyle(
- fontWeight: FontWeight.bold),
+ style: TextStyle(fontWeight: FontWeight.bold),
),
),
),
@@ -594,8 +573,7 @@ class _LogPageState extends State {
.toList()
],
)
- : MutedText(
- AppLocalizations.of(context).plateCalculatorNotDivisible),
+ : MutedText(AppLocalizations.of(context).plateCalculatorNotDivisible),
),
SizedBox(height: 3),
],
@@ -625,16 +603,11 @@ class _LogPageState extends State {
),
SizedBox(height: 10),
Expanded(
- child: (widget._workoutPlan
- .filterLogsByExercise(widget._exercise)
- .length >
- 0)
+ child: (widget._workoutPlan.filterLogsByExercise(widget._exercise).length > 0)
? getPastLogs()
: Container()),
// Only show calculator for barbell
- if (widget._log.exerciseObj.equipment
- .map((e) => e.id)
- .contains(ID_EQUIPMENT_BARBELL))
+ if (widget._log.exerciseObj.equipment.map((e) => e.id).contains(ID_EQUIPMENT_BARBELL))
getPlates(),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
@@ -695,9 +668,7 @@ class ExerciseOverview extends StatelessWidget {
child: ListView(
scrollDirection: Axis.horizontal,
children: [
- ..._exercise.images
- .map((e) => ExerciseImageWidget(image: e))
- .toList(),
+ ..._exercise.images.map((e) => ExerciseImageWidget(image: e)).toList(),
],
),
),
@@ -823,8 +794,7 @@ class _SessionPageState extends State {
onFieldSubmitted: (_) {},
onTap: () async {
// Stop keyboard from appearing
- FocusScope.of(context)
- .requestFocus(new FocusNode());
+ FocusScope.of(context).requestFocus(new FocusNode());
// Open time picker
var pickedTime = await showTimePicker(
@@ -833,21 +803,17 @@ class _SessionPageState extends State {
);
if (pickedTime != null) {
- timeStartController.text =
- timeToString(pickedTime)!;
+ timeStartController.text = timeToString(pickedTime)!;
}
},
onSaved: (newValue) {
_session.timeStart = stringToTime(newValue);
},
validator: (_) {
- TimeOfDay startTime =
- stringToTime(timeStartController.text);
- TimeOfDay endTime =
- stringToTime(timeEndController.text);
+ TimeOfDay startTime = stringToTime(timeStartController.text);
+ TimeOfDay endTime = stringToTime(timeEndController.text);
if (startTime.isAfter(endTime)) {
- return AppLocalizations.of(context)
- .timeStartAhead;
+ return AppLocalizations.of(context).timeStartAhead;
}
return null;
}),
@@ -855,8 +821,8 @@ class _SessionPageState extends State {
SizedBox(width: 10),
Flexible(
child: TextFormField(
- decoration: InputDecoration(
- labelText: AppLocalizations.of(context).timeEnd),
+ decoration:
+ InputDecoration(labelText: AppLocalizations.of(context).timeEnd),
controller: timeEndController,
onFieldSubmitted: (_) {},
onTap: () async {
@@ -890,8 +856,7 @@ class _SessionPageState extends State {
// Save the entry on the server
try {
- await Provider.of(context,
- listen: false)
+ await Provider.of(context, listen: false)
.addSession(_session);
Navigator.of(context).pop();
} on WgerHttpException catch (error) {
@@ -984,10 +949,7 @@ class _TimerWidgetState extends State {
child: Center(
child: Text(
DateFormat('m:ss').format(today.add(Duration(seconds: _seconds))),
- style: Theme.of(context)
- .textTheme
- .headline1!
- .copyWith(color: wgerPrimaryColor),
+ style: Theme.of(context).textTheme.headline1!.copyWith(color: wgerPrimaryColor),
),
),
),