From 079c8b6c82965cc5ea09eb998e535ce178316e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Allan=20Nordh=C3=B8y?= Date: Thu, 11 Mar 2021 21:56:38 +0100 Subject: [PATCH 01/69] =?UTF-8?q?GPLv3+=20=E2=86=92=20AGPLv3+=20license?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 147 ++++++++++++++++++++++++++------------------------------ 1 file changed, 67 insertions(+), 80 deletions(-) diff --git a/LICENSE b/LICENSE index f288702d2..dba13ed2d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,23 +1,21 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble - The GNU General Public License is a free, copyleft license for -software and other kinds of works. + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to +our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. +software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you @@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. The precise terms and conditions for copying, distribution and modification follow. @@ -72,7 +60,7 @@ modification follow. 0. Definitions. - "This License" refers to version 3 of the GNU General Public License. + "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. @@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - 13. Use with the GNU Affero General Public License. + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single +under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General +Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published +GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's +versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. @@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by + it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + GNU Affero General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. +For more information on this, and how to apply and follow the GNU AGPL, see +. From 8f7fb744aa07c1887cd3091c5e5f8abb1342c45d Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 5 Apr 2021 18:36:14 +0200 Subject: [PATCH 02/69] Make form for workout day scrollable --- lib/l10n/app_en.arb | 3 +- lib/widgets/workouts/forms.dart | 116 +++++++++--------- lib/widgets/workouts/workout_plan_detail.dart | 1 + 3 files changed, 61 insertions(+), 59 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index dbe05122a..0199bc612 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -107,6 +107,7 @@ "@set": { "description": "A set in a workout plan" }, + "dayDescriptionHelp": "A description of what is done on this day (e.g. 'pull day') or what body parts are trained (e.g. 'chest and shoulders')", "setNr": "Set {nr}", "@setNr": { "description": "Header in form indicating the number of the current set. Can also be translated as something like 'Set Nr. xy'.", @@ -115,7 +116,7 @@ "nr": {} } }, - "sameRepetitions": "If you do the same repetitions and weight for all sets you can just fill in one row. For example for 4 sets just enter one \"10\" for the repetitions, this automatically becomes \"4 x 10\".", + "sameRepetitions": "If you do the same repetitions and weight for all sets you can just fill in one row. For example for 4 sets just enter 10 for the repetitions, this automatically becomes \"4 x 10\".", "comment": "Comment", "@comment": { "description": "Comment, additional information" diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index b824b4033..e808e94fd 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -144,67 +144,67 @@ class _DayFormWidgetState extends State { @override Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(20), - child: Form( - key: _form, - child: Column( - children: [ - TextFormField( - decoration: InputDecoration(labelText: AppLocalizations.of(context)!.description), - controller: widget.dayController, - onSaved: (value) { - widget._day.description = value!; - }, - validator: (value) { - const minLength = 5; - const maxLength = 100; - if (value!.isEmpty || value.length < minLength || value.length > maxLength) { - return AppLocalizations.of(context)!.enterCharacters(minLength, maxLength); - } - return null; - }, + return Form( + key: _form, + child: ListView( + children: [ + TextFormField( + decoration: InputDecoration( + labelText: AppLocalizations.of(context)!.description, + helperText: AppLocalizations.of(context)!.dayDescriptionHelp, + helperMaxLines: 2, ), - SizedBox(height: 10), - Text('Week days'), - ...Day.weekdays.keys.map((dayNr) => DayCheckbox(dayNr, widget._day)).toList(), - ElevatedButton( - child: Text(AppLocalizations.of(context)!.save), - onPressed: () async { - if (!_form.currentState!.validate()) { - return; - } - _form.currentState!.save(); + controller: widget.dayController, + onSaved: (value) { + widget._day.description = value!; + }, + validator: (value) { + const minLength = 5; + const maxLength = 100; + if (value!.isEmpty || value.length < minLength || value.length > maxLength) { + return AppLocalizations.of(context)!.enterCharacters(minLength, maxLength); + } + return null; + }, + ), + SizedBox(height: 10), + ...Day.weekdays.keys.map((dayNr) => DayCheckbox(dayNr, widget._day)).toList(), + ElevatedButton( + child: Text(AppLocalizations.of(context)!.save), + onPressed: () async { + if (!_form.currentState!.validate()) { + return; + } + _form.currentState!.save(); - try { - Provider.of(context, listen: false).addDay( - widget._day, - widget.workout, - ); + try { + Provider.of(context, listen: false).addDay( + widget._day, + widget.workout, + ); - widget.dayController.clear(); - Navigator.of(context).pop(); - } catch (error) { - await showDialog( - context: context, - builder: (ctx) => AlertDialog( - title: Text('An error occurred!'), - content: Text('Something went wrong.'), - actions: [ - TextButton( - child: Text('Okay'), - onPressed: () { - Navigator.of(ctx).pop(); - }, - ) - ], - ), - ); - } - }, - ), - ], - ), + widget.dayController.clear(); + Navigator.of(context).pop(); + } catch (error) { + await showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: Text('An error occurred!'), + content: Text('Something went wrong.'), + actions: [ + TextButton( + child: Text('Okay'), + onPressed: () { + Navigator.of(ctx).pop(); + }, + ) + ], + ), + ); + } + }, + ), + ], ), ); } diff --git a/lib/widgets/workouts/workout_plan_detail.dart b/lib/widgets/workouts/workout_plan_detail.dart index 205eb4180..27d486a88 100644 --- a/lib/widgets/workouts/workout_plan_detail.dart +++ b/lib/widgets/workouts/workout_plan_detail.dart @@ -65,6 +65,7 @@ class _WorkoutPlanDetailState extends State { arguments: FormScreenArguments( AppLocalizations.of(context)!.newDay, DayFormWidget(widget._workoutPlan), + true, ), ); }, From 6a63a390efee79028c7866c07d6161cdc25dabf9 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 5 Apr 2021 18:59:17 +0200 Subject: [PATCH 03/69] Use a nutritional plan object again for editing / adding --- lib/models/nutrition/nutritional_plan.dart | 9 +++- lib/widgets/nutrition/forms.dart | 51 ++++------------------ 2 files changed, 16 insertions(+), 44 deletions(-) diff --git a/lib/models/nutrition/nutritional_plan.dart b/lib/models/nutrition/nutritional_plan.dart index 53f899983..e432a670a 100644 --- a/lib/models/nutrition/nutritional_plan.dart +++ b/lib/models/nutrition/nutritional_plan.dart @@ -31,10 +31,10 @@ class NutritionalPlan { int? id; @JsonKey(required: true) - String description; + late String description; @JsonKey(required: true, name: 'creation_date', toJson: toDate) - DateTime creationDate; + late DateTime creationDate; @JsonKey(ignore: true, defaultValue: []) List meals = []; @@ -53,6 +53,11 @@ class NutritionalPlan { this.logs = logs ?? []; } + NutritionalPlan.empty() { + creationDate = DateTime.now(); + description = ''; + } + // Boilerplate factory NutritionalPlan.fromJson(Map json) => _$NutritionalPlanFromJson(json); Map toJson() => _$NutritionalPlanToJson(this); diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index b1f876304..5c9b74c0d 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -31,7 +31,6 @@ import 'package:wger/providers/nutrition.dart'; class MealForm extends StatelessWidget { late Meal _meal; int _planId; - //var _mealData = {'id': null, 'planId': -1, 'time': TimeOfDay.now()}; final _form = GlobalKey(); final _timeController = TextEditingController(); @@ -41,19 +40,6 @@ class MealForm extends StatelessWidget { _timeController.text = timeToString(_meal.time)!; } - /* - MealForm(int planId, [Meal? meal]) { - _mealData['planId'] = planId; - _timeController.text = timeToString(_mealData['time'] as TimeOfDay)!; - - if (meal != null) { - _mealData['id'] = meal.id; - _mealData['time'] = meal.time; - _timeController.text = timeToString(meal.time)!; - } - } - */ - @override Widget build(BuildContext context) { return Container( @@ -205,24 +191,13 @@ class MealItemForm extends StatelessWidget { } class PlanForm extends StatelessWidget { - //NutritionalPlan? _plan; - var _planData = { - 'description': '', - 'creationDate': DateTime.now(), - 'id': null, - }; - final _form = GlobalKey(); final _descriptionController = TextEditingController(); + late NutritionalPlan _plan; PlanForm([NutritionalPlan? plan]) { - if (plan != null) { - _planData['id'] = plan.id; - _planData['description'] = plan.description; - _planData['creationDate'] = plan.creationDate; - } - - _descriptionController.text = _planData['description'] as String; + _plan = plan != null ? plan : NutritionalPlan.empty(); + _descriptionController.text = _plan.description; } @override @@ -237,7 +212,7 @@ class PlanForm extends StatelessWidget { controller: _descriptionController, onFieldSubmitted: (_) {}, onSaved: (newValue) { - _planData['description'] = newValue!; + _plan.description = newValue!; }, ), ElevatedButton( @@ -252,21 +227,13 @@ class PlanForm extends StatelessWidget { // Save the entry on the server try { - NutritionalPlan plan = NutritionalPlan( - description: _planData['description'] as String, - creationDate: _planData['creationDate'] as DateTime, - ); - - if (_planData['id'] != null) { - plan.id = _planData['id'] as int; - await Provider.of(context, listen: false).patchPlan(plan); - } else { - await Provider.of(context, listen: false).postPlan(plan); - } + _plan.id != null + ? await Provider.of(context, listen: false).patchPlan(_plan) + : await Provider.of(context, listen: false).postPlan(_plan); // Saving was successful, reset the data - //descriptionController.clear(); - //nutritionalPlan = NutritionalPlan(); + _descriptionController.clear(); + _plan = NutritionalPlan.empty(); } on WgerHttpException catch (error) { showHttpExceptionErrorDialog(error, context); } catch (error) { From 8326fe2aee0c7470a4b2256b3e6a8f58a7d33d18 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 5 Apr 2021 19:00:31 +0200 Subject: [PATCH 04/69] Rename some methods for more consistency --- lib/providers/nutrition.dart | 4 ++-- lib/providers/workout_plans.dart | 4 ++-- lib/widgets/nutrition/forms.dart | 4 ++-- lib/widgets/workouts/forms.dart | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/providers/nutrition.dart b/lib/providers/nutrition.dart index 7b1173359..9135e5ed7 100644 --- a/lib/providers/nutrition.dart +++ b/lib/providers/nutrition.dart @@ -118,7 +118,7 @@ class Nutrition extends WgerBaseProvider with ChangeNotifier { return plan; } - Future postPlan(NutritionalPlan planData) async { + Future addPlan(NutritionalPlan planData) async { final data = await post(planData.toJson(), makeUrl(_nutritionalPlansPath)); final plan = NutritionalPlan.fromJson(data); _plans.add(plan); @@ -127,7 +127,7 @@ class Nutrition extends WgerBaseProvider with ChangeNotifier { return plan; } - Future patchPlan(NutritionalPlan plan) async { + Future editPlan(NutritionalPlan plan) async { await patch(plan.toJson(), makeUrl(_nutritionalPlansPath, id: plan.id)); notifyListeners(); } diff --git a/lib/providers/workout_plans.dart b/lib/providers/workout_plans.dart index e663fb1b2..e01d1192f 100644 --- a/lib/providers/workout_plans.dart +++ b/lib/providers/workout_plans.dart @@ -194,7 +194,7 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { notifyListeners(); } - Future postWorkout(WorkoutPlan workout) async { + Future addWorkout(WorkoutPlan workout) async { final data = await post(workout.toJson(), makeUrl(_workoutPlansUrlPath)); final plan = WorkoutPlan.fromJson(data); _workoutPlans.insert(0, plan); @@ -202,7 +202,7 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { return plan; } - Future patchWorkout(WorkoutPlan workout) async { + Future editWorkout(WorkoutPlan workout) async { final data = await patch(workout.toJson(), makeUrl(_workoutPlansUrlPath, id: workout.id)); final plan = WorkoutPlan.fromJson(data); _workoutPlans[findIndexById(plan.id!)] = plan; diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 5c9b74c0d..1008936d9 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -228,8 +228,8 @@ class PlanForm extends StatelessWidget { // Save the entry on the server try { _plan.id != null - ? await Provider.of(context, listen: false).patchPlan(_plan) - : await Provider.of(context, listen: false).postPlan(_plan); + ? await Provider.of(context, listen: false).editPlan(_plan) + : await Provider.of(context, listen: false).addPlan(_plan); // Saving was successful, reset the data _descriptionController.clear(); diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index e808e94fd..019f8d2de 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -79,8 +79,8 @@ class WorkoutForm extends StatelessWidget { // Save to DB final workout = _plan.id != null - ? await Provider.of(context, listen: false).patchWorkout(_plan) - : await Provider.of(context, listen: false).postWorkout(_plan); + ? await Provider.of(context, listen: false).editWorkout(_plan) + : await Provider.of(context, listen: false).addWorkout(_plan); Navigator.of(context).pop(); if (_plan.id == null) { From 9edcaaaf0fc069f4bad00370255c70ba0f26b892 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 6 Apr 2021 10:48:15 +0200 Subject: [PATCH 05/69] Saving sessions at the end of the gym mode works --- lib/models/workouts/log.dart | 50 +++++++++--- lib/models/workouts/log.g.dart | 21 +++--- lib/widgets/workouts/gym_mode.dart | 117 +++++++++++++++++------------ 3 files changed, 118 insertions(+), 70 deletions(-) diff --git a/lib/models/workouts/log.dart b/lib/models/workouts/log.dart index cff68aff3..449c929cd 100644 --- a/lib/models/workouts/log.dart +++ b/lib/models/workouts/log.dart @@ -1,5 +1,8 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:wger/helpers/json.dart'; +import 'package:wger/models/exercises/exercise.dart'; +import 'package:wger/models/workouts/repetition_unit.dart'; +import 'package:wger/models/workouts/weight_unit.dart'; part 'log.g.dart'; @@ -11,6 +14,9 @@ class Log { @JsonKey(required: true) late int exercise; + @JsonKey(ignore: true) + late Exercise exerciseObj; + @JsonKey(required: true, name: 'workout') late int workoutPlan; @@ -23,31 +29,51 @@ class Log { @JsonKey(required: true, name: 'repetition_unit') late int repetitionUnit; + @JsonKey(ignore: true) + late RepetitionUnit repetitionUnitObj; + @JsonKey(required: true, fromJson: toNum, toJson: toString) late num weight; @JsonKey(required: true, name: 'weight_unit') late int weightUnit; + @JsonKey(ignore: true) + late WeightUnit weightUnitObj; + @JsonKey(required: true, toJson: toDate) late DateTime date; //@JsonKey(required: true) //String comment; - Log(); + Log( + {this.id, + required this.exercise, + required this.workoutPlan, + required this.reps, + required this.rir, + required this.repetitionUnit, + required this.weight, + required this.weightUnit, + required this.date}); - Log.withData({ - this.id, - required this.exercise, - required this.workoutPlan, - required this.repetitionUnit, - required this.reps, - required this.rir, - required this.weight, - required this.weightUnit, - required this.date, - }); + Log.empty(); + + void setExercise(Exercise exercise) { + this.exerciseObj = exercise; + this.exercise = exercise.id; + } + + void setWeightUnit(WeightUnit weightUnit) { + this.weightUnitObj = weightUnit; + this.weightUnit = weightUnit.id; + } + + void setRepetitionUnit(RepetitionUnit repetitionUnit) { + this.repetitionUnitObj = repetitionUnit; + this.repetitionUnit = repetitionUnit.id; + } // Boilerplate factory Log.fromJson(Map json) => _$LogFromJson(json); diff --git a/lib/models/workouts/log.g.dart b/lib/models/workouts/log.g.dart index be478d010..4640a93a2 100644 --- a/lib/models/workouts/log.g.dart +++ b/lib/models/workouts/log.g.dart @@ -17,16 +17,17 @@ Log _$LogFromJson(Map json) { 'weight_unit', 'date' ]); - return Log() - ..id = json['id'] as int? - ..exercise = json['exercise'] as int - ..workoutPlan = json['workout'] as int - ..reps = json['reps'] as int - ..rir = json['rir'] as String - ..repetitionUnit = json['repetition_unit'] as int - ..weight = toNum(json['weight'] as String?) - ..weightUnit = json['weight_unit'] as int - ..date = DateTime.parse(json['date'] as String); + return Log( + id: json['id'] as int?, + exercise: json['exercise'] as int, + workoutPlan: json['workout'] as int, + reps: json['reps'] as int, + rir: json['rir'] as String, + repetitionUnit: json['repetition_unit'] as int, + weight: toNum(json['weight'] as String?), + weightUnit: json['weight_unit'] as int, + date: DateTime.parse(json['date'] as String), + ); } Map _$LogToJson(Log instance) => { diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index b9eeea0f6..79866d16b 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -22,6 +22,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; +import 'package:wger/helpers/json.dart'; import 'package:wger/helpers/ui.dart'; import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/http_exception.dart'; @@ -35,7 +36,11 @@ import 'package:wger/providers/workout_plans.dart'; class GymMode extends StatefulWidget { final Day _workoutDay; - GymMode(this._workoutDay); + late TimeOfDay _start; + + GymMode(this._workoutDay) { + _start = TimeOfDay.now(); + } @override _GymModeState createState() => _GymModeState(); @@ -82,7 +87,7 @@ class _GymModeState extends State { children: [ StartPage(_controller, widget._workoutDay), ...out, - SessionPage(workoutProvider.findById(widget._workoutDay.workoutId)), + SessionPage(workoutProvider.findById(widget._workoutDay.workoutId), widget._start), ], ); } @@ -142,13 +147,12 @@ class LogPage extends StatelessWidget { Setting _setting; Exercise _exercise; WorkoutPlan _workoutPlan; - Log _log = Log(); + Log _log = Log.empty(); final _form = GlobalKey(); final _repsController = TextEditingController(); final _weightController = TextEditingController(); final _rirController = TextEditingController(); - final _commentController = TextEditingController(); LogPage(this._controller, this._setting, this._exercise, this._workoutPlan) { if (_setting.reps != null) { @@ -164,7 +168,7 @@ class LogPage extends StatelessWidget { } _log.date = DateTime.now(); - _log.exercise = _exercise.id; + _log.setExercise(_exercise); _log.workoutPlan = _workoutPlan.id!; _log.repetitionUnit = 1; _log.weightUnit = 1; @@ -304,8 +308,9 @@ class ExerciseOverview extends StatelessWidget { class SessionPage extends StatefulWidget { WorkoutPlan _workoutPlan; + TimeOfDay _start; - SessionPage(this._workoutPlan); + SessionPage(this._workoutPlan, this._start); @override _SessionPageState createState() => _SessionPageState(); @@ -321,6 +326,16 @@ class _SessionPageState extends State { int impressionValue = 2; var _session = WorkoutSession(); + @override + void initState() { + super.initState(); + + timeStartController.text = timeToString(widget._start)!; + timeEndController.text = timeToString(TimeOfDay.now())!; + _session.workoutId = widget._workoutPlan.id!; + _session.date = DateTime.now(); + } + @override Widget build(BuildContext context) { return Container( @@ -331,7 +346,7 @@ class _SessionPageState extends State { Padding( padding: const EdgeInsets.symmetric(vertical: 10), child: Text( - 'Session', + AppLocalizations.of(context)!.workoutSession, style: Theme.of(context).textTheme.headline5, ), ), @@ -341,33 +356,24 @@ class _SessionPageState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - FormField( - builder: (FormFieldState state) { - return InputDecorator( - decoration: InputDecoration( - labelText: AppLocalizations.of(context)!.impression, - ), - child: DropdownButtonHideUnderline( - child: DropdownButton( - value: impressionValue, - isDense: true, - onChanged: (int? newValue) { - setState(() { - impressionValue = newValue!; - state.didChange(newValue); - }); - }, - items: ImpressionMap.keys.map>((int key) { - return DropdownMenuItem( - value: key, - child: Text( - ImpressionMap[key]!, - ), - ); - }).toList(), - ), - ), + DropdownButtonFormField( + value: impressionValue, + decoration: InputDecoration( + labelText: AppLocalizations.of(context)!.impression, + ), + items: ImpressionMap.keys.map>((int key) { + return DropdownMenuItem( + value: key, + child: Text(ImpressionMap[key]!), ); + }).toList(), + onSaved: (int? newValue) { + _session.impression = newValue!; + }, + onChanged: (int? newValue) { + setState(() { + impressionValue = newValue!; + }); }, ), TextFormField( @@ -390,7 +396,21 @@ class _SessionPageState extends State { InputDecoration(labelText: AppLocalizations.of(context)!.timeStart), controller: timeStartController, onFieldSubmitted: (_) {}, - onSaved: (newValue) {}, + onTap: () async { + // Stop keyboard from appearing + FocusScope.of(context).requestFocus(new FocusNode()); + + // Open time picker + var pickedTime = await showTimePicker( + context: context, + initialTime: widget._start, + ); + + timeStartController.text = timeToString(pickedTime)!; + }, + onSaved: (newValue) { + _session.timeStart = stringToTime(newValue); + }, ), ), Flexible( @@ -399,7 +419,21 @@ class _SessionPageState extends State { InputDecoration(labelText: AppLocalizations.of(context)!.timeEnd), controller: timeEndController, onFieldSubmitted: (_) {}, - onSaved: (newValue) {}, + onTap: () async { + // Stop keyboard from appearing + FocusScope.of(context).requestFocus(new FocusNode()); + + // Open time picker + var pickedTime = await showTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ); + + timeStartController.text = timeToString(pickedTime)!; + }, + onSaved: (newValue) { + _session.timeEnd = stringToTime(newValue); + }, ), ), ], @@ -413,9 +447,6 @@ class _SessionPageState extends State { return; } _form.currentState!.save(); - _session.date = DateTime.now(); - _session.workoutId = widget._workoutPlan.id!; - _session.impression = impressionValue; // Save the entry on the server try { @@ -511,19 +542,9 @@ class _TimerWidgetState extends State { style: Theme.of(context).textTheme.headline5, ), ), - /* - ElevatedButton( - child: Text("start"), - onPressed: () { - startTimer(); - }, - ), - - */ Expanded( child: Center( child: Text( - //'${_seconds} sec', DateFormat('m:ss').format(today.add(Duration(seconds: _seconds))), style: Theme.of(context).textTheme.headline1, ), From 5557686ff7ecde9907f7344487bbead2c5ec8687 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 6 Apr 2021 20:41:44 +0200 Subject: [PATCH 06/69] Polish the gym mode and other widgets --- lib/l10n/app_en.arb | 2 +- lib/models/workouts/day.dart | 31 +++++-------- lib/models/workouts/set.dart | 17 +++++++ lib/models/workouts/setting.dart | 5 ++- lib/providers/workout_plans.dart | 41 ++++++++++++----- lib/screens/gym_mode.dart | 1 + lib/widgets/dashboard/widgets.dart | 2 +- lib/widgets/workouts/day.dart | 2 +- lib/widgets/workouts/forms.dart | 6 ++- lib/widgets/workouts/gym_mode.dart | 72 ++++++++++++++++++++---------- 10 files changed, 116 insertions(+), 63 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 0199bc612..e269052e6 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -88,7 +88,7 @@ "@noWorkoutPlans": { "description": "Message shown when the user has no workout plans" }, - "addExercise": "Add exercise to this day", + "addExercise": "Add exercise", "repetitions": "Repetitions", "@repetitions": { "description": "Repetitions for an exercise set" diff --git a/lib/models/workouts/day.dart b/lib/models/workouts/day.dart index fcb2243de..abe6f8a18 100644 --- a/lib/models/workouts/day.dart +++ b/lib/models/workouts/day.dart @@ -5,6 +5,16 @@ part 'day.g.dart'; @JsonSerializable() class Day { + static const Map weekdays = { + 1: 'Monday', + 2: 'Tuesday', + 3: 'Wednesday', + 4: 'Thursday', + 5: 'Friday', + 6: 'Saturday', + 7: 'Sunday', + }; + @JsonKey(required: true) int? id; @@ -28,27 +38,6 @@ class Day { this.sets = []; } - Day.withData({ - required this.id, - required this.workoutId, - required this.description, - List? daysOfWeek, - List? sets, - }) { - this.daysOfWeek = daysOfWeek ?? []; - this.sets = sets ?? []; - } - - static const Map weekdays = { - 1: 'Monday', - 2: 'Tuesday', - 3: 'Wednesday', - 4: 'Thursday', - 5: 'Friday', - 6: 'Saturday', - 7: 'Sunday', - }; - String getDayName(int weekDay) { return weekdays[weekDay]!; } diff --git a/lib/models/workouts/set.dart b/lib/models/workouts/set.dart index eda7ea40c..e23c0f5a2 100644 --- a/lib/models/workouts/set.dart +++ b/lib/models/workouts/set.dart @@ -60,6 +60,23 @@ class Set { } } + /// Return only one setting object per exercise, this makes rendering workout + /// plans easier and the gym mode uses the synthetic settings anyway. + List get settingsFiltered { + List out = []; + + settings.forEach((setting) { + final foundSettings = out.where( + (element) => element.exerciseId == setting.exerciseId, + ); + + if (foundSettings.length == 0) { + out.add(setting); + } + }); + return out; + } + void addExercise(Exercise exercise) { exercisesObj.add(exercise); exercisesIds.add(exercise.id); diff --git a/lib/models/workouts/setting.dart b/lib/models/workouts/setting.dart index 63d37ee72..6f4a143f7 100644 --- a/lib/models/workouts/setting.dart +++ b/lib/models/workouts/setting.dart @@ -8,7 +8,8 @@ part 'setting.g.dart'; @JsonSerializable() class Setting { - static final possibleValues = ['1', '1.5', '2', '2.5', '3', '3.5']; + static final possibleRiRValues = ['1', '1.5', '2', '2.5', '3', '3.5']; + static final defaultRiR = '2'; @JsonKey(required: true) int? id; @@ -87,7 +88,7 @@ class Setting { } void setRir(String rir) { - if (possibleValues.contains(rir)) { + if (possibleRiRValues.contains(rir)) { this.rir = rir; } else { throw Exception('RiR value not allowed'); diff --git a/lib/providers/workout_plans.dart b/lib/providers/workout_plans.dart index e01d1192f..40ab69343 100644 --- a/lib/providers/workout_plans.dart +++ b/lib/providers/workout_plans.dart @@ -140,6 +140,7 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { final setData = await fetch(makeUrl(_setsUrlPath, query: {'exerciseday': day.id.toString()})); for (final setEntry in setData['results']) { final workoutSet = Set.fromJson(setEntry); + fetchComputedSettings(workoutSet); // Settings List settings = []; @@ -182,18 +183,6 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { notifyListeners(); } - Future fetchAndSetWorkouts() async { - final data = await fetch(makeUrl(_workoutPlansUrlPath, query: {'ordering': '-creation_date'})); - final List loadedWorkoutPlans = []; - - for (final entry in data['results']) { - loadedWorkoutPlans.add(WorkoutPlan.fromJson(entry)); - } - - _workoutPlans = loadedWorkoutPlans; - notifyListeners(); - } - Future addWorkout(WorkoutPlan workout) async { final data = await post(workout.toJson(), makeUrl(_workoutPlansUrlPath)); final plan = WorkoutPlan.fromJson(data); @@ -325,10 +314,38 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { Future addSet(Set workoutSet) async { final data = await post(workoutSet.toJson(), makeUrl(_setsUrlPath)); final set = Set.fromJson(data); + fetchComputedSettings(set); notifyListeners(); return set; } + Future fetchComputedSettings(Set workoutSet) async { + final data = await fetch(makeUrl( + _setsUrlPath, + id: workoutSet.id!, + objectMethod: 'computed_settings', + )); + + List settings = []; + data['results'].forEach((e) => settings.add(Setting.fromJson(e))); + + workoutSet.settingsComputed = settings; + notifyListeners(); + } + + Future fetchSmartText(Set workoutSet, Exercise exercise) async { + final data = await fetch( + makeUrl( + _setsUrlPath, + id: workoutSet.id!, + objectMethod: 'smart_text', + query: {'exercise': exercise.id.toString()}, + ), + ); + + return data['results']; + } + Future deleteSet(Set workoutSet) async { await deleteRequest(_setsUrlPath, workoutSet.id!); diff --git a/lib/screens/gym_mode.dart b/lib/screens/gym_mode.dart index 2959fdab1..49dca77aa 100644 --- a/lib/screens/gym_mode.dart +++ b/lib/screens/gym_mode.dart @@ -35,6 +35,7 @@ class _GymModeScreenState extends State { final _day = ModalRoute.of(context)!.settings.arguments as Day; return Scaffold( + backgroundColor: Colors.green, body: Consumer( builder: (context, value, child) => GymMode(_day), ), diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index 788772ca8..5117a6d58 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -258,7 +258,7 @@ class _DashboardWorkoutWidgetState extends State { day.sets.forEach((set) { out.add(Column( children: [ - ...set.settings.map((s) { + ...set.settingsFiltered.map((s) { return Column( children: [ Text(s.exerciseObj.name), diff --git a/lib/widgets/workouts/day.dart b/lib/widgets/workouts/day.dart index 29f8a383d..39fcbf575 100644 --- a/lib/widgets/workouts/day.dart +++ b/lib/widgets/workouts/day.dart @@ -75,7 +75,7 @@ class _WorkoutDayWidgetState extends State { Expanded( child: Column( children: [ - ...set.settings + ...set.settingsFiltered .map( (setting) => SettingWidget( setting: setting, diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index 019f8d2de..d0d0755bc 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -606,13 +606,15 @@ class _RiRInputWidgetState extends State { return DropdownButtonFormField( decoration: InputDecoration(labelText: AppLocalizations.of(context)!.rir), value: dropdownValue, + onSaved: (String? newValue) { + widget._setting.setRir(newValue!); + }, onChanged: (String? newValue) { setState(() { dropdownValue = newValue!; - widget._setting.setRir(newValue); }); }, - items: Setting.possibleValues.map>((String value) { + items: Setting.possibleRiRValues.map>((String value) { return DropdownMenuItem( value: value, child: Text(value), diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 79866d16b..e80dcf074 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -117,7 +117,7 @@ class StartPage extends StatelessWidget { (set) { return Column( children: [ - ...set.settings.map((s) { + ...set.settingsFiltered.map((s) { return Column( children: [ Text(s.exerciseObj.name, style: TextStyle(fontWeight: FontWeight.bold)), @@ -142,14 +142,13 @@ class StartPage extends StatelessWidget { } } -class LogPage extends StatelessWidget { +class LogPage extends StatefulWidget { PageController _controller; Setting _setting; Exercise _exercise; WorkoutPlan _workoutPlan; Log _log = Log.empty(); - final _form = GlobalKey(); final _repsController = TextEditingController(); final _weightController = TextEditingController(); final _rirController = TextEditingController(); @@ -174,6 +173,14 @@ class LogPage extends StatelessWidget { _log.weightUnit = 1; } + @override + _LogPageState createState() => _LogPageState(); +} + +class _LogPageState extends State { + final _form = GlobalKey(); + String rirValue = Setting.defaultRiR; + @override Widget build(BuildContext context) { return Container( @@ -184,7 +191,7 @@ class LogPage extends StatelessWidget { Padding( padding: const EdgeInsets.symmetric(vertical: 10), child: Text( - _exercise.name, + widget._exercise.name, style: Theme.of(context).textTheme.headline5, ), ), @@ -196,11 +203,28 @@ class LogPage extends StatelessWidget { children: [ TextFormField( decoration: InputDecoration(labelText: AppLocalizations.of(context)!.repetitions), - controller: _repsController, + controller: widget._repsController, keyboardType: TextInputType.number, onFieldSubmitted: (_) {}, onSaved: (newValue) { - _log.reps = int.parse(newValue!); + widget._log.reps = int.parse(newValue!); + }, + validator: (value) { + try { + int.parse(value!); + } catch (error) { + return AppLocalizations.of(context)!.enterValidNumber; + } + return null; + }, + ), + TextFormField( + decoration: InputDecoration(labelText: AppLocalizations.of(context)!.weight), + controller: widget._weightController, + keyboardType: TextInputType.number, + onFieldSubmitted: (_) {}, + onSaved: (newValue) { + widget._log.weight = double.parse(newValue!); }, validator: (value) { try { @@ -211,21 +235,23 @@ class LogPage extends StatelessWidget { return null; }, ), - TextFormField( - decoration: InputDecoration(labelText: AppLocalizations.of(context)!.weight), - controller: _weightController, - keyboardType: TextInputType.number, - onFieldSubmitted: (_) {}, - onSaved: (newValue) { - _log.weight = double.parse(newValue!); - }, - ), - TextFormField( + DropdownButtonFormField( decoration: InputDecoration(labelText: AppLocalizations.of(context)!.rir), - controller: _rirController, - keyboardType: TextInputType.number, - onFieldSubmitted: (_) {}, - onSaved: (newValue) {}, + value: rirValue, + onSaved: (String? newValue) { + widget._log.rir = newValue!; + }, + onChanged: (String? newValue) { + setState(() { + rirValue = newValue!; + }); + }, + items: Setting.possibleRiRValues.map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), ), /* TextFormField( @@ -252,10 +278,10 @@ class LogPage extends StatelessWidget { // Save the entry on the server try { - await Provider.of(context, listen: false).addLog(_log); + await Provider.of(context, listen: false).addLog(widget._log); //final snackBar = SnackBar(content: Text('Yay! A SnackBar!')); //ScaffoldMessenger.of(context).showSnackBar(snackBar); - _controller.nextPage( + widget._controller.nextPage( duration: Duration(milliseconds: 200), curve: Curves.bounceIn, ); @@ -269,7 +295,7 @@ class LogPage extends StatelessWidget { ], ), ), - NavigationFooter(_controller), + NavigationFooter(widget._controller), ], ), ); From eca0336706ef2d3a4a2813c9767396db0c991db6 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 12:37:06 +0200 Subject: [PATCH 07/69] Initialise the weight and reps unit objects for computed settings --- lib/providers/workout_plans.dart | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/providers/workout_plans.dart b/lib/providers/workout_plans.dart index 40ab69343..035e4c9d9 100644 --- a/lib/providers/workout_plans.dart +++ b/lib/providers/workout_plans.dart @@ -160,7 +160,7 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { if (!workoutSet.exercisesIds.contains(workoutSetting.exerciseId)) { workoutSet.addExercise(workoutSetting.exerciseObj); } - workoutSetting.repsText = 'FIXME!'; + workoutSetting.repsText = await fetchSmartText(workoutSet, workoutSetting.exerciseObj); settings.add(workoutSetting); } workoutSet.settings = settings; @@ -327,7 +327,17 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { )); List settings = []; - data['results'].forEach((e) => settings.add(Setting.fromJson(e))); + data['results'].forEach((e) { + Setting workoutSetting = Setting.fromJson(e); + + workoutSetting.weightUnitObj = _weightUnits.firstWhere( + (unit) => unit.id == workoutSetting.weightUnitId, + ); + workoutSetting.repetitionUnitObj = _repetitionUnit.firstWhere( + (unit) => unit.id == workoutSetting.repetitionUnitId, + ); + settings.add(workoutSetting); + }); workoutSet.settingsComputed = settings; notifyListeners(); From 392c353b85738f3c6188034e76863cba40c448d8 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 13:17:18 +0200 Subject: [PATCH 08/69] Show reps and weight for each exercise in gym mode --- lib/models/workouts/setting.dart | 39 ++++++++++- lib/screens/gym_mode.dart | 2 +- lib/widgets/workouts/gym_mode.dart | 106 ++++++++++++++++++++--------- 3 files changed, 113 insertions(+), 34 deletions(-) diff --git a/lib/models/workouts/setting.dart b/lib/models/workouts/setting.dart index 6f4a143f7..fdfae22e8 100644 --- a/lib/models/workouts/setting.dart +++ b/lib/models/workouts/setting.dart @@ -1,4 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; +import 'package:wger/helpers/consts.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/workouts/repetition_unit.dart'; @@ -50,7 +51,7 @@ class Setting { @JsonKey(required: true) String? rir = ''; - // Generated by Server + // Generated by the server @JsonKey(ignore: true) late String repsText = ''; @@ -94,4 +95,40 @@ class Setting { throw Exception('RiR value not allowed'); } } + + /// Returns the text representation for a single setting, used in the gym mode + String get singleSettingRepText { + // TODO: how to (easily?) translate strings like the units or 'RiR'? + + List out = []; + + if (reps != null) { + out.add(reps.toString()); + + // The default repetition unit is 'reps', which we don't show unless there + // is no weight defined so that we don't just output something like "8" but + // rather "8 repetitions". If there is weight we want to output "8 x 50kg", + // since the repetitions are implied. If other units are used, we always + // print them + if (repetitionUnitId != DEFAULT_REPETITION_UNIT || weight == 0) { + out.add(repetitionUnitObj.name); + } + } + + if (weight != null && weight != 0) { + out.add('×'); + out.add(weight.toString()); + out.add(weightUnitObj.name); + } + + if (rir != null) { + out.add('\n'); + out.add('('); + out.add(rir!); + out.add('RiR'); + out.add(')'); + } + + return out.join(' '); + } } diff --git a/lib/screens/gym_mode.dart b/lib/screens/gym_mode.dart index 49dca77aa..8fb6b6ebd 100644 --- a/lib/screens/gym_mode.dart +++ b/lib/screens/gym_mode.dart @@ -35,7 +35,7 @@ class _GymModeScreenState extends State { final _day = ModalRoute.of(context)!.settings.arguments as Day; return Scaffold( - backgroundColor: Colors.green, + backgroundColor: Colors.white, body: Consumer( builder: (context, value, child) => GymMode(_day), ), diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index e80dcf074..57e5bf205 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -61,9 +61,9 @@ class _GymModeState extends State { Widget build(BuildContext context) { final exerciseProvider = Provider.of(context, listen: false); final workoutProvider = Provider.of(context, listen: false); - List out = []; + // Build the list of exercise overview, sets and pause pages for (var set in widget._workoutDay.sets) { var firstPage = true; for (var setting in set.settingsComputed) { @@ -77,7 +77,6 @@ class _GymModeState extends State { workoutProvider.findById(widget._workoutDay.workoutId), )); out.add(TimerWidget(_controller)); - firstPage = false; } } @@ -85,9 +84,16 @@ class _GymModeState extends State { return PageView( controller: _controller, children: [ - StartPage(_controller, widget._workoutDay), + StartPage( + _controller, + widget._workoutDay, + ), ...out, - SessionPage(workoutProvider.findById(widget._workoutDay.workoutId), widget._start), + SessionPage( + workoutProvider.findById(widget._workoutDay.workoutId), + _controller, + widget._start, + ), ], ); } @@ -110,7 +116,7 @@ class StartPage extends StatelessWidget { padding: const EdgeInsets.symmetric(vertical: 10), child: Text( AppLocalizations.of(context)!.todaysWorkout, - style: Theme.of(context).textTheme.headline5, + style: Theme.of(context).textTheme.headline4, ), ), ..._day.sets.map( @@ -120,7 +126,10 @@ class StartPage extends StatelessWidget { ...set.settingsFiltered.map((s) { return Column( children: [ - Text(s.exerciseObj.name, style: TextStyle(fontWeight: FontWeight.bold)), + Text( + s.exerciseObj.name, + style: Theme.of(context).textTheme.headline6, + ), Text(s.repsText), SizedBox(height: 10), ], @@ -132,10 +141,19 @@ class StartPage extends StatelessWidget { }, ).toList(), Text('Here some text on what to do, etc. etc.'), + ElevatedButton( + child: Text('Start'), + onPressed: () { + _controller.nextPage(duration: Duration(milliseconds: 200), curve: Curves.bounceIn); + }, + ), Expanded( child: Container(), ), - NavigationFooter(_controller), + NavigationFooter( + _controller, + showPrevious: false, + ), ], ), ); @@ -169,8 +187,8 @@ class LogPage extends StatefulWidget { _log.date = DateTime.now(); _log.setExercise(_exercise); _log.workoutPlan = _workoutPlan.id!; - _log.repetitionUnit = 1; - _log.weightUnit = 1; + _log.repetitionUnit = _setting.repetitionUnitId; + _log.weightUnit = _setting.weightUnitId; } @override @@ -195,6 +213,13 @@ class _LogPageState extends State { style: Theme.of(context).textTheme.headline5, ), ), + Center( + child: Text( + '${widget._setting.singleSettingRepText}', + style: Theme.of(context).textTheme.headline3, + textAlign: TextAlign.center, + ), + ), Expanded(child: Container()), Form( key: _form, @@ -334,9 +359,10 @@ class ExerciseOverview extends StatelessWidget { class SessionPage extends StatefulWidget { WorkoutPlan _workoutPlan; + PageController _controller; TimeOfDay _start; - SessionPage(this._workoutPlan, this._start); + SessionPage(this._workoutPlan, this._controller, this._start); @override _SessionPageState createState() => _SessionPageState(); @@ -488,11 +514,9 @@ class _SessionPageState extends State { ], ), ), - IconButton( - icon: Icon(Icons.exit_to_app), - onPressed: () { - Navigator.of(context).pop(); - }, + NavigationFooter( + widget._controller, + showNext: false, ), ], ), @@ -585,31 +609,49 @@ class _TimerWidgetState extends State { class NavigationFooter extends StatelessWidget { final PageController _controller; + bool showPrevious; + bool showNext; - NavigationFooter(this._controller); + NavigationFooter(this._controller, {this.showPrevious = true, this.showNext = true}); @override Widget build(BuildContext context) { return Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisSize: MainAxisSize.max, children: [ - IconButton( - icon: Icon(Icons.chevron_left), - onPressed: () { - _controller.previousPage(duration: Duration(milliseconds: 200), curve: Curves.bounceIn); - }, + // Nest all widgets in an expanded so that they all take the same size + // independently of how wide they are so that the buttons are positioned + // always on the same spot + + Expanded( + child: showPrevious + ? IconButton( + icon: Icon(Icons.chevron_left), + onPressed: () { + _controller.previousPage( + duration: Duration(milliseconds: 200), curve: Curves.bounceIn); + }, + ) + : Container(), ), - IconButton( - icon: Icon(Icons.exit_to_app), - onPressed: () { - Navigator.of(context).pop(); - }, + Expanded( + child: IconButton( + icon: Icon(Icons.exit_to_app), + onPressed: () { + Navigator.of(context).pop(); + }, + ), ), - IconButton( - icon: Icon(Icons.chevron_right), - onPressed: () { - _controller.nextPage(duration: Duration(milliseconds: 200), curve: Curves.bounceIn); - }, + Expanded( + child: showNext + ? IconButton( + icon: Icon(Icons.chevron_right), + onPressed: () { + _controller.nextPage( + duration: Duration(milliseconds: 200), curve: Curves.bounceIn); + }, + ) + : Container(), ), ], ); From aae79cb4a578536b24d335736dbc319c2c4df5ca Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 13:46:32 +0200 Subject: [PATCH 09/69] Render the exercise's description HTML --- lib/widgets/workouts/gym_mode.dart | 5 +- pubspec.lock | 135 ++++++++++++++++++++++++++++- pubspec.yaml | 1 + 3 files changed, 139 insertions(+), 2 deletions(-) diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 57e5bf205..1abf59117 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -20,6 +20,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_html/flutter_html.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import 'package:wger/helpers/json.dart'; @@ -348,7 +349,9 @@ class ExerciseOverview extends StatelessWidget { ), ), Expanded( - child: Text(_exercise.description), + child: Html( + data: _exercise.description, + ), ), NavigationFooter(_controller), ], diff --git a/pubspec.lock b/pubspec.lock index cbce0116a..5b5bde415 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -141,6 +141,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + chewie: + dependency: transitive + description: + name: chewie + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.2" + chewie_audio: + dependency: transitive + description: + name: chewie_audio + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" cli_util: dependency: transitive description: @@ -183,6 +197,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.0" + css_colors: + dependency: transitive + description: + name: css_colors + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.2" cupertino_icons: dependency: "direct main" description: @@ -237,6 +265,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + flutter_html: + dependency: "direct main" + description: + name: flutter_html + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" flutter_keyboard_visibility: dependency: transitive description: @@ -265,11 +300,25 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.0" + flutter_layout_grid: + dependency: transitive + description: + name: flutter_layout_grid + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.5" flutter_localizations: dependency: "direct main" description: flutter source: sdk version: "0.0.0" + flutter_svg: + dependency: transitive + description: + name: flutter_svg + url: "https://pub.dartlang.org" + source: hosted + version: "0.20.0-nullsafety.3" flutter_test: dependency: "direct dev" description: flutter @@ -301,6 +350,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0+4" http: dependency: "direct main" description: @@ -329,6 +385,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.2" + import_js_library: + dependency: transitive + description: + name: import_js_library + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" intl: dependency: "direct main" description: @@ -427,6 +490,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0" + path_drawing: + dependency: transitive + description: + name: path_drawing + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.0" + path_parsing: + dependency: transitive + description: + name: path_parsing + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0" path_provider_linux: dependency: transitive description: @@ -511,6 +588,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" shared_preferences: dependency: "direct main" description: @@ -705,6 +789,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + video_player: + dependency: transitive + description: + name: video_player + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + video_player_platform_interface: + dependency: transitive + description: + name: video_player_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + video_player_web: + dependency: transitive + description: + name: video_player_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4+1" + wakelock: + dependency: transitive + description: + name: wakelock + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.1+1" + wakelock_platform_interface: + dependency: transitive + description: + name: wakelock_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0+1" + wakelock_web: + dependency: transitive + description: + name: wakelock_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0+3" watcher: dependency: transitive description: @@ -719,6 +845,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + webview_flutter: + dependency: transitive + description: + name: webview_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.7" win32: dependency: transitive description: @@ -749,4 +882,4 @@ packages: version: "3.1.0" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.22.0" + flutter: ">=1.24.0-7.0" diff --git a/pubspec.yaml b/pubspec.yaml index 13ff2f929..69c6161e3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -40,6 +40,7 @@ dependencies: package_info: ^2.0.0 android_metadata: ^0.1.3 collection: ^1.15.0-nullsafety.4 + flutter_html: ^1.3.0 dev_dependencies: flutter_test: From 957f4f5f97140c3d3a596aab1ec3c7e2adfbd588 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 14:09:07 +0200 Subject: [PATCH 10/69] Update play store description --- .../android/en-US/full_description.txt | 43 ++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/android/fastlane/metadata/android/en-US/full_description.txt b/android/fastlane/metadata/android/en-US/full_description.txt index c092a1259..27025dcd3 100644 --- a/android/fastlane/metadata/android/en-US/full_description.txt +++ b/android/fastlane/metadata/android/en-US/full_description.txt @@ -1,6 +1,39 @@ -wger (ˈvɛɡɐ) is copylefted libre software helping your health. +From fitness lovers to fitness lovers – get your health organized with WGER, your Workout Manager! -- Plan workouts and nutrition -- Save exercises and comment them -- Gym mode -- Diary and tracking of development +Have you already found your #1 fitness app and do you love to create your own sports routines? No matter what type of sporty beast you are – we all have something in common: We love to keep track of our health data <3 + +So we don’t judge you for still managing your fitness journey with your handy little workout log book but welcome to 2021! + +We have developed a 100% free digital health and fitness tracker app for you, sized down to the most relevant features to make your life easier. Get started, keep training and celebrate your progress! + +wger is an Open Source project and all about: +* Your Body +* Your Workouts +* Your Progress +* Your Data + +Your Body: +No need to google for the ingredients of your favourite treats – choose your daily meals from more than 78000 products and see the nutritional values. Add meals to the nutritional plan and keep an overview of your diet in the calendar. + +Your Workouts: +You know what is best for your body. Create your own workouts out of a growing variety from 200 different exercises. Then, use the Gym Mode to guide you through the training while you log your weights with one tap. + +Your Progress: +Never lose sight of your goals. Track your weight and keep your statistics. + +Your Data: +wger is your personalized fitness diary – but you own your data. Use the REST API to access and do amazing things with it. + +Please note: This free app is not based on additional fundings and we don’t ask you to donate money. More than that it is a community project which is growing constantly. So be prepared for new features anytime! + +#OpenSource – what does that mean? + +Open Source means that the whole source code for this app and the server it talks to is free and available to anybody: +* Do you want to run wger on your own server for you or your local gym? Go ahead! +* Do you miss a feature and want to implement it? Start now! +* Do you want to check that nothing is being sent anywhere? You can! + +Join our community and become a part of sport enthusiasts and IT geeks from all over the world. We keep working on adjusting and optimizing the app customized to our needs. We love your input so feel free to jump in anytime and contribute your wishes and ideas! + +-> find the source code on https://github.com/wger-project +-> ask your questions or just say hello on our discord Server https://discord.gg/rPWFv6W \ No newline at end of file From 6d67fefb1bac9fa04044f29750e4d15383f71509 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 14:12:51 +0200 Subject: [PATCH 11/69] Don't generate mocks for weight_provider_test.dart This is already done for the base test --- test/weight_provider_test.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/weight_provider_test.dart b/test/weight_provider_test.dart index 490bc11ae..260034daf 100644 --- a/test/weight_provider_test.dart +++ b/test/weight_provider_test.dart @@ -20,7 +20,6 @@ import 'dart:io'; import 'package:flutter_test/flutter_test.dart'; import 'package:http/http.dart' as http; -import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:wger/models/body_weight/weight_entry.dart'; import 'package:wger/providers/body_weight.dart'; @@ -28,7 +27,6 @@ import 'package:wger/providers/body_weight.dart'; import 'base_provider_test.mocks.dart'; import 'utils.dart'; -@GenerateMocks([http.Client]) void main() { group('test body weight provider', () { test('Test that the weight entries are correctly loaded', () async { From f29cada757e11340877575fa57552f4ff5d6226e Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 14:26:45 +0200 Subject: [PATCH 12/69] Rename French and Italian language folders This is needed for the Play Store --- android/fastlane/metadata/android/de-DE/title.txt | 2 +- android/fastlane/metadata/android/en-US/title.txt | 2 +- .../metadata/android/{fr => fr-FR}/full_description.txt | 0 .../metadata/android/{fr => fr-FR}/short_description.txt | 0 android/fastlane/metadata/android/fr-FR/title.txt | 1 + .../metadata/android/{it => it-IT}/full_description.txt | 0 .../metadata/android/{it => it-IT}/short_description.txt | 0 android/fastlane/metadata/android/it-IT/title.txt | 1 + 8 files changed, 4 insertions(+), 2 deletions(-) rename android/fastlane/metadata/android/{fr => fr-FR}/full_description.txt (100%) rename android/fastlane/metadata/android/{fr => fr-FR}/short_description.txt (100%) create mode 100644 android/fastlane/metadata/android/fr-FR/title.txt rename android/fastlane/metadata/android/{it => it-IT}/full_description.txt (100%) rename android/fastlane/metadata/android/{it => it-IT}/short_description.txt (100%) create mode 100644 android/fastlane/metadata/android/it-IT/title.txt diff --git a/android/fastlane/metadata/android/de-DE/title.txt b/android/fastlane/metadata/android/de-DE/title.txt index d35e40870..ea0df9560 100644 --- a/android/fastlane/metadata/android/de-DE/title.txt +++ b/android/fastlane/metadata/android/de-DE/title.txt @@ -1 +1 @@ -wger Workout Manager +wger Workout Manager \ No newline at end of file diff --git a/android/fastlane/metadata/android/en-US/title.txt b/android/fastlane/metadata/android/en-US/title.txt index d35e40870..ea0df9560 100644 --- a/android/fastlane/metadata/android/en-US/title.txt +++ b/android/fastlane/metadata/android/en-US/title.txt @@ -1 +1 @@ -wger Workout Manager +wger Workout Manager \ No newline at end of file diff --git a/android/fastlane/metadata/android/fr/full_description.txt b/android/fastlane/metadata/android/fr-FR/full_description.txt similarity index 100% rename from android/fastlane/metadata/android/fr/full_description.txt rename to android/fastlane/metadata/android/fr-FR/full_description.txt diff --git a/android/fastlane/metadata/android/fr/short_description.txt b/android/fastlane/metadata/android/fr-FR/short_description.txt similarity index 100% rename from android/fastlane/metadata/android/fr/short_description.txt rename to android/fastlane/metadata/android/fr-FR/short_description.txt diff --git a/android/fastlane/metadata/android/fr-FR/title.txt b/android/fastlane/metadata/android/fr-FR/title.txt new file mode 100644 index 000000000..ea0df9560 --- /dev/null +++ b/android/fastlane/metadata/android/fr-FR/title.txt @@ -0,0 +1 @@ +wger Workout Manager \ No newline at end of file diff --git a/android/fastlane/metadata/android/it/full_description.txt b/android/fastlane/metadata/android/it-IT/full_description.txt similarity index 100% rename from android/fastlane/metadata/android/it/full_description.txt rename to android/fastlane/metadata/android/it-IT/full_description.txt diff --git a/android/fastlane/metadata/android/it/short_description.txt b/android/fastlane/metadata/android/it-IT/short_description.txt similarity index 100% rename from android/fastlane/metadata/android/it/short_description.txt rename to android/fastlane/metadata/android/it-IT/short_description.txt diff --git a/android/fastlane/metadata/android/it-IT/title.txt b/android/fastlane/metadata/android/it-IT/title.txt new file mode 100644 index 000000000..ea0df9560 --- /dev/null +++ b/android/fastlane/metadata/android/it-IT/title.txt @@ -0,0 +1 @@ +wger Workout Manager \ No newline at end of file From e5b8e0754960d3dc3cefa14e8d3ef402b5ef1f79 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 14:27:58 +0200 Subject: [PATCH 13/69] Bump version --- Gemfile.lock | 16 ++++++++-------- android/fastlane/Fastfile | 38 ++++++++++++++++++++----------------- android/fastlane/README.md | 19 +++++++------------ android/fastlane/report.xml | 4 ++-- pubspec.yaml | 2 +- 5 files changed, 39 insertions(+), 40 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a4c797786..26788305e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,8 +7,8 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.1.1) - aws-partitions (1.432.0) - aws-sdk-core (3.113.0) + aws-partitions (1.441.0) + aws-sdk-core (3.113.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) @@ -16,7 +16,7 @@ GEM aws-sdk-kms (1.43.0) aws-sdk-core (~> 3, >= 3.112.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.91.0) + aws-sdk-s3 (1.93.0) aws-sdk-core (~> 3, >= 3.112.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) @@ -48,7 +48,7 @@ GEM faraday_middleware (1.0.0) faraday (~> 1.0) fastimage (2.2.3) - fastlane (2.178.0) + fastlane (2.179.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) artifactory (~> 3.0) @@ -105,7 +105,7 @@ GEM rexml signet (~> 0.14) webrick - google-apis-iamcredentials_v1 (0.2.0) + google-apis-iamcredentials_v1 (0.3.0) google-apis-core (~> 0.1) google-apis-storage_v1 (0.3.0) google-apis-core (~> 0.1) @@ -123,7 +123,7 @@ GEM google-cloud-core (~> 1.2) googleauth (~> 0.9) mini_mime (~> 1.0) - googleauth (0.16.0) + googleauth (0.16.1) faraday (>= 0.17.3, < 2.0) jwt (>= 1.4, < 3.0) memoist (~> 0.16) @@ -139,7 +139,7 @@ GEM jwt (2.2.2) memoist (0.16.2) mini_magick (4.11.0) - mini_mime (1.0.2) + mini_mime (1.1.0) multi_json (1.15.0) multipart-post (2.0.0) nanaimo (0.3.0) @@ -153,7 +153,7 @@ GEM declarative-option (< 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.4) + rexml (3.2.5) rouge (2.0.7) ruby2_keywords (0.0.4) rubyzip (2.3.0) diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index 9a7dd2212..2029ef8f4 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -25,8 +25,27 @@ end platform :android do -desc "Upload closed alpha app and update store entry" - lane :updateclosed_alpha do + desc "Upload app to production" + lane :production do + begin + # gradle( + # task: 'assemble', + # build_type: 'Release' + #) + upload_to_play_store( + track: 'production', + aab: '../build/app/outputs/bundle/release/app-release.aab', + skip_upload_metadata: false, + skip_upload_images: false, + skip_upload_screenshots: true, + release_status: "completed", #"draft", + ) + end + end + + + desc "Upload closed alpha app and update store entry" + lane :update_alpha do begin upload_to_play_store( track: 'alpha', @@ -39,21 +58,6 @@ desc "Upload closed alpha app and update store entry" end end - - desc "Runs all the tests" - lane :test do - gradle(task: "test") - end - - desc "Submit a new Beta Build to Crashlytics Beta" - lane :beta do - gradle(task: "clean assembleRelease") - crashlytics - - # sh "your_script.sh" - # You can also use other beta testing services here - end - desc "Deploy a new version to the Google Play" lane :deploy do gradle(task: "clean assembleRelease") diff --git a/android/fastlane/README.md b/android/fastlane/README.md index 18f05e093..b925fd02d 100644 --- a/android/fastlane/README.md +++ b/android/fastlane/README.md @@ -24,21 +24,16 @@ fastlane playstore ---- ## Android -### android updateclosed_alpha +### android production ``` -fastlane android updateclosed_alpha +fastlane android production +``` +Upload app to production +### android update_alpha +``` +fastlane android update_alpha ``` Upload closed alpha app and update store entry -### android test -``` -fastlane android test -``` -Runs all the tests -### android beta -``` -fastlane android beta -``` -Submit a new Beta Build to Crashlytics Beta ### android deploy ``` fastlane android deploy diff --git a/android/fastlane/report.xml b/android/fastlane/report.xml index 36206176d..51edf49b7 100644 --- a/android/fastlane/report.xml +++ b/android/fastlane/report.xml @@ -5,12 +5,12 @@ - + - + diff --git a/pubspec.yaml b/pubspec.yaml index 69c6161e3..15287aaec 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.1.0+7 +version: 0.2.0+8 environment: sdk: '>=2.12.0 <3.0.0' From 596385fbc2ac2877008ef73b4f96ea34d8130eb0 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 20:56:14 +0200 Subject: [PATCH 14/69] Replace deprecated snackbar method --- lib/widgets/nutrition/meal.dart | 6 +++--- lib/widgets/nutrition/nutritional_plans_list.dart | 2 +- lib/widgets/weight/entries_list.dart | 2 +- lib/widgets/workouts/workout_plans_list.dart | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index a35e32715..6033edae7 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -127,7 +127,7 @@ class MealItemWidget extends StatelessWidget { Provider.of(context, listen: false).deleteMealItem(_item); // and inform the user - Scaffold.of(context).showSnackBar( + ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( AppLocalizations.of(context)!.successfullyDeleted, @@ -244,7 +244,7 @@ class DismissibleMealHeader extends StatelessWidget { Provider.of(context, listen: false).deleteMeal(_meal); // and inform the user - Scaffold.of(context).showSnackBar( + ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( AppLocalizations.of(context)!.successfullyDeleted, @@ -256,7 +256,7 @@ class DismissibleMealHeader extends StatelessWidget { // Log meal } else { Provider.of(context, listen: false).logMealToDiary(_meal); - Scaffold.of(context).showSnackBar( + ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( AppLocalizations.of(context)!.mealLogged, diff --git a/lib/widgets/nutrition/nutritional_plans_list.dart b/lib/widgets/nutrition/nutritional_plans_list.dart index a57502d08..3ceb86ff3 100644 --- a/lib/widgets/nutrition/nutritional_plans_list.dart +++ b/lib/widgets/nutrition/nutritional_plans_list.dart @@ -62,7 +62,7 @@ class NutritionalPlansList extends StatelessWidget { Navigator.of(contextDialog).pop(); // and inform the user - Scaffold.of(context).showSnackBar( + ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( AppLocalizations.of(context)!.successfullyDeleted, diff --git a/lib/widgets/weight/entries_list.dart b/lib/widgets/weight/entries_list.dart index 70fa1929d..d3e1dcf32 100644 --- a/lib/widgets/weight/entries_list.dart +++ b/lib/widgets/weight/entries_list.dart @@ -52,7 +52,7 @@ class WeightEntriesList extends StatelessWidget { _weightProvider.deleteEntry(currentEntry.id!); // and inform the user - Scaffold.of(context).showSnackBar( + ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( "Deleted weight entry for the ${DateFormat.yMd().format(currentEntry.date).toString()}", diff --git a/lib/widgets/workouts/workout_plans_list.dart b/lib/widgets/workouts/workout_plans_list.dart index 2a2ed6c99..40c73be98 100644 --- a/lib/widgets/workouts/workout_plans_list.dart +++ b/lib/widgets/workouts/workout_plans_list.dart @@ -65,7 +65,7 @@ class WorkoutPlansList extends StatelessWidget { Navigator.of(contextDialog).pop(); // and inform the user - Scaffold.of(context).showSnackBar( + ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( AppLocalizations.of(context)!.successfullyDeleted, From dbcb1efb43172c4c3301caf1cab864d7662720a3 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 21:02:48 +0200 Subject: [PATCH 15/69] When editing a weight entry, don't pre select the current date --- lib/widgets/weight/forms.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/widgets/weight/forms.dart b/lib/widgets/weight/forms.dart index 12c56f926..d7ec36bde 100644 --- a/lib/widgets/weight/forms.dart +++ b/lib/widgets/weight/forms.dart @@ -10,14 +10,15 @@ import 'package:wger/providers/body_weight.dart'; class WeightForm extends StatelessWidget { final _form = GlobalKey(); - final dateController = TextEditingController(text: toDate(DateTime.now()).toString()); + final dateController = TextEditingController(); final weightController = TextEditingController(); late WeightEntry _weightEntry; WeightForm([WeightEntry? weightEntry]) { - this._weightEntry = weightEntry ?? WeightEntry(); + this._weightEntry = weightEntry ?? WeightEntry(date: DateTime.now()); weightController.text = _weightEntry.id == null ? '' : _weightEntry.weight.toString(); + dateController.text = toDate(_weightEntry.date)!; } @override @@ -37,7 +38,7 @@ class WeightForm extends StatelessWidget { // Show Date Picker Here var pickedDate = await showDatePicker( context: context, - initialDate: DateTime.now(), + initialDate: _weightEntry.date, firstDate: DateTime(DateTime.now().year - 10), lastDate: DateTime.now(), ); From 5d8396cf4d827fbe6c58a5e5e93fe52329ff252f Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 21:09:31 +0200 Subject: [PATCH 16/69] Remove comment from the null safety migration tool --- lib/screens/nutritional_plan_screen.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/nutritional_plan_screen.dart b/lib/screens/nutritional_plan_screen.dart index 64d828685..81c9f9222 100644 --- a/lib/screens/nutritional_plan_screen.dart +++ b/lib/screens/nutritional_plan_screen.dart @@ -36,7 +36,7 @@ class NutritionalPlanScreen extends StatelessWidget { @override Widget build(BuildContext context) { - final _nutritionalPlan = ModalRoute.of(context)!.settings.arguments as NutritionalPlan /*!*/; + final _nutritionalPlan = ModalRoute.of(context)!.settings.arguments as NutritionalPlan; return Scaffold( //appBar: getAppBar(nutritionalPlan), From 68268757b85ff6dd944141b4b5cfcebf3b4b4f9c Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 21:26:14 +0200 Subject: [PATCH 17/69] Don't allow selecting a date if there is already an entry --- lib/providers/body_weight.dart | 8 ++++++++ lib/widgets/weight/forms.dart | 13 +++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/providers/body_weight.dart b/lib/providers/body_weight.dart index 285a6b624..c096b8183 100644 --- a/lib/providers/body_weight.dart +++ b/lib/providers/body_weight.dart @@ -39,6 +39,14 @@ class BodyWeight extends WgerBaseProvider with ChangeNotifier { return _entries.firstWhere((plan) => plan.id == id); } + WeightEntry? findByDate(DateTime date) { + try { + return _entries.firstWhere((plan) => plan.date == date); + } on StateError catch (e) { + return null; + } + } + Future> fetchAndSetEntries() async { // Process the response final data = await fetch(makeUrl(bodyWeightUrl, query: {'ordering': '-date'})); diff --git a/lib/widgets/weight/forms.dart b/lib/widgets/weight/forms.dart index d7ec36bde..17e10f0cb 100644 --- a/lib/widgets/weight/forms.dart +++ b/lib/widgets/weight/forms.dart @@ -41,6 +41,17 @@ class WeightForm extends StatelessWidget { initialDate: _weightEntry.date, firstDate: DateTime(DateTime.now().year - 10), lastDate: DateTime.now(), + selectableDayPredicate: (day) { + // Always allow the current initial date + if (day == _weightEntry.date) { + return true; + } + + // if the date is known, don't allow it + return Provider.of(context, listen: false).findByDate(day) == null + ? true + : false; + }, ); dateController.text = toDate(pickedDate)!; @@ -48,7 +59,6 @@ class WeightForm extends StatelessWidget { onSaved: (newValue) { _weightEntry.date = DateTime.parse(newValue!); }, - onFieldSubmitted: (_) {}, ), // Weight @@ -56,7 +66,6 @@ class WeightForm extends StatelessWidget { decoration: InputDecoration(labelText: AppLocalizations.of(context)!.weight), controller: weightController, keyboardType: TextInputType.number, - onFieldSubmitted: (_) {}, onSaved: (newValue) { _weightEntry.weight = double.parse(newValue!); }, From 81a22a4052dadb5851ecbc7af2297fa683130b53 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 12:16:57 +0200 Subject: [PATCH 18/69] Fix error when that prevented adding ingredients to a meal --- lib/models/nutrition/log.dart | 8 ++++---- lib/models/nutrition/log.g.dart | 2 +- lib/models/nutrition/meal_item.dart | 14 ++++++++------ lib/models/nutrition/meal_item.g.dart | 6 +++--- lib/widgets/nutrition/forms.dart | 9 +++------ lib/widgets/nutrition/meal.dart | 2 +- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/lib/models/nutrition/log.dart b/lib/models/nutrition/log.dart index 2cf827281..28c80fec0 100644 --- a/lib/models/nutrition/log.dart +++ b/lib/models/nutrition/log.dart @@ -46,7 +46,7 @@ class Log { late Ingredient ingredientObj; @JsonKey(required: true, name: 'weight_unit') - late int weightUnitId; + int? weightUnitId; @JsonKey(ignore: true) IngredientWeightUnit? weightUnitObj; @@ -81,9 +81,9 @@ class Log { // This is already done on the server. It might be better to read it from there. var out = NutritionalValues(); - final weight = amount; - // final weight = - // this.weightUnitObj == null ? amount : amount * weightUnitObj.amount * weightUnitObj.grams; + //final weight = amount; + final weight = + this.weightUnitObj == null ? amount : amount * weightUnitObj!.amount * weightUnitObj!.grams; out.energy = ingredientObj.energy * weight / 100; out.protein = ingredientObj.protein * weight / 100; diff --git a/lib/models/nutrition/log.g.dart b/lib/models/nutrition/log.g.dart index 27cf722b8..0aedd882e 100644 --- a/lib/models/nutrition/log.g.dart +++ b/lib/models/nutrition/log.g.dart @@ -18,7 +18,7 @@ Log _$LogFromJson(Map json) { return Log( id: json['id'] as int?, ingredientId: json['ingredient'] as int, - weightUnitId: json['weight_unit'] as int, + weightUnitId: json['weight_unit'] as int?, amount: toNum(json['amount'] as String?), planId: json['plan'] as int, datetime: DateTime.parse(json['datetime'] as String), diff --git a/lib/models/nutrition/meal_item.dart b/lib/models/nutrition/meal_item.dart index 1dd7d107b..32136ab09 100644 --- a/lib/models/nutrition/meal_item.dart +++ b/lib/models/nutrition/meal_item.dart @@ -30,29 +30,29 @@ class MealItem { @JsonKey(required: true) int? id; - @JsonKey(required: false) + @JsonKey(required: false, name: 'meal') late int mealId; @JsonKey(required: false, name: 'ingredient') - int ingredientId; + late int ingredientId; @JsonKey(ignore: true) late Ingredient ingredientObj; @JsonKey(required: false, name: 'weight_unit') - int weightUnitId; + int? weightUnitId; @JsonKey(ignore: true) - late IngredientWeightUnit weightUnitObj; + IngredientWeightUnit? weightUnitObj; @JsonKey(required: true, fromJson: toNum, toJson: toString) - num amount; + late num amount; MealItem({ this.id, int? mealId, required this.ingredientId, - required this.weightUnitId, + this.weightUnitId, required this.amount, }) { if (mealId != null) { @@ -60,6 +60,8 @@ class MealItem { } } + MealItem.empty(); + // Boilerplate factory MealItem.fromJson(Map json) => _$MealItemFromJson(json); diff --git a/lib/models/nutrition/meal_item.g.dart b/lib/models/nutrition/meal_item.g.dart index 1e4517ab0..4611e7bce 100644 --- a/lib/models/nutrition/meal_item.g.dart +++ b/lib/models/nutrition/meal_item.g.dart @@ -10,16 +10,16 @@ MealItem _$MealItemFromJson(Map json) { $checkKeys(json, requiredKeys: const ['id', 'amount']); return MealItem( id: json['id'] as int?, - mealId: json['mealId'] as int?, + mealId: json['meal'] as int?, ingredientId: json['ingredient'] as int, - weightUnitId: json['weight_unit'] as int, + weightUnitId: json['weight_unit'] as int?, amount: toNum(json['amount'] as String?), ); } Map _$MealItemToJson(MealItem instance) => { 'id': instance.id, - 'mealId': instance.mealId, + 'meal': instance.mealId, 'ingredient': instance.ingredientId, 'weight_unit': instance.weightUnitId, 'amount': toString(instance.amount), diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 1008936d9..2ecc51b66 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -100,8 +100,8 @@ class MealItemForm extends StatelessWidget { late MealItem _mealItem; MealItemForm(this._meal, [mealItem]) { - this._mealItem = mealItem; - //this._mealItem = mealItem ?? MealItem(mealId: _meal.id); + this._mealItem = mealItem ?? MealItem.empty(); + _mealItem.mealId = _meal.id!; } final _form = GlobalKey(); @@ -142,14 +142,11 @@ class MealItemForm extends StatelessWidget { if (value!.isEmpty) { return AppLocalizations.of(context)!.selectIngredient; } - if (_mealItem.ingredientId == null) { - return AppLocalizations.of(context)!.selectIngredient; - } return null; }, ), TextFormField( - decoration: InputDecoration(labelText: AppLocalizations.of(context)!.amount), + decoration: InputDecoration(labelText: AppLocalizations.of(context)!.weight), controller: _amountController, keyboardType: TextInputType.number, onFieldSubmitted: (_) {}, diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index 6033edae7..150dfd533 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -100,7 +100,7 @@ class MealItemWidget extends StatelessWidget { Widget build(BuildContext context) { String unit = _item.weightUnitId == null ? AppLocalizations.of(context)!.g - : _item.weightUnitObj.weightUnit.name; + : _item.weightUnitObj!.weightUnit.name; final values = _item.nutritionalValues; return Container( From 0a2222de21112fb654fc5be65519b9caa69fa017 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 12:19:37 +0200 Subject: [PATCH 19/69] Add a new line after the macroutrient name This makes the pie chart more readable, before the grams were often cropped --- lib/widgets/nutrition/charts.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/nutrition/charts.dart b/lib/widgets/nutrition/charts.dart index 3a072fa58..6c46f82c8 100644 --- a/lib/widgets/nutrition/charts.dart +++ b/lib/widgets/nutrition/charts.dart @@ -50,7 +50,7 @@ class NutritionalPlanPieChartWidget extends StatelessWidget { [AppLocalizations.of(context)!.carbohydrates, _nutritionalValues.carbohydrates], ], labelAccessorFn: (List row, _) => - '${row[0]}, ${row[1].toStringAsFixed(0)}${AppLocalizations.of(context)!.g}', + '${row[0]}\n${row[1].toStringAsFixed(0)}${AppLocalizations.of(context)!.g}', ) ], defaultRenderer: new charts.ArcRendererConfig( From 19d8862fb604084cda1298085d7f7f2984088e09 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 12:21:17 +0200 Subject: [PATCH 20/69] Localize the nutrition diary dates --- lib/widgets/nutrition/nutritional_plan_detail.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index b1e2a62c8..736edb169 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -177,8 +177,10 @@ class NutritionDiaryEntry extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - Text(DateFormat.yMd().format(date).toString(), - style: TextStyle(fontWeight: FontWeight.bold)), + Text( + DateFormat.yMd(Localizations.localeOf(context).languageCode).format(date), + style: TextStyle(fontWeight: FontWeight.bold), + ), Text(values.energy.toStringAsFixed(0)), Text(values.protein.toStringAsFixed(0)), Text(values.carbohydrates.toStringAsFixed(0)), From e9446e8cae1fbdb7d594317eab33eced1c600a72 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 12:39:06 +0200 Subject: [PATCH 21/69] Redirect to the correct screen after editing a nutritional plan --- lib/screens/nutritional_plan_screen.dart | 4 +++- lib/widgets/nutrition/forms.dart | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/screens/nutritional_plan_screen.dart b/lib/screens/nutritional_plan_screen.dart index 81c9f9222..be6d93334 100644 --- a/lib/screens/nutritional_plan_screen.dart +++ b/lib/screens/nutritional_plan_screen.dart @@ -25,6 +25,8 @@ import 'package:wger/screens/form_screen.dart'; import 'package:wger/widgets/nutrition/forms.dart'; import 'package:wger/widgets/nutrition/nutritional_plan_detail.dart'; +import 'nutritional_plans_screen.dart'; + enum NutritionalPlanOptions { edit, delete, @@ -66,7 +68,7 @@ class NutritionalPlanScreen extends StatelessWidget { } else if (value == NutritionalPlanOptions.delete) { Provider.of(context, listen: false) .deletePlan(_nutritionalPlan.id!); - Navigator.of(context).pushNamed(NutritionalPlanScreen.routeName); + Navigator.of(context).pushReplacementNamed(NutritionScreen.routeName); } }, itemBuilder: (BuildContext context) { diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 2ecc51b66..d770fd359 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -236,7 +236,10 @@ class PlanForm extends StatelessWidget { } catch (error) { showErrorDialog(error, context); } - Navigator.of(context).pop(); + Navigator.of(context).pushReplacementNamed( + NutritionalPlanScreen.routeName, + arguments: _plan, + ); }, ), ], From 1d1d62d9501b0c0f7bcc2a3aa8bc5c0fed0fc247 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 12:46:36 +0200 Subject: [PATCH 22/69] Search ingredients and exercises in the current locale --- lib/providers/exercises.dart | 7 +++++-- lib/providers/nutrition.dart | 7 +++++-- lib/widgets/nutrition/forms.dart | 8 +++++--- lib/widgets/workouts/forms.dart | 5 ++++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/providers/exercises.dart b/lib/providers/exercises.dart index e042f10e9..861de5f3a 100644 --- a/lib/providers/exercises.dart +++ b/lib/providers/exercises.dart @@ -149,14 +149,17 @@ class Exercises extends WgerBaseProvider with ChangeNotifier { /// /// We could do this locally, but the server has better text searching capabilities /// with postgresql. - Future searchExercise(String name) async { + Future searchExercise(String name, [String languageCode = 'en']) async { if (name.length <= 1) { return []; } // Send the request final response = await client.get( - makeUrl(_exerciseSearchPath, query: {'term': name}), + makeUrl( + _exerciseSearchPath, + query: {'term': name, 'language': languageCode}, + ), headers: { 'Authorization': 'Token ${auth.token}', 'User-Agent': 'wger Workout Manager App', diff --git a/lib/providers/nutrition.dart b/lib/providers/nutrition.dart index 9135e5ed7..4baa6e66d 100644 --- a/lib/providers/nutrition.dart +++ b/lib/providers/nutrition.dart @@ -268,14 +268,17 @@ class Nutrition extends WgerBaseProvider with ChangeNotifier { } /// Searches for an ingredient - Future searchIngredient(String name) async { + Future searchIngredient(String name, [String languageCode = 'en']) async { if (name.length <= 1) { return []; } // Send the request final response = await client.get( - makeUrl(_ingredientSearchPath, query: {'term': name}), + makeUrl( + _ingredientSearchPath, + query: {'term': name, 'language': languageCode}, + ), headers: { HttpHeaders.authorizationHeader: 'Token ${auth.token}', HttpHeaders.userAgentHeader: 'wger Workout Manager App', diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index d770fd359..d6cffbaf0 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -27,6 +27,7 @@ import 'package:wger/models/nutrition/meal.dart'; import 'package:wger/models/nutrition/meal_item.dart'; import 'package:wger/models/nutrition/nutritional_plan.dart'; import 'package:wger/providers/nutrition.dart'; +import 'package:wger/screens/nutritional_plan_screen.dart'; class MealForm extends StatelessWidget { late Meal _meal; @@ -122,8 +123,10 @@ class MealItemForm extends StatelessWidget { decoration: InputDecoration(labelText: AppLocalizations.of(context)!.ingredient), ), suggestionsCallback: (pattern) async { - return await Provider.of(context, listen: false) - .searchIngredient(pattern); + return await Provider.of(context, listen: false).searchIngredient( + pattern, + Localizations.localeOf(context).languageCode, + ); }, itemBuilder: (context, dynamic suggestion) { return ListTile( @@ -230,7 +233,6 @@ class PlanForm extends StatelessWidget { // Saving was successful, reset the data _descriptionController.clear(); - _plan = NutritionalPlan.empty(); } on WgerHttpException catch (error) { showHttpExceptionErrorDialog(error, context); } catch (error) { diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index d0d0755bc..8c9cceb8f 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -282,7 +282,10 @@ class _SetFormWidgetState extends State { helperText: AppLocalizations.of(context)!.selectExercises), ), suggestionsCallback: (pattern) async { - return await Provider.of(context, listen: false).searchExercise(pattern); + return await Provider.of(context, listen: false).searchExercise( + pattern, + Localizations.localeOf(context).languageCode, + ); }, itemBuilder: (context, suggestion) { final result = suggestion! as Map; From fad1e9e61c3abafc6806f68923ae612f3809ff74 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 12:57:20 +0200 Subject: [PATCH 23/69] Replace generic "add" label with "add set" --- lib/l10n/app_en.arb | 6 ++++-- lib/widgets/workouts/workout_plan_detail.dart | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index e269052e6..a216fa72f 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -155,8 +155,10 @@ "@save": {}, "cancel": "Cancel", "@cancel": {}, - "add": "Add", - "@add": {}, + "addSet": "Add set", + "@addSet": { + "description": "Label for the button that adds a set (to a workout day)" + }, "addMeal": "Add meal", "@addMeal": {}, "mealLogged": "Meal logged to diary", diff --git a/lib/widgets/workouts/workout_plan_detail.dart b/lib/widgets/workouts/workout_plan_detail.dart index 27d486a88..10fbac709 100644 --- a/lib/widgets/workouts/workout_plan_detail.dart +++ b/lib/widgets/workouts/workout_plan_detail.dart @@ -57,7 +57,7 @@ class _WorkoutPlanDetailState extends State { Column( children: [ ElevatedButton( - child: Text(AppLocalizations.of(context)!.add), + child: Text(AppLocalizations.of(context)!.addSet), onPressed: () { Navigator.pushNamed( context, From ddad869fc95814c2091e17f0149671808d566565 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 13:04:11 +0200 Subject: [PATCH 24/69] Don't use the returned workout plan when editing This gets rid of all attached objects such as days --- lib/providers/workout_plans.dart | 7 ++----- lib/widgets/workouts/forms.dart | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/providers/workout_plans.dart b/lib/providers/workout_plans.dart index 035e4c9d9..d9d393ee3 100644 --- a/lib/providers/workout_plans.dart +++ b/lib/providers/workout_plans.dart @@ -191,12 +191,9 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { return plan; } - Future editWorkout(WorkoutPlan workout) async { - final data = await patch(workout.toJson(), makeUrl(_workoutPlansUrlPath, id: workout.id)); - final plan = WorkoutPlan.fromJson(data); - _workoutPlans[findIndexById(plan.id!)] = plan; + Future editWorkout(WorkoutPlan workout) async { + await patch(workout.toJson(), makeUrl(_workoutPlansUrlPath, id: workout.id)); notifyListeners(); - return plan; } Future deleteWorkout(int id) async { diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index 8c9cceb8f..a4070794c 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -78,13 +78,13 @@ class WorkoutForm extends StatelessWidget { _form.currentState!.save(); // Save to DB - final workout = _plan.id != null + _plan.id != null ? await Provider.of(context, listen: false).editWorkout(_plan) : await Provider.of(context, listen: false).addWorkout(_plan); Navigator.of(context).pop(); if (_plan.id == null) { - Navigator.of(context).pushNamed(WorkoutPlanScreen.routeName, arguments: workout); + Navigator.of(context).pushNamed(WorkoutPlanScreen.routeName, arguments: _plan); } }, ), From ec2325b3e292ea7223ccdd7bbbc68e45227484e5 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 13:09:28 +0200 Subject: [PATCH 25/69] Redirect to the correct screen after editing a workout plan --- lib/widgets/workouts/forms.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index a4070794c..08a936731 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -82,10 +82,10 @@ class WorkoutForm extends StatelessWidget { ? await Provider.of(context, listen: false).editWorkout(_plan) : await Provider.of(context, listen: false).addWorkout(_plan); - Navigator.of(context).pop(); - if (_plan.id == null) { - Navigator.of(context).pushNamed(WorkoutPlanScreen.routeName, arguments: _plan); - } + Navigator.of(context).pushReplacementNamed( + WorkoutPlanScreen.routeName, + arguments: _plan, + ); }, ), ], From 9c213a1af726dcabc9db66ed1cfd62cf0d4fd32e Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 7 Apr 2021 20:04:28 +0000 Subject: [PATCH 26/69] Translated using Weblate (German) Currently translated at 100.0% (95 of 95 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/de/ --- lib/l10n/app_de.arb | 49 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 46773f9a4..9c3df9acd 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -254,7 +254,7 @@ "@login": { "description": "Text for login button" }, - "addExercise": "Diesem Tag eine Übung hinzufügen", + "addExercise": "Eine Übung hinzufügen", "@addExercise": {}, "confirmDelete": "Sind Sie sicher, dass Sie \"{toDelete}\" löschen möchten?", "@confirmDelete": { @@ -273,5 +273,52 @@ "noWorkoutPlans": "Sie haben keine Trainingspläne", "@noWorkoutPlans": { "description": "Message shown when the user has no workout plans" + }, + "nrOfSets": "Anzahl der Sätze: {nrOfSets}", + "@nrOfSets": { + "description": "Label shown on the slider where the user selects the nr of sets", + "type": "text", + "placeholders": { + "nrOfSets": {} + } + }, + "enterCharacters": "Bitte gebe zwischen {min} und {max} Zeichen ein", + "@enterCharacters": { + "description": "Error message when the user hasn't entered the correct number of characters in a form", + "type": "text", + "placeholders": { + "min": {}, + "max": {} + } + }, + "selectExercise": "Bitte wähle eine Übung aus", + "@selectExercise": { + "description": "Error message when the user hasn't selected an exercise in the form" + }, + "selectExercises": "Wenn du einen Supersatz machen willst, kannst du nach mehreren Übungen suchen, sie werden dann gruppiert", + "@selectExercises": {}, + "sameRepetitions": "Wenn du für alle Sätze die gleichen Wiederholungen und das gleiche Gewicht verwendest, kannst du nur eine Zeile ausfüllen. Gebe z. B. für 4 Sätze einfach 10 für die Wiederholungen ein, daraus wird automatisch \"4 x 10\".", + "@sameRepetitions": {}, + "setNr": "Satz {nr}", + "@setNr": { + "description": "Header in form indicating the number of the current set. Can also be translated as something like 'Set Nr. xy'.", + "type": "text", + "placeholders": { + "nr": {} + } + }, + "dayDescriptionHelp": "Eine Beschreibung was an diesem Tag gemacht wird (z. B. \"Zugtag\") oder welche Körperteile trainiert werden (z. B. \"Brust und Schultern\")", + "@dayDescriptionHelp": {}, + "set": "Satz", + "@set": { + "description": "A set in a workout plan" + }, + "repetitionUnit": "Wiederholungseinheit", + "@repetitionUnit": {}, + "weightUnit": "Gewichtseinheit", + "@weightUnit": {}, + "reps": "Whd", + "@reps": { + "description": "Shorthand for repetitions, used when space constraints are tighter" } } From 04e7d33e61751709eb9099cd77727d84d586dad1 Mon Sep 17 00:00:00 2001 From: Stefano Rossi Date: Wed, 7 Apr 2021 16:56:06 +0000 Subject: [PATCH 27/69] Translated using Weblate (Italian) Currently translated at 100.0% (95 of 95 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/it/ --- lib/l10n/app_it.arb | 51 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 681d38b28..d0f761b6e 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -177,7 +177,7 @@ "@repetitions": { "description": "Repetitions for an exercise set" }, - "addExercise": "Aggiungi esercizi per questo giorno", + "addExercise": "Aggiungi esercizi", "@addExercise": {}, "noWorkoutPlans": "Non hai nessun piano di allenamento", "@noWorkoutPlans": { @@ -266,5 +266,54 @@ "login": "Entra", "@login": { "description": "Text for login button" + }, + "nrOfSets": "Numero di set: {nrOfSets}", + "@nrOfSets": { + "description": "Label shown on the slider where the user selects the nr of sets", + "type": "text", + "placeholders": { + "nrOfSets": {} + } + }, + "enterCharacters": "Inserisci una stringa tra {min} e {max} caratteri", + "@enterCharacters": { + "description": "Error message when the user hasn't entered the correct number of characters in a form", + "type": "text", + "placeholders": { + "min": {}, + "max": {} + } + }, + "selectExercise": "Prego, seleziona un esercizio", + "@selectExercise": { + "description": "Error message when the user hasn't selected an exercise in the form" + }, + "todaysWorkout": "Allenamento di oggi", + "@todaysWorkout": {}, + "selectExercises": "Se vuoi fare un superset, puoi cercare e aggiungere diversi esercizi. Questi verranno collegati come superset.", + "@selectExercises": {}, + "sameRepetitions": "Se fai le stesse ripetizioni e peso per tutte le serie puoi compilare una sola riga. Per esempio per 4 serie inserisci semplicemente 10 per le ripetizioni, automaticamente diventerà una 4x10.", + "@sameRepetitions": {}, + "setNr": "Serie {nr}", + "@setNr": { + "description": "Header in form indicating the number of the current set. Can also be translated as something like 'Set Nr. xy'.", + "type": "text", + "placeholders": { + "nr": {} + } + }, + "dayDescriptionHelp": "Una descrizione di ciò che è stato fatto. (p.e. 'allenamento gambe') o quale parte del corpo sono state allenate (p.e. 'petto e spalle')", + "@dayDescriptionHelp": {}, + "set": "Serie", + "@set": { + "description": "A set in a workout plan" + }, + "repetitionUnit": "Unità ripetizioni", + "@repetitionUnit": {}, + "weightUnit": "Unità peso", + "@weightUnit": {}, + "reps": "Ripetizioni", + "@reps": { + "description": "Shorthand for repetitions, used when space constraints are tighter" } } From 16a64b667154a5e6d3575ce2fc95c8585d0fba4e Mon Sep 17 00:00:00 2001 From: Stefano Rossi Date: Wed, 7 Apr 2021 17:25:01 +0000 Subject: [PATCH 28/69] Translated using Weblate (Italian) Currently translated at 100.0% (4 of 4 strings) Translation: wger Workout Manager/Play Store Translate-URL: https://hosted.weblate.org/projects/wger/play-store/it/ --- .../android/it-IT/full_description.txt | 43 ++++++++++++++++--- .../fastlane/metadata/android/it-IT/title.txt | 2 +- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/android/fastlane/metadata/android/it-IT/full_description.txt b/android/fastlane/metadata/android/it-IT/full_description.txt index 143039a3a..a0cf8a3b3 100644 --- a/android/fastlane/metadata/android/it-IT/full_description.txt +++ b/android/fastlane/metadata/android/it-IT/full_description.txt @@ -1,6 +1,39 @@ -wger (ˈvɛɡɐ) è un software libero che aiuta la tua saluta +Da amanti del fitness per amanti del fitness – Organizza la tua salute con wger il tuo gestore dell'allenamento! -- Pianifica allenamento e dieta -- Salva gli esercizi e aggiungi note -- modalità allenamento -- Diario e monitoraggio dello sviluppo +Hai già trovato la tua applicazione per il fitness #1 E ti piace creare le tue routines sportive? Non importa che tipo di sportivo sei – Abbiamo tutti qualcosa in comune: Amiamo tenere sotto controllo i dati sulla nostra salute <3 + +Quindi non ti giudichiamo se stai ancora tenendo traccia dei tuoi allenamenti con un vecchio quaderno, ma ora ti diamo il benvenuto nel 2021! + +Abbiamo sviluppato una applicazione 100% gratuita, questa applicazione tiene traccia dei tuoi allenamenti per te alleggerita alle funzionalità più importanti per semplificarti la vita. Inizia, monitora, e celebra i tuoi progressi! + +wger è un progetto open source ed fatto per: +* Il tuo corpo +* Il tuo allenamento +* I tuoi progressi +* I tuoi dati + +Il tuo corpo: +Nessuna necessità di chiedere a Google gli ingredienti dei tuoi pasti preferiti – Scegli i tuoi pasti quotidiani tra più di 78000 prodotti e verifica i valori nutrizionali. Aggiungi pasti al piano nutrizionale e ottieni una panoramica della tua dieta nel calendario. + +I tuoi allenamenti: +Conosci cosa è meglio per il tuo corpo. Crea i tuoi allenamenti con un crescente numero di esercizi. Oltre 200. Poi, usa la modalità palestra per guidarti attraverso l'allenamento. Mentre registri i tuoi pesi con un tap. + +I tuoi progressi: +Non perdere traccia dei tuoi progressi. Monitora il tuo peso e le tue statistiche. + +I tuoi dati: +wger è un diario del fitness personalizzato – Dove possiedi i tuoi dati. Accedici con le API messe a disposizione. + +Per favore nota una cosa: Questa applicazione è gratuita e non è finanziata da terzi e non ti chiediamo di donare. Questo progetto è sviluppato dalla comunità in costante crescita. Quindi resta preparato a nuove funzionalità in ogni momento. + +#OpenSource – cosa vuole dire? + +Open Source significa che tutto il codice sorgente della applicazione, e del server alla quale comunica, è libero e disponibile a chiunque. +* Vuoi installare il tuo server wger? Così da averlo nella tua palestra? Fai pure. +* Ti mancano funzionalità e le vuoi implementare? Inizia ora. +* Vuoi controllare che nessun dato è inviato a terzi? Puoi farlo! + +Entra a far parte della nostra community e diventa e unisciti agli entusiasti dello sport e nerd IT in tutto il mondo. Continuiamo a migliorare e ottimizzare la app personalizzata alle tue necessità. Amiamo ricevere consigli e idee quindi sentiti libero di unirti a noi in ogni momento e contribuire con i tuoi desideri e le tue idee! + +-> trovi il codice sorgente qui: https://github.com/wger-project +-> fai le tue domante o semplicemente di ciao nel server Discord: https://discord.gg/rPWFv6W diff --git a/android/fastlane/metadata/android/it-IT/title.txt b/android/fastlane/metadata/android/it-IT/title.txt index ea0df9560..d35e40870 100644 --- a/android/fastlane/metadata/android/it-IT/title.txt +++ b/android/fastlane/metadata/android/it-IT/title.txt @@ -1 +1 @@ -wger Workout Manager \ No newline at end of file +wger Workout Manager From 7e28c066154b50dbf8d3b521b43e732c89e69e48 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 18:13:06 +0200 Subject: [PATCH 29/69] Remove dart analysis warnings --- lib/widgets/workouts/forms.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index 08a936731..5f6dca193 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -27,7 +27,6 @@ import 'package:wger/models/workouts/set.dart'; import 'package:wger/models/workouts/setting.dart'; import 'package:wger/models/workouts/weight_unit.dart'; import 'package:wger/models/workouts/workout_plan.dart'; -import 'package:wger/providers/auth.dart'; import 'package:wger/providers/exercises.dart'; import 'package:wger/providers/workout_plans.dart'; import 'package:wger/screens/workout_plan_screen.dart'; @@ -214,7 +213,7 @@ class SetFormWidget extends StatefulWidget { Day _day; late Set _set; - SetFormWidget(Day this._day, [Set? set]) { + SetFormWidget(this._day, [Set? set]) { this._set = set ?? Set.withData(day: _day.id, sets: 4); } @@ -290,7 +289,6 @@ class _SetFormWidgetState extends State { itemBuilder: (context, suggestion) { final result = suggestion! as Map; - String serverUrl = Provider.of(context, listen: false).serverUrl!; final exercise = Provider.of(context, listen: false).findById(result['data']['id']); return ListTile( From 2f321117029f688f469ca2bf982d75d20916d82b Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 19:04:32 +0200 Subject: [PATCH 30/69] Add progress bar to to gym mode to give feedback on workout length --- lib/models/workouts/setting.dart | 5 +- lib/widgets/workouts/gym_mode.dart | 148 +++++++++++++++++------------ 2 files changed, 90 insertions(+), 63 deletions(-) diff --git a/lib/models/workouts/setting.dart b/lib/models/workouts/setting.dart index fdfae22e8..68847c862 100644 --- a/lib/models/workouts/setting.dart +++ b/lib/models/workouts/setting.dart @@ -123,10 +123,7 @@ class Setting { if (rir != null) { out.add('\n'); - out.add('('); - out.add(rir!); - out.add('RiR'); - out.add(')'); + out.add('($rir RiR)'); } return out.join(' '); diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 1abf59117..1150cbb40 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -34,6 +34,7 @@ import 'package:wger/models/workouts/setting.dart'; import 'package:wger/models/workouts/workout_plan.dart'; import 'package:wger/providers/exercises.dart'; import 'package:wger/providers/workout_plans.dart'; +import 'package:wger/theme/theme.dart'; class GymMode extends StatefulWidget { final Day _workoutDay; @@ -48,6 +49,8 @@ class GymMode extends StatefulWidget { } class _GymModeState extends State { + var _totalElements = 1; + PageController _controller = PageController( initialPage: 0, ); @@ -58,26 +61,41 @@ class _GymModeState extends State { super.dispose(); } + @override + void initState() { + super.initState(); + + // Calculate amount of elements for progress indicator + for (var set in widget._workoutDay.sets) { + _totalElements = _totalElements + set.settingsComputed.length; + } + } + @override Widget build(BuildContext context) { final exerciseProvider = Provider.of(context, listen: false); final workoutProvider = Provider.of(context, listen: false); + var currentElement = 1; List out = []; // Build the list of exercise overview, sets and pause pages for (var set in widget._workoutDay.sets) { var firstPage = true; for (var setting in set.settingsComputed) { + var ratioCompleted = currentElement / _totalElements; + currentElement++; if (firstPage) { - out.add(ExerciseOverview(_controller, exerciseProvider.findById(setting.exerciseId))); + out.add(ExerciseOverview( + _controller, + exerciseProvider.findById( + setting.exerciseId, + ), + ratioCompleted, + )); } - out.add(LogPage( - _controller, - setting, - exerciseProvider.findById(setting.exerciseId), - workoutProvider.findById(widget._workoutDay.workoutId), - )); - out.add(TimerWidget(_controller)); + out.add(LogPage(_controller, setting, exerciseProvider.findById(setting.exerciseId), + workoutProvider.findById(widget._workoutDay.workoutId), ratioCompleted)); + out.add(TimerWidget(_controller, ratioCompleted)); firstPage = false; } } @@ -153,6 +171,7 @@ class StartPage extends StatelessWidget { ), NavigationFooter( _controller, + 0, showPrevious: false, ), ], @@ -166,13 +185,15 @@ class LogPage extends StatefulWidget { Setting _setting; Exercise _exercise; WorkoutPlan _workoutPlan; + final double _ratioCompleted; Log _log = Log.empty(); final _repsController = TextEditingController(); final _weightController = TextEditingController(); final _rirController = TextEditingController(); - LogPage(this._controller, this._setting, this._exercise, this._workoutPlan) { + LogPage( + this._controller, this._setting, this._exercise, this._workoutPlan, this._ratioCompleted) { if (_setting.reps != null) { _repsController.text = _setting.reps.toString(); } @@ -321,7 +342,7 @@ class _LogPageState extends State { ], ), ), - NavigationFooter(widget._controller), + NavigationFooter(widget._controller, widget._ratioCompleted), ], ), ); @@ -329,10 +350,11 @@ class _LogPageState extends State { } class ExerciseOverview extends StatelessWidget { - PageController _controller; - Exercise _exercise; + final PageController _controller; + final Exercise _exercise; + final double _ratioCompleted; - ExerciseOverview(this._controller, this._exercise); + ExerciseOverview(this._controller, this._exercise, this._ratioCompleted); @override Widget build(BuildContext context) { @@ -353,7 +375,7 @@ class ExerciseOverview extends StatelessWidget { data: _exercise.description, ), ), - NavigationFooter(_controller), + NavigationFooter(_controller, _ratioCompleted), ], ), ); @@ -519,6 +541,7 @@ class _SessionPageState extends State { ), NavigationFooter( widget._controller, + 1, showNext: false, ), ], @@ -528,9 +551,10 @@ class _SessionPageState extends State { } class TimerWidget extends StatefulWidget { - PageController _controller; + final PageController _controller; + final double _ratioCompleted; - TimerWidget(this._controller); + TimerWidget(this._controller, this._ratioCompleted); @override _TimerWidgetState createState() => _TimerWidgetState(); @@ -588,13 +612,6 @@ class _TimerWidgetState extends State { padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20), child: Column( children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 10), - child: Text( - 'Timer', - style: Theme.of(context).textTheme.headline5, - ), - ), Expanded( child: Center( child: Text( @@ -603,7 +620,7 @@ class _TimerWidgetState extends State { ), ), ), - NavigationFooter(widget._controller), + NavigationFooter(widget._controller, widget._ratioCompleted), ], ), ); @@ -612,49 +629,62 @@ class _TimerWidgetState extends State { class NavigationFooter extends StatelessWidget { final PageController _controller; + final double _ratioCompleted; bool showPrevious; bool showNext; - NavigationFooter(this._controller, {this.showPrevious = true, this.showNext = true}); + NavigationFooter(this._controller, this._ratioCompleted, + {this.showPrevious = true, this.showNext = true}); @override Widget build(BuildContext context) { - return Row( - mainAxisSize: MainAxisSize.max, + return Column( children: [ - // Nest all widgets in an expanded so that they all take the same size - // independently of how wide they are so that the buttons are positioned - // always on the same spot + SizedBox(height: 30), + LinearProgressIndicator( + minHeight: 1.5, + value: _ratioCompleted, + valueColor: AlwaysStoppedAnimation(wgerPrimaryColor), + backgroundColor: Colors.white, + ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + // Nest all widgets in an expanded so that they all take the same size + // independently of how wide they are so that the buttons are positioned + // always on the same spot - Expanded( - child: showPrevious - ? IconButton( - icon: Icon(Icons.chevron_left), - onPressed: () { - _controller.previousPage( - duration: Duration(milliseconds: 200), curve: Curves.bounceIn); - }, - ) - : Container(), - ), - Expanded( - child: IconButton( - icon: Icon(Icons.exit_to_app), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ), - Expanded( - child: showNext - ? IconButton( - icon: Icon(Icons.chevron_right), - onPressed: () { - _controller.nextPage( - duration: Duration(milliseconds: 200), curve: Curves.bounceIn); - }, - ) - : Container(), + Expanded( + child: showPrevious + ? IconButton( + icon: Icon(Icons.chevron_left), + onPressed: () { + _controller.previousPage( + duration: Duration(milliseconds: 200), curve: Curves.bounceIn); + }, + ) + : Container(), + ), + Expanded( + child: IconButton( + icon: Icon(Icons.exit_to_app), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ), + Expanded( + child: showNext + ? IconButton( + icon: Icon(Icons.chevron_right), + onPressed: () { + _controller.nextPage( + duration: Duration(milliseconds: 200), curve: Curves.bounceIn); + }, + ) + : Container(), + ), + ], ), ], ); From 2738f244660b71067286d0a6c6a9dcffe69d9e99 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 Apr 2021 16:26:32 +0200 Subject: [PATCH 31/69] Add buttons to increase and decrease the number of reps in gym mode --- lib/l10n/app_en.arb | 4 +++ lib/widgets/workouts/gym_mode.dart | 53 ++++++++++++++++++++++++------ 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index a216fa72f..aa726809d 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -187,6 +187,10 @@ "@date": { "description": "The date of a workout log or body weight entry" }, + "start": "Start", + "@start": { + "description": "Label on button to start the gym mode (i.e., an imperative)" + }, "time": "Time", "@time": { "description": "The time of a meal or workout" diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 1150cbb40..130902cd9 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -138,6 +138,7 @@ class StartPage extends StatelessWidget { style: Theme.of(context).textTheme.headline4, ), ), + Divider(), ..._day.sets.map( (set) { return Column( @@ -154,21 +155,19 @@ class StartPage extends StatelessWidget { ], ); }).toList(), - Divider(), ], ); }, ).toList(), - Text('Here some text on what to do, etc. etc.'), + Expanded( + child: Container(), + ), ElevatedButton( - child: Text('Start'), + child: Text(AppLocalizations.of(context)!.start), onPressed: () { _controller.nextPage(duration: Duration(milliseconds: 200), curve: Curves.bounceIn); }, ), - Expanded( - child: Container(), - ), NavigationFooter( _controller, 0, @@ -233,8 +232,10 @@ class _LogPageState extends State { child: Text( widget._exercise.name, style: Theme.of(context).textTheme.headline5, + textAlign: TextAlign.center, ), ), + Divider(), Center( child: Text( '${widget._setting.singleSettingRepText}', @@ -249,7 +250,36 @@ class _LogPageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ TextFormField( - decoration: InputDecoration(labelText: AppLocalizations.of(context)!.repetitions), + decoration: InputDecoration( + labelText: AppLocalizations.of(context)!.repetitions, + prefixIcon: IconButton( + icon: Icon( + Icons.add, + color: Colors.black, + ), + onPressed: () { + try { + int newValue = int.parse(widget._repsController.text) + 1; + widget._repsController.text = newValue.toString(); + } on FormatException catch (e) {} + }, + ), + suffixIcon: IconButton( + icon: Icon( + Icons.remove, + color: Colors.black, + ), + onPressed: () { + try { + int newValue = int.parse(widget._repsController.text) - 1; + if (newValue > 0) { + widget._repsController.text = newValue.toString(); + } + } on FormatException catch (e) {} + }, + ), + ), + enabled: true, controller: widget._repsController, keyboardType: TextInputType.number, onFieldSubmitted: (_) {}, @@ -368,8 +398,10 @@ class ExerciseOverview extends StatelessWidget { child: Text( _exercise.name, style: Theme.of(context).textTheme.headline5, + textAlign: TextAlign.center, ), ), + Divider(), Expanded( child: Html( data: _exercise.description, @@ -427,6 +459,7 @@ class _SessionPageState extends State { style: Theme.of(context).textTheme.headline5, ), ), + Divider(), Expanded(child: Container()), Form( key: _form, @@ -616,7 +649,7 @@ class _TimerWidgetState extends State { child: Center( child: Text( DateFormat('m:ss').format(today.add(Duration(seconds: _seconds))), - style: Theme.of(context).textTheme.headline1, + style: Theme.of(context).textTheme.headline1!.copyWith(color: wgerPrimaryColor), ), ), ), @@ -630,8 +663,8 @@ class _TimerWidgetState extends State { class NavigationFooter extends StatelessWidget { final PageController _controller; final double _ratioCompleted; - bool showPrevious; - bool showNext; + final bool showPrevious; + final bool showNext; NavigationFooter(this._controller, this._ratioCompleted, {this.showPrevious = true, this.showNext = true}); From ec8e8294e029262a7f9c153a1b46b0b93b0bb908 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 Apr 2021 16:35:02 +0200 Subject: [PATCH 32/69] Allow the user to start the gym mode from the dashboard --- lib/widgets/dashboard/widgets.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index 5117a6d58..5a2a63fca 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -27,6 +27,7 @@ import 'package:wger/providers/body_weight.dart'; import 'package:wger/providers/nutrition.dart'; import 'package:wger/providers/workout_plans.dart'; import 'package:wger/screens/form_screen.dart'; +import 'package:wger/screens/gym_mode.dart'; import 'package:wger/screens/nutritional_plan_screen.dart'; import 'package:wger/screens/workout_plan_screen.dart'; import 'package:wger/theme/theme.dart'; @@ -254,6 +255,12 @@ class _DashboardWorkoutWidgetState extends State { day.description, style: TextStyle(fontWeight: FontWeight.bold), )); + out.add(IconButton( + icon: Icon(Icons.play_arrow), + onPressed: () { + Navigator.of(context).pushNamed(GymModeScreen.routeName, arguments: day); + }, + )); if (showDetail) { day.sets.forEach((set) { out.add(Column( @@ -267,7 +274,7 @@ class _DashboardWorkoutWidgetState extends State { ], ); }).toList(), - SizedBox(height: 7), + SizedBox(height: 15), ], )); }); From 20ed6966b5b841610d9cebf91a6c8c0bcbaf1252 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 Apr 2021 17:34:07 +0200 Subject: [PATCH 33/69] Allow setting the weight and repetition units in gym mode (still needs to get a better UX) --- lib/l10n/app_en.arb | 4 + lib/models/workouts/log.dart | 12 +- lib/models/workouts/log.g.dart | 2 +- lib/models/workouts/setting.dart | 8 +- lib/theme/theme.dart | 39 +++++- lib/widgets/workouts/forms.dart | 28 +++-- lib/widgets/workouts/gym_mode.dart | 195 ++++++++++++++++------------- 7 files changed, 176 insertions(+), 112 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index aa726809d..9409fba09 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -76,6 +76,10 @@ "@successfullyDeleted": { "description": "Message when an item was successfully deleted" }, + "successfullySaved": "Saved successfully", + "@successfullySaved": { + "description": "Message when an item was successfully saved" + }, "exercise": "Exercise", "@exercise": { "description": "An exercise for a workout" diff --git a/lib/models/workouts/log.dart b/lib/models/workouts/log.dart index 449c929cd..4b43826c1 100644 --- a/lib/models/workouts/log.dart +++ b/lib/models/workouts/log.dart @@ -24,7 +24,7 @@ class Log { late int reps; @JsonKey(required: false) - late String rir; + String? rir; @JsonKey(required: true, name: 'repetition_unit') late int repetitionUnit; @@ -60,6 +60,10 @@ class Log { Log.empty(); + // Boilerplate + factory Log.fromJson(Map json) => _$LogFromJson(json); + Map toJson() => _$LogToJson(this); + void setExercise(Exercise exercise) { this.exerciseObj = exercise; this.exercise = exercise.id; @@ -75,7 +79,7 @@ class Log { this.repetitionUnit = repetitionUnit.id; } - // Boilerplate - factory Log.fromJson(Map json) => _$LogFromJson(json); - Map toJson() => _$LogToJson(this); + void setRir(String rir) { + this.rir = rir; + } } diff --git a/lib/models/workouts/log.g.dart b/lib/models/workouts/log.g.dart index 4640a93a2..d3e2167eb 100644 --- a/lib/models/workouts/log.g.dart +++ b/lib/models/workouts/log.g.dart @@ -22,7 +22,7 @@ Log _$LogFromJson(Map json) { exercise: json['exercise'] as int, workoutPlan: json['workout'] as int, reps: json['reps'] as int, - rir: json['rir'] as String, + rir: json['rir'] as String?, repetitionUnit: json['repetition_unit'] as int, weight: toNum(json['weight'] as String?), weightUnit: json['weight_unit'] as int, diff --git a/lib/models/workouts/setting.dart b/lib/models/workouts/setting.dart index 68847c862..924ef4730 100644 --- a/lib/models/workouts/setting.dart +++ b/lib/models/workouts/setting.dart @@ -9,8 +9,8 @@ part 'setting.g.dart'; @JsonSerializable() class Setting { - static final possibleRiRValues = ['1', '1.5', '2', '2.5', '3', '3.5']; - static final defaultRiR = '2'; + static const POSSIBLE_RIR_VALUES = ['', '1', '1.5', '2', '2.5', '3', '3.5']; + static const DEFAULT_RIR = ''; @JsonKey(required: true) int? id; @@ -89,7 +89,7 @@ class Setting { } void setRir(String rir) { - if (possibleRiRValues.contains(rir)) { + if (POSSIBLE_RIR_VALUES.contains(rir)) { this.rir = rir; } else { throw Exception('RiR value not allowed'); @@ -121,7 +121,7 @@ class Setting { out.add(weightUnitObj.name); } - if (rir != null) { + if (rir != null && rir != '') { out.add('\n'); out.add('($rir RiR)'); } diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart index 8a9270c5f..142607a59 100644 --- a/lib/theme/theme.dart +++ b/lib/theme/theme.dart @@ -30,6 +30,17 @@ const Color wgerBackground = Color(0xfff4f4f6); const charts.Color wgerChartPrimaryColor = charts.Color(r: 0x2a, g: 0x4c, b: 0x7d); const charts.Color wgerChartSecondaryColor = charts.Color(r: 0xe6, g: 0x39, b: 0x46); +/// Original sizes for the material text theme +/// https://api.flutter.dev/flutter/material/TextTheme-class.html +const materialSizes = { + 'h1': 96.0, + 'h2': 60.0, + 'h3': 48.0, + 'h4': 34.0, + 'h5': 24.0, + 'h6': 20.0, +}; + final ThemeData wgerTheme = ThemeData( /* * General stuff @@ -47,12 +58,28 @@ final ThemeData wgerTheme = ThemeData( * Text theme */ textTheme: TextTheme( - //headline1: TextStyle(fontSize: 30.0, fontFamily: "OpenSansBold"), - //headline2: TextStyle(fontSize: 30.0, fontFamily: "OpenSansBold"), - headline4: TextStyle(fontSize: 27.0, fontFamily: "OpenSansBold", color: Colors.black), - headline5: TextStyle(fontSize: 25.0, fontFamily: "OpenSansBold", color: Colors.black), - headline6: TextStyle(fontSize: 20.0, fontFamily: "OpenSansBold", color: Colors.black), - //headline6: TextStyle(fontSize: 36.0, fontStyle: FontStyle.italic), + headline1: TextStyle(fontFamily: "OpenSansLight", color: Colors.black), + headline2: TextStyle(fontFamily: "OpenSansLight", color: Colors.black), + headline3: TextStyle( + fontSize: materialSizes['h3']! * 0.8, + fontFamily: "OpenSansBold", + color: Colors.black, + ), + headline4: TextStyle( + fontSize: materialSizes['h4']! * 0.8, + fontFamily: "OpenSansBold", + color: Colors.black, + ), + headline5: TextStyle( + fontSize: materialSizes['h5']!, + fontFamily: "OpenSansBold", + color: Colors.black, + ), + headline6: TextStyle( + fontSize: materialSizes['h6']! * 0.8, + fontFamily: "OpenSansBold", + color: Colors.black, + ), ), /* diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index 5f6dca193..d0b1e694b 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -591,31 +591,35 @@ class WeightInputWidget extends StatelessWidget { } } +/// Input widget for Rests In Reserve +/// +/// Can be used with a Setting or a Log object class RiRInputWidget extends StatefulWidget { - final Setting _setting; - RiRInputWidget(this._setting); + final dynamic _setting; + late String dropdownValue; + RiRInputWidget(this._setting) { + dropdownValue = _setting.rir != null ? _setting.rir : Setting.DEFAULT_RIR; + } @override _RiRInputWidgetState createState() => _RiRInputWidgetState(); } class _RiRInputWidgetState extends State { - String dropdownValue = '1'; - @override Widget build(BuildContext context) { return DropdownButtonFormField( decoration: InputDecoration(labelText: AppLocalizations.of(context)!.rir), - value: dropdownValue, + value: widget.dropdownValue, onSaved: (String? newValue) { widget._setting.setRir(newValue!); }, onChanged: (String? newValue) { setState(() { - dropdownValue = newValue!; + widget.dropdownValue = newValue!; }); }, - items: Setting.possibleRiRValues.map>((String value) { + items: Setting.POSSIBLE_RIR_VALUES.map>((String value) { return DropdownMenuItem( value: value, child: Text(value), @@ -625,8 +629,11 @@ class _RiRInputWidgetState extends State { } } +/// Input widget for workout weight units +/// +/// Can be used with a Setting or a Log object class WeightUnitInputWidget extends StatefulWidget { - final Setting _setting; + final dynamic _setting; WeightUnitInputWidget(this._setting, {Key? key}) : super(key: key); @@ -660,8 +667,11 @@ class _WeightUnitInputWidgetState extends State { } } +/// Input widget for repetition units +/// +/// Can be used with a Setting or a Log object class RepetitionUnitInputWidget extends StatefulWidget { - final Setting _setting; + final dynamic _setting; RepetitionUnitInputWidget(this._setting); @override diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 130902cd9..87902a564 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -35,6 +35,7 @@ import 'package:wger/models/workouts/workout_plan.dart'; import 'package:wger/providers/exercises.dart'; import 'package:wger/providers/workout_plans.dart'; import 'package:wger/theme/theme.dart'; +import 'package:wger/widgets/workouts/forms.dart'; class GymMode extends StatefulWidget { final Day _workoutDay; @@ -87,14 +88,17 @@ class _GymModeState extends State { if (firstPage) { out.add(ExerciseOverview( _controller, - exerciseProvider.findById( - setting.exerciseId, - ), + exerciseProvider.findById(setting.exerciseId), ratioCompleted, )); } - out.add(LogPage(_controller, setting, exerciseProvider.findById(setting.exerciseId), - workoutProvider.findById(widget._workoutDay.workoutId), ratioCompleted)); + out.add(LogPage( + _controller, + setting, + exerciseProvider.findById(setting.exerciseId), + workoutProvider.findById(widget._workoutDay.workoutId), + ratioCompleted, + )); out.add(TimerWidget(_controller, ratioCompleted)); firstPage = false; } @@ -206,10 +210,10 @@ class LogPage extends StatefulWidget { } _log.date = DateTime.now(); - _log.setExercise(_exercise); _log.workoutPlan = _workoutPlan.id!; - _log.repetitionUnit = _setting.repetitionUnitId; - _log.weightUnit = _setting.weightUnitId; + _log.setExercise(_exercise); + _log.setWeightUnit(_setting.weightUnitObj); + _log.setRepetitionUnit(_setting.repetitionUnitObj); } @override @@ -218,7 +222,7 @@ class LogPage extends StatefulWidget { class _LogPageState extends State { final _form = GlobalKey(); - String rirValue = Setting.defaultRiR; + String rirValue = Setting.DEFAULT_RIR; @override Widget build(BuildContext context) { @@ -249,87 +253,93 @@ class _LogPageState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - TextFormField( - decoration: InputDecoration( - labelText: AppLocalizations.of(context)!.repetitions, - prefixIcon: IconButton( - icon: Icon( - Icons.add, - color: Colors.black, - ), - onPressed: () { - try { - int newValue = int.parse(widget._repsController.text) + 1; - widget._repsController.text = newValue.toString(); - } on FormatException catch (e) {} - }, - ), - suffixIcon: IconButton( - icon: Icon( - Icons.remove, - color: Colors.black, - ), - onPressed: () { - try { - int newValue = int.parse(widget._repsController.text) - 1; - if (newValue > 0) { - widget._repsController.text = newValue.toString(); + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Flexible( + child: TextFormField( + decoration: InputDecoration( + labelText: AppLocalizations.of(context)!.repetitions, + prefixIcon: IconButton( + icon: Icon( + Icons.add, + color: Colors.black, + ), + onPressed: () { + try { + int newValue = int.parse(widget._repsController.text) + 1; + widget._repsController.text = newValue.toString(); + } on FormatException catch (e) {} + }, + ), + suffixIcon: IconButton( + icon: Icon( + Icons.remove, + color: Colors.black, + ), + onPressed: () { + try { + int newValue = int.parse(widget._repsController.text) - 1; + if (newValue > 0) { + widget._repsController.text = newValue.toString(); + } + } on FormatException catch (e) {} + }, + ), + ), + enabled: true, + controller: widget._repsController, + keyboardType: TextInputType.number, + onFieldSubmitted: (_) {}, + onSaved: (newValue) { + widget._log.reps = int.parse(newValue!); + }, + validator: (value) { + try { + int.parse(value!); + } catch (error) { + return AppLocalizations.of(context)!.enterValidNumber; } - } on FormatException catch (e) {} - }, + return null; + }, + ), ), - ), - enabled: true, - controller: widget._repsController, - keyboardType: TextInputType.number, - onFieldSubmitted: (_) {}, - onSaved: (newValue) { - widget._log.reps = int.parse(newValue!); - }, - validator: (value) { - try { - int.parse(value!); - } catch (error) { - return AppLocalizations.of(context)!.enterValidNumber; - } - return null; - }, + SizedBox(width: 8), + Flexible( + child: RepetitionUnitInputWidget(widget._log), + ), + ], ), - TextFormField( - decoration: InputDecoration(labelText: AppLocalizations.of(context)!.weight), - controller: widget._weightController, - keyboardType: TextInputType.number, - onFieldSubmitted: (_) {}, - onSaved: (newValue) { - widget._log.weight = double.parse(newValue!); - }, - validator: (value) { - try { - double.parse(value!); - } catch (error) { - return AppLocalizations.of(context)!.enterValidNumber; - } - return null; - }, - ), - DropdownButtonFormField( - decoration: InputDecoration(labelText: AppLocalizations.of(context)!.rir), - value: rirValue, - onSaved: (String? newValue) { - widget._log.rir = newValue!; - }, - onChanged: (String? newValue) { - setState(() { - rirValue = newValue!; - }); - }, - items: Setting.possibleRiRValues.map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Flexible( + child: TextFormField( + decoration: + InputDecoration(labelText: AppLocalizations.of(context)!.weight), + controller: widget._weightController, + keyboardType: TextInputType.number, + onFieldSubmitted: (_) {}, + onSaved: (newValue) { + widget._log.weight = double.parse(newValue!); + }, + validator: (value) { + try { + double.parse(value!); + } catch (error) { + return AppLocalizations.of(context)!.enterValidNumber; + } + return null; + }, + ), + ), + SizedBox(width: 8), + Flexible( + child: WeightUnitInputWidget(widget._log), + ) + ], ), + RiRInputWidget(widget._log), /* TextFormField( decoration: InputDecoration(labelText: AppLocalizations.of(context)!.comment), @@ -356,8 +366,17 @@ class _LogPageState extends State { // Save the entry on the server try { await Provider.of(context, listen: false).addLog(widget._log); - //final snackBar = SnackBar(content: Text('Yay! A SnackBar!')); - //ScaffoldMessenger.of(context).showSnackBar(snackBar); + /* + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + duration: Duration(seconds: 2), // default is 4 + content: Text( + AppLocalizations.of(context)!.successfullySaved, + textAlign: TextAlign.center, + ), + ), + ); + */ widget._controller.nextPage( duration: Duration(milliseconds: 200), curve: Curves.bounceIn, From 0b8c8ce3de8b41b2337fe97f4b03bc9b07ce2b2e Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 Apr 2021 17:50:33 +0200 Subject: [PATCH 34/69] Correctly fetch the synthetic repetitions when creating a workout --- lib/providers/workout_plans.dart | 1 - lib/widgets/workouts/forms.dart | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/providers/workout_plans.dart b/lib/providers/workout_plans.dart index d9d393ee3..145a274d6 100644 --- a/lib/providers/workout_plans.dart +++ b/lib/providers/workout_plans.dart @@ -311,7 +311,6 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { Future addSet(Set workoutSet) async { final data = await post(workoutSet.toJson(), makeUrl(_setsUrlPath)); final set = Set.fromJson(data); - fetchComputedSettings(set); notifyListeners(); return set; } diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index d0b1e694b..600bba6b4 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -383,13 +383,17 @@ class _SetFormWidgetState extends State { for (var setting in widget._set.settings) { setting.setId = setDb.id!; setting.comment = ''; - setting.repsText = 'temp text'; Setting settingDb = await workoutProvider.addSetting(setting); + setting.repsText = await workoutProvider.fetchSmartText( + widget._set, + setting.exerciseObj, + ); setting.id = settingDb.id; } // Add to workout day + workoutProvider.fetchComputedSettings(widget._set); widget._day.sets.add(widget._set); // Close the bottom sheet From 39a6b274fd7233fe105f2e2a85f15376ffba1e2a Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 Apr 2021 17:46:37 +0000 Subject: [PATCH 35/69] Translated using Weblate (German) Currently translated at 100.0% (4 of 4 strings) Translation: wger Workout Manager/Play Store Translate-URL: https://hosted.weblate.org/projects/wger/play-store/de/ --- .../android/de-DE/full_description.txt | 40 ++++++++++++++++++- .../fastlane/metadata/android/de-DE/title.txt | 2 +- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/android/fastlane/metadata/android/de-DE/full_description.txt b/android/fastlane/metadata/android/de-DE/full_description.txt index 831d10d92..c198bbe82 100644 --- a/android/fastlane/metadata/android/de-DE/full_description.txt +++ b/android/fastlane/metadata/android/de-DE/full_description.txt @@ -1,3 +1,39 @@ -wger (ˈvɛɡɐ) Workout Manager ist eine kostenlose Open-Source-Anwendung, mit der Sie Ihre persönlichen Trainings-, Gewichts- und Diätpläne verwalten können +Von Fitnessliebhabern für Fitnessliebhaber - organisiere deine Gesundheit mit WGER, deinem Workout Manager! -TODO... +Hast du schon deine #1 Fitness-App gefunden und liebst es, deine eigene Trainingspläne zu erstellen? Egal was für ein sportliches Biest du bist sind - wir haben alle etwas gemeinsam: wir lieben es, den Überblick über unsere Gesundheitsdaten zu behalten <3 + +Wir verurteilen dich also nicht dafür, dass du deine Fitness-Reise immer noch mit deinem kleinen Logbuch verwaltest, aber willkommen im Jahr 2021! + +Wir haben eine 100% kostenlose digitale Gesundheits- und Fitnesstracker-App für dich entwickelt, die auf die wichtigsten Funktionen reduziert ist, um dein Leben einfacher zu machen. Lege jetzt lost, trainiere weiter und feiere deine Ihre Fortschritte! + +wger ist ein Open-Source-Projekt und dreht sich um: +* Deinen Körper +* Deine Workouts +* Deine Fortschritte +* Deine Daten + +Dein Körper: +Du musst nicht mehr nach den Zutaten deiner Lieblingsspeise googeln - stelle deine täglichen Mahlzeiten aus mehr als 78000 Produkten und deren Nährwerte her. Füge Mahlzeiten zum Ernährungsplan hinzu und behalte den Überblick über deine Ernährung im Kalender. + +Deine Workouts: +Du weißt, was das Beste für Ihren Körper ist. Erstelle deine eigenen Workouts aus einer wachsenden Vielfalt von 200 verschiedenen Übungen. Verwende dann den Gym-Modus, um dich durch das Training zu führen, während du deine Gewichte und Wiederholungen mit einem Tippen protokollieren kannst. + +Dein Fortschritt: +Verlieren nie deine Ziele aus den Augen, tracke dein Gewicht und behalte deine Statistiken. + +Deine Daten: +wger ist dein persönliches Fitness-Tagebuch - aber deine Daten gehören Dir. Nutze die REST-API, um darauf zuzugreifen und erstaunliche Dinge damit zu tun. + +Bitte beachte: Diese kostenlose App basiert nicht auf zusätzlichen Finanzierungen und wir bitten dich nicht um Geldspenden. Vielmehr handelt es sich um ein Community-Projekt, das ständig wächst. Sei also jederzeit auf neue Funktionen vorbereitet! + +#OpenSource - was bedeutet das? + +Open Source bedeutet, dass der gesamte Quellcode für diese App und den Server, mit dem sie spricht, frei und für jeden verfügbar ist: +* Willst du wger auf deinem eigenen Server für dich oder dein lokales Fitnessstudio laufen lassen? Nur zu! +* Vermisst du ein Feature und willst es implementieren? Fang jetzt an! +* Willst du überprüfen, dass etwas an Dritte gesendet wird? Das kannst du! + +Trete unserer Community bei und werde ein Teil von Sportbegeisterten und IT-Freaks aus aller Welt. Wir arbeiten ständig daran, die App an unsere Bedürfnisse anzupassen und zu optimieren. Wir freuen uns über deinen Input, du kannst jederzeit einsteigen und deine Wünsche und Ideen einbringen! + +-> finde den Quellcode auf https://github.com/wger-project +-> stelle deine Fragen oder sag einfach "Hallo" auf unserem Discord Server https://discord.gg/rPWFv6W diff --git a/android/fastlane/metadata/android/de-DE/title.txt b/android/fastlane/metadata/android/de-DE/title.txt index ea0df9560..d35e40870 100644 --- a/android/fastlane/metadata/android/de-DE/title.txt +++ b/android/fastlane/metadata/android/de-DE/title.txt @@ -1 +1 @@ -wger Workout Manager \ No newline at end of file +wger Workout Manager From c5574312b331b60cce37d6bb3d9cf2984c8d2fb5 Mon Sep 17 00:00:00 2001 From: Stefano Rossi Date: Fri, 9 Apr 2021 17:37:20 +0000 Subject: [PATCH 36/69] Translated using Weblate (Italian) Currently translated at 100.0% (95 of 95 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/it/ --- lib/l10n/app_it.arb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index d0f761b6e..e176b6c58 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -290,7 +290,7 @@ }, "todaysWorkout": "Allenamento di oggi", "@todaysWorkout": {}, - "selectExercises": "Se vuoi fare un superset, puoi cercare e aggiungere diversi esercizi. Questi verranno collegati come superset.", + "selectExercises": "Se vuoi fare un circuito (super set), puoi cercare e aggiungere diversi esercizi. Questi verranno collegati come circuito.", "@selectExercises": {}, "sameRepetitions": "Se fai le stesse ripetizioni e peso per tutte le serie puoi compilare una sola riga. Per esempio per 4 serie inserisci semplicemente 10 per le ripetizioni, automaticamente diventerà una 4x10.", "@sameRepetitions": {}, @@ -315,5 +315,9 @@ "reps": "Ripetizioni", "@reps": { "description": "Shorthand for repetitions, used when space constraints are tighter" + }, + "addSet": "Aggiungi serie", + "@addSet": { + "description": "Label for the button that adds a set (to a workout day)" } } From 423ba71c3d3c8368505079081f667dfe75a203c8 Mon Sep 17 00:00:00 2001 From: Stefano Rossi Date: Fri, 9 Apr 2021 17:40:09 +0000 Subject: [PATCH 37/69] Translated using Weblate (French) Currently translated at 90.5% (86 of 95 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/fr/ --- lib/l10n/app_fr.arb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 971ec5677..03c1abef6 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -177,7 +177,7 @@ "@repetitions": { "description": "Repetitions for an exercise set" }, - "addExercise": "Ajoute un exercice à cet journée", + "addExercise": "Ajoute un exercice", "@addExercise": {}, "noWorkoutPlans": "Aucune plan d'entraînement", "@noWorkoutPlans": { @@ -266,5 +266,17 @@ "login": "Se connecter", "@login": { "description": "Text for login button" + }, + "set": "Série", + "@set": { + "description": "A set in a workout plan" + }, + "repetitionUnit": "Unité des répétitions", + "@repetitionUnit": {}, + "weightUnit": "Unité de poids", + "@weightUnit": {}, + "reps": "Répétitions", + "@reps": { + "description": "Shorthand for repetitions, used when space constraints are tighter" } } From e1d97f4f91bcc189e08de22b2d0079716af581f1 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 10 Apr 2021 12:03:11 +0200 Subject: [PATCH 38/69] Make list of exercises in gym mode overview scrollable --- lib/widgets/workouts/gym_mode.dart | 39 ++++++++++++++++-------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 87902a564..a9960bbd5 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -143,28 +143,31 @@ class StartPage extends StatelessWidget { ), ), Divider(), - ..._day.sets.map( - (set) { - return Column( - children: [ - ...set.settingsFiltered.map((s) { + Expanded( + child: ListView( + children: [ + ..._day.sets.map( + (set) { return Column( children: [ - Text( - s.exerciseObj.name, - style: Theme.of(context).textTheme.headline6, - ), - Text(s.repsText), - SizedBox(height: 10), + ...set.settingsFiltered.map((s) { + return Column( + children: [ + Text( + s.exerciseObj.name, + style: Theme.of(context).textTheme.headline6, + ), + Text(s.repsText), + SizedBox(height: 15), + ], + ); + }).toList(), ], ); - }).toList(), - ], - ); - }, - ).toList(), - Expanded( - child: Container(), + }, + ).toList(), + ], + ), ), ElevatedButton( child: Text(AppLocalizations.of(context)!.start), From b3dc1d23cb829c189c0a54d601c7f061bbe2fc29 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 10 Apr 2021 12:20:09 +0200 Subject: [PATCH 39/69] Don't prefill the user and password with development values --- lib/screens/auth_screen.dart | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index 7ab6e746d..97a0c6001 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -36,8 +36,6 @@ class AuthScreen extends StatelessWidget { @override Widget build(BuildContext context) { final deviceSize = MediaQuery.of(context).size; - // final transformConfig = Matrix4.rotationZ(-8 * pi / 180); - // transformConfig.translate(-10.0); return Scaffold( backgroundColor: Theme.of(context).primaryColor, body: Stack( @@ -58,7 +56,6 @@ class AuthScreen extends StatelessWidget { Container( margin: EdgeInsets.only(bottom: 20.0), padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 94.0), - // ..translate(-10.0), child: Text( 'WGER', style: TextStyle( @@ -101,8 +98,8 @@ class _AuthCardState extends State { 'serverUrl': '', }; var _isLoading = false; - final _usernameController = TextEditingController(text: 'admin'); - final _passwordController = TextEditingController(text: 'adminadmin'); + final _usernameController = TextEditingController(); + final _passwordController = TextEditingController(); final _password2Controller = TextEditingController(); final _emailController = TextEditingController(); final _serverUrlController = TextEditingController(text: DEFAULT_SERVER); From 78c70c7918ede5df2a24d44cb8da65accd8bd689 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 10 Apr 2021 12:25:34 +0200 Subject: [PATCH 40/69] Move gym mode content into a SafeArea widget --- lib/screens/gym_mode.dart | 16 ++++++++-------- lib/widgets/workouts/gym_mode.dart | 5 ----- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/screens/gym_mode.dart b/lib/screens/gym_mode.dart index 8fb6b6ebd..3b457a161 100644 --- a/lib/screens/gym_mode.dart +++ b/lib/screens/gym_mode.dart @@ -22,22 +22,22 @@ import 'package:wger/models/workouts/day.dart'; import 'package:wger/providers/workout_plans.dart'; import 'package:wger/widgets/workouts/gym_mode.dart'; -class GymModeScreen extends StatefulWidget { +class GymModeScreen extends StatelessWidget { static const routeName = '/gym-mode'; - @override - _GymModeScreenState createState() => _GymModeScreenState(); -} - -class _GymModeScreenState extends State { @override Widget build(BuildContext context) { final _day = ModalRoute.of(context)!.settings.arguments as Day; return Scaffold( backgroundColor: Colors.white, - body: Consumer( - builder: (context, value, child) => GymMode(_day), + body: SafeArea( + child: Consumer( + builder: (context, value, child) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30), + child: GymMode(_day), + ), + ), ), ); } diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index a9960bbd5..63283c17d 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -132,7 +132,6 @@ class StartPage extends StatelessWidget { Widget build(BuildContext context) { return Container( width: double.infinity, - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20), child: Column( children: [ Padding( @@ -231,7 +230,6 @@ class _LogPageState extends State { Widget build(BuildContext context) { return Container( width: double.infinity, - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20), child: Column( children: [ Padding( @@ -412,7 +410,6 @@ class ExerciseOverview extends StatelessWidget { Widget build(BuildContext context) { return Container( width: double.infinity, - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20), child: Column( children: [ Padding( @@ -471,7 +468,6 @@ class _SessionPageState extends State { Widget build(BuildContext context) { return Container( width: double.infinity, - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20), child: Column( children: [ Padding( @@ -664,7 +660,6 @@ class _TimerWidgetState extends State { Widget build(BuildContext context) { return Container( width: double.infinity, - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20), child: Column( children: [ Expanded( From a24630424ed5a89aef185033fbed43abab3df774 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 10 Apr 2021 12:26:01 +0200 Subject: [PATCH 41/69] Re-activate showing a snackbar after saving a log in the gym mode --- lib/widgets/workouts/gym_mode.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 63283c17d..c4dba2c6d 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -367,7 +367,6 @@ class _LogPageState extends State { // Save the entry on the server try { await Provider.of(context, listen: false).addLog(widget._log); - /* ScaffoldMessenger.of(context).showSnackBar( SnackBar( duration: Duration(seconds: 2), // default is 4 @@ -377,7 +376,6 @@ class _LogPageState extends State { ), ), ); - */ widget._controller.nextPage( duration: Duration(milliseconds: 200), curve: Curves.bounceIn, From ab5021fc1210c11d0985238ea31508112409fb6e Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 10 Apr 2021 12:57:14 +0200 Subject: [PATCH 42/69] Only attempt to draw log charts when there is data --- lib/widgets/workouts/charts.dart | 46 +++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/lib/widgets/workouts/charts.dart b/lib/widgets/workouts/charts.dart index 0991d6bfd..1bc0d43cc 100644 --- a/lib/widgets/workouts/charts.dart +++ b/lib/widgets/workouts/charts.dart @@ -32,28 +32,30 @@ class LogChartWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return charts.TimeSeriesChart( - [ - ..._data['chart_data'].map((e) { - return charts.Series( - id: '${e.first['reps']} reps', - domainFn: (datum, index) => datum.time, - measureFn: (datum, index) => datum.weight, - data: [ - ...e.map( - (entry) => TimeSeriesLog( - DateTime.parse(entry['date']), - double.parse(entry['weight']), - ), - ), + return _data.containsKey('chart_data') && _data['chart_data'].length > 0 + ? charts.TimeSeriesChart( + [ + ..._data['chart_data'].map((e) { + return charts.Series( + id: '${e.first['reps']} reps', + domainFn: (datum, index) => datum.time, + measureFn: (datum, index) => datum.weight, + data: [ + ...e.map( + (entry) => TimeSeriesLog( + DateTime.parse(entry['date']), + double.parse(entry['weight']), + ), + ), + ], + ); + }), ], - ); - }), - ], - primaryMeasureAxis: new charts.NumericAxisSpec( - tickProviderSpec: new charts.BasicNumericTickProviderSpec(zeroBound: false), - ), - //behaviors: [new charts.SeriesLegend()], - ); + primaryMeasureAxis: new charts.NumericAxisSpec( + tickProviderSpec: new charts.BasicNumericTickProviderSpec(zeroBound: false), + ), + //behaviors: [new charts.SeriesLegend()], + ) + : Container(); } } From e60236042b967c79ec712f11924b4750f11de242 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 10 Apr 2021 13:09:27 +0200 Subject: [PATCH 43/69] Remove more hard coded strings --- lib/l10n/app_en.arb | 8 ++++++++ lib/screens/workout_plan_screen.dart | 12 ++++++------ lib/widgets/app_drawer.dart | 2 +- lib/widgets/dashboard/calendar.dart | 15 --------------- .../nutrition/nutritional_plan_detail.dart | 5 ++++- lib/widgets/weight/entries_list.dart | 2 +- lib/widgets/workouts/forms.dart | 2 +- lib/widgets/workouts/log.dart | 3 +++ lib/widgets/workouts/workout_logs.dart | 4 ++-- lib/widgets/workouts/workout_plan_detail.dart | 3 ++- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 9409fba09..891b485ad 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -4,6 +4,10 @@ "@login": { "description": "Text for login button" }, + "logout": "Log out", + "@logout": { + "description": "Text for logout button" + }, "register": "Register", "@register": { "description": "Text for registration button" @@ -64,6 +68,10 @@ "@labelWorkoutPlans": { "description": "Title for screen workout plans" }, + "labelWorkoutLogs": "Training logs", + "@labelWorkoutLogs": { + "description": "(Workout) logs" + }, "labelWorkoutPlan": "Workout plan", "@labelWorkoutPlan": { "description": "Title for screen workout plan" diff --git a/lib/screens/workout_plan_screen.dart b/lib/screens/workout_plan_screen.dart index 4b03f1b3d..4f69103ad 100644 --- a/lib/screens/workout_plan_screen.dart +++ b/lib/screens/workout_plan_screen.dart @@ -121,14 +121,14 @@ class _WorkoutPlanScreenState extends State { itemBuilder: (BuildContext context) { return [ PopupMenuItem( - value: WorkoutOptions.edit, - child: Text(AppLocalizations.of(context)!.edit), + child: _mode == WorkoutScreenMode.log + ? Text(AppLocalizations.of(context)!.labelWorkoutPlan) + : Text(AppLocalizations.of(context)!.labelWorkoutLogs), + value: WorkoutOptions.toggleMode, ), PopupMenuItem( - child: _mode == WorkoutScreenMode.log - ? Text('Open workout') - : Text('Open logs'), - value: WorkoutOptions.toggleMode, + value: WorkoutOptions.edit, + child: Text(AppLocalizations.of(context)!.edit), ), const PopupMenuDivider(), PopupMenuItem( diff --git a/lib/widgets/app_drawer.dart b/lib/widgets/app_drawer.dart index 4c0d6e438..47ac697bc 100644 --- a/lib/widgets/app_drawer.dart +++ b/lib/widgets/app_drawer.dart @@ -103,7 +103,7 @@ class AppDrawer extends StatelessWidget { ListTile( //dense: true, leading: Icon(Icons.exit_to_app), - title: Text('Logout'), + title: Text(AppLocalizations.of(context)!.logout), onTap: () { Provider.of(context, listen: false).logout(); Navigator.of(context).pop(); diff --git a/lib/widgets/dashboard/calendar.dart b/lib/widgets/dashboard/calendar.dart index a710f47f7..b3b5e933a 100644 --- a/lib/widgets/dashboard/calendar.dart +++ b/lib/widgets/dashboard/calendar.dart @@ -372,21 +372,6 @@ class _DashboardCalendarWidgetState extends State ), ], ); - - return Column( - children: [ - TextButton( - child: Text('Go to today'), - onPressed: () { - final today = DateTime.now(); - _calendarController.setSelectedDay( - DateTime(today.year, today.month, today.day), - runCallback: true, - ); - }, - ), - ], - ); } Widget _buildEventList() { diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index 736edb169..a95cd8f96 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -114,7 +114,10 @@ class NutritionalPlanDetailWidget extends StatelessWidget { ), ), Padding(padding: const EdgeInsets.all(8.0)), - Text('Diary', style: Theme.of(context).textTheme.headline6), + Text( + AppLocalizations.of(context)!.nutritionalDiary, + style: Theme.of(context).textTheme.headline6, + ), Container( padding: EdgeInsets.all(15), height: 220, diff --git a/lib/widgets/weight/entries_list.dart b/lib/widgets/weight/entries_list.dart index d3e1dcf32..a6580b433 100644 --- a/lib/widgets/weight/entries_list.dart +++ b/lib/widgets/weight/entries_list.dart @@ -55,7 +55,7 @@ class WeightEntriesList extends StatelessWidget { ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( - "Deleted weight entry for the ${DateFormat.yMd().format(currentEntry.date).toString()}", + AppLocalizations.of(context)!.successfullyDeleted, textAlign: TextAlign.center, ), ), diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index 600bba6b4..fcdc5f1d6 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -151,7 +151,7 @@ class _DayFormWidgetState extends State { decoration: InputDecoration( labelText: AppLocalizations.of(context)!.description, helperText: AppLocalizations.of(context)!.dayDescriptionHelp, - helperMaxLines: 2, + helperMaxLines: 3, ), controller: widget.dayController, onSaved: (value) { diff --git a/lib/widgets/workouts/log.dart b/lib/widgets/workouts/log.dart index b5dcacad7..aba676e4c 100644 --- a/lib/widgets/workouts/log.dart +++ b/lib/widgets/workouts/log.dart @@ -137,11 +137,14 @@ class DayLogWidget extends StatelessWidget { style: Theme.of(context).textTheme.headline5, ), ..._day.sets.map((set) => getSetRow(set)).toList(), + /* OutlinedButton( child: Text('Add logs to this day'), onPressed: () {}, ), Padding(padding: const EdgeInsets.symmetric(vertical: 10.0)) + + */ ], ), ); diff --git a/lib/widgets/workouts/workout_logs.dart b/lib/widgets/workouts/workout_logs.dart index bef110723..280831522 100644 --- a/lib/widgets/workouts/workout_logs.dart +++ b/lib/widgets/workouts/workout_logs.dart @@ -44,7 +44,7 @@ class _WorkoutLogsState extends State { Padding( padding: const EdgeInsets.symmetric(vertical: 10), child: Text( - 'Weight Log', + AppLocalizations.of(context)!.labelWorkoutLogs, style: Theme.of(context).textTheme.headline5, ), ), @@ -73,7 +73,7 @@ class _WorkoutLogsState extends State { ), ), ElevatedButton( - child: Text('Back to workout'), + child: Text(AppLocalizations.of(context)!.labelWorkoutPlan), onPressed: () { widget._changeMode(WorkoutScreenMode.workout); }, diff --git a/lib/widgets/workouts/workout_plan_detail.dart b/lib/widgets/workouts/workout_plan_detail.dart index 10fbac709..2cd7aed6d 100644 --- a/lib/widgets/workouts/workout_plan_detail.dart +++ b/lib/widgets/workouts/workout_plan_detail.dart @@ -20,7 +20,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:wger/models/workouts/workout_plan.dart'; import 'package:wger/screens/form_screen.dart'; -import 'package:wger/screens/workout_plan_screen.dart'; import 'package:wger/widgets/workouts/day.dart'; import 'package:wger/widgets/workouts/forms.dart'; @@ -70,12 +69,14 @@ class _WorkoutPlanDetailState extends State { ); }, ), + /* ElevatedButton( child: Text('View logs'), onPressed: () { widget._changeMode(WorkoutScreenMode.log); }, ), + */ ], ), ], From e3dc898a6e2586ce6b0cebb6b505734ec82fe0bd Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 10 Apr 2021 13:18:23 +0200 Subject: [PATCH 44/69] Return created workout and nutrition plan --- lib/widgets/nutrition/forms.dart | 2 +- lib/widgets/workouts/forms.dart | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index d6cffbaf0..2fe5fa381 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -229,7 +229,7 @@ class PlanForm extends StatelessWidget { try { _plan.id != null ? await Provider.of(context, listen: false).editPlan(_plan) - : await Provider.of(context, listen: false).addPlan(_plan); + : _plan = await Provider.of(context, listen: false).addPlan(_plan); // Saving was successful, reset the data _descriptionController.clear(); diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index fcdc5f1d6..cbf5da270 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -79,7 +79,8 @@ class WorkoutForm extends StatelessWidget { // Save to DB _plan.id != null ? await Provider.of(context, listen: false).editWorkout(_plan) - : await Provider.of(context, listen: false).addWorkout(_plan); + : _plan = + await Provider.of(context, listen: false).addWorkout(_plan); Navigator.of(context).pushReplacementNamed( WorkoutPlanScreen.routeName, From c363908099a167666f33e404ebf453a4ae5aa139 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 12 Apr 2021 12:42:37 +0200 Subject: [PATCH 45/69] Add app store exception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks, apple 🙄 CLoses #10 --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b9ed36e41..6c6012427 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,15 @@ file a bug anyway. ## License -The application is licensed under the GNU General Public License 3 or later (GPL 3+). +The application is licensed under the GNU General Public License 3 or later (GPL 3+) +with an app store exception. + +As an additional permission under section 7, you are allowed to distribute the +software through an app store, even if that store has restrictive terms and +conditions that are incompatible with the AGPL, provided that the source is also +available under the AGPL with or without this permission through a channel without +those restrictive terms and conditions. + The initial exercise and ingredient data is licensed additionally under one of the Creative Commons licenses, see the individual exercises for more details. From 7bfa13992be8293e2f6504e2fd1c5e0d0f4cf452 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 12 Apr 2021 12:42:52 +0200 Subject: [PATCH 46/69] Bump versions --- Gemfile.lock | 4 ++-- android/fastlane/report.xml | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 26788305e..0f31a7393 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.1.1) - aws-partitions (1.441.0) + aws-partitions (1.443.0) aws-sdk-core (3.113.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) @@ -48,7 +48,7 @@ GEM faraday_middleware (1.0.0) faraday (~> 1.0) fastimage (2.2.3) - fastlane (2.179.0) + fastlane (2.180.1) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) artifactory (~> 3.0) diff --git a/android/fastlane/report.xml b/android/fastlane/report.xml index 51edf49b7..c165153e7 100644 --- a/android/fastlane/report.xml +++ b/android/fastlane/report.xml @@ -5,12 +5,12 @@ - + - + diff --git a/pubspec.yaml b/pubspec.yaml index 15287aaec..b770683e6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.2.0+8 +version: 0.2.0+9 environment: sdk: '>=2.12.0 <3.0.0' From 33bd1f2933ca66c77a7e14c62c8584f373f510d2 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 12 Apr 2021 12:46:40 +0200 Subject: [PATCH 47/69] Add weblate translation widget to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6c6012427..fb97c2fc6 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ You can run the tests with ``flutter test --no-sound-null-safety`` ## Translation The application can be easily translated online with [Weblate](https://hosted.weblate.org/engage/wger/). +![translation widget](https://hosted.weblate.org/widgets/wger/-/web/multi-blue.svg) + ## Contact From 26455926f9518bfb0cf36f3146096619ebdfc5cb Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 12 Apr 2021 12:48:54 +0200 Subject: [PATCH 48/69] Use correct status widget --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb97c2fc6..6c28c1b40 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ You can run the tests with ``flutter test --no-sound-null-safety`` ## Translation The application can be easily translated online with [Weblate](https://hosted.weblate.org/engage/wger/). -![translation widget](https://hosted.weblate.org/widgets/wger/-/web/multi-blue.svg) +![translation widget](https://hosted.weblate.org/widgets/wger/-/mobile/multi-blue.svg) ## Contact From e25058104699e6c62fe2132637fdf412651cdc9a Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 12 Apr 2021 12:51:14 +0200 Subject: [PATCH 49/69] Make translation status clickable --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c28c1b40..99273d5cd 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ You can run the tests with ``flutter test --no-sound-null-safety`` ## Translation The application can be easily translated online with [Weblate](https://hosted.weblate.org/engage/wger/). -![translation widget](https://hosted.weblate.org/widgets/wger/-/mobile/multi-blue.svg) +[![translation status](https://hosted.weblate.org/widgets/wger/-/mobile/multi-blue.svg)](https://hosted.weblate.org/engage/wger/) ## Contact From 0bcfa178fdd90d82b2fb5bb5c4500460221e8750 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 12 Apr 2021 20:40:51 +0200 Subject: [PATCH 50/69] Mention the correct license in the readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99273d5cd..aa6ac3dc0 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,8 @@ file a bug anyway. ## License -The application is licensed under the GNU General Public License 3 or later (GPL 3+) -with an app store exception. +The application is licensed under the GNU Affero General Public License 3 or later +(AGPL 3+) with an app store exception. As an additional permission under section 7, you are allowed to distribute the software through an app store, even if that store has restrictive terms and From 9c851f202f3879d2a9f9025d59f8fdd8bd0ceff2 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 09:48:27 +0200 Subject: [PATCH 51/69] Add test for setting model --- lib/models/workouts/setting.dart | 2 +- test/setting_model_test.dart | 91 ++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 test/setting_model_test.dart diff --git a/lib/models/workouts/setting.dart b/lib/models/workouts/setting.dart index 924ef4730..a17a421ac 100644 --- a/lib/models/workouts/setting.dart +++ b/lib/models/workouts/setting.dart @@ -110,7 +110,7 @@ class Setting { // rather "8 repetitions". If there is weight we want to output "8 x 50kg", // since the repetitions are implied. If other units are used, we always // print them - if (repetitionUnitId != DEFAULT_REPETITION_UNIT || weight == 0) { + if (repetitionUnitId != DEFAULT_REPETITION_UNIT || weight == 0 || weight == null) { out.add(repetitionUnitObj.name); } } diff --git a/test/setting_model_test.dart b/test/setting_model_test.dart new file mode 100644 index 000000000..36680d1db --- /dev/null +++ b/test/setting_model_test.dart @@ -0,0 +1,91 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import 'package:flutter_test/flutter_test.dart'; +import 'package:wger/models/workouts/repetition_unit.dart'; +import 'package:wger/models/workouts/setting.dart'; +import 'package:wger/models/workouts/weight_unit.dart'; + +void main() { + group('Test the singleSettingRepText method', () { + test('Default rep and weight units, no RiR', () async { + final repUnit = RepetitionUnit(id: 1, name: 'mol'); + final weightUnit = WeightUnit(id: 1, name: 'mg'); + + var setting = Setting.empty(); + setting.reps = 2; + setting.weight = 30; + setting.rir = ''; + setting.setRepetitionUnit(repUnit); + setting.setWeightUnit(weightUnit); + expect(setting.singleSettingRepText, '2 × 30 mg'); + }); + + test('Default rep and weight units', () async { + final repUnit = RepetitionUnit(id: 1, name: 'mol'); + final weightUnit = WeightUnit(id: 1, name: 'mg'); + + var setting = Setting.empty(); + setting.reps = 2; + setting.weight = 30; + setting.rir = '1.5'; + setting.setRepetitionUnit(repUnit); + setting.setWeightUnit(weightUnit); + expect(setting.singleSettingRepText, '2 × 30 mg \n (1.5 RiR)'); + }); + + test('No weight, default rep and weight units', () async { + final repUnit = RepetitionUnit(id: 1, name: 'mol'); + final weightUnit = WeightUnit(id: 1, name: 'mg'); + + var setting = Setting.empty(); + setting.reps = 2; + setting.weight = null; + setting.rir = '1.5'; + setting.setRepetitionUnit(repUnit); + setting.setWeightUnit(weightUnit); + expect(setting.singleSettingRepText, '2 mol \n (1.5 RiR)'); + }); + + test('Custom rep and weight units, no RiR', () async { + final repUnit = RepetitionUnit(id: 2, name: 'mol'); + final weightUnit = WeightUnit(id: 2, name: 'mg'); + + var setting = Setting.empty(); + setting.reps = 2; + setting.weight = 30; + setting.rir = ''; + setting.setRepetitionUnit(repUnit); + setting.setWeightUnit(weightUnit); + expect(setting.singleSettingRepText, '2 mol × 30 mg'); + }); + + test('Custom rep and weight units, RiR', () async { + final repUnit = RepetitionUnit(id: 2, name: 'mol'); + final weightUnit = WeightUnit(id: 2, name: 'mg'); + + var setting = Setting.empty(); + setting.reps = 2; + setting.weight = 30; + setting.rir = '3'; + setting.setRepetitionUnit(repUnit); + setting.setWeightUnit(weightUnit); + expect(setting.singleSettingRepText, '2 mol × 30 mg \n (3 RiR)'); + }); + }); +} From ad7507c8b7e91e4649f6f1d96b474e4d12c4706d Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 10:24:51 +0200 Subject: [PATCH 52/69] Update license header as well --- lib/helpers/consts.dart | 13 ++++++------- lib/helpers/json.dart | 12 ++++++------ lib/helpers/ui.dart | 12 ++++++------ lib/main.dart | 10 +++++----- lib/models/body_weight/weight_entry.dart | 12 ++++++------ lib/models/exercises/category.dart | 12 ++++++------ lib/models/exercises/comment.dart | 12 ++++++------ lib/models/exercises/equipment.dart | 12 ++++++------ lib/models/exercises/exercise.dart | 12 ++++++------ lib/models/exercises/image.dart | 12 ++++++------ lib/models/exercises/muscle.dart | 12 ++++++------ lib/models/http_exception.dart | 12 ++++++------ lib/models/nutrition/ingredient.dart | 13 ++++++------- .../nutrition/ingredient_weight_unit.dart | 12 ++++++------ lib/models/nutrition/log.dart | 12 ++++++------ lib/models/nutrition/meal.dart | 12 ++++++------ lib/models/nutrition/meal_item.dart | 12 ++++++------ lib/models/nutrition/nutritional_plan.dart | 12 ++++++------ lib/models/nutrition/nutritrional_values.dart | 10 +++++----- lib/models/nutrition/weight_unit.dart | 12 ++++++------ lib/models/workouts/day.dart | 18 ++++++++++++++++++ lib/models/workouts/log.dart | 18 ++++++++++++++++++ lib/models/workouts/repetition_unit.dart | 18 ++++++++++++++++++ lib/models/workouts/session.dart | 18 ++++++++++++++++++ lib/models/workouts/set.dart | 18 ++++++++++++++++++ lib/models/workouts/setting.dart | 18 ++++++++++++++++++ lib/models/workouts/weight_unit.dart | 18 ++++++++++++++++++ lib/providers/auth.dart | 12 ++++++------ lib/providers/base_provider.dart | 12 ++++++------ lib/providers/body_weight.dart | 12 ++++++------ lib/providers/exercises.dart | 12 ++++++------ lib/providers/helpers.dart | 10 +++++----- lib/providers/nutrition.dart | 12 ++++++------ lib/providers/workout_plans.dart | 12 ++++++------ lib/screens/auth_screen.dart | 12 ++++++------ lib/screens/dashboard.dart | 12 ++++++------ lib/screens/form_screen.dart | 13 +++++++------ lib/screens/gym_mode.dart | 12 ++++++------ lib/screens/home_tabs_screen.dart | 12 ++++++------ lib/screens/nutritional_plan_screen.dart | 10 +++++----- lib/screens/nutritional_plans_screen.dart | 10 +++++----- lib/screens/splash_screen.dart | 10 +++++----- lib/screens/weight_screen.dart | 10 +++++----- lib/screens/workout_plan_screen.dart | 10 +++++----- lib/screens/workout_plans_screen.dart | 10 +++++----- lib/theme/theme.dart | 10 +++++----- lib/widgets/app_drawer.dart | 10 +++++----- lib/widgets/core/core.dart | 8 ++++---- lib/widgets/dashboard/calendar.dart | 8 ++++---- lib/widgets/dashboard/widgets.dart | 8 ++++---- lib/widgets/nutrition/charts.dart | 8 ++++---- lib/widgets/nutrition/forms.dart | 8 ++++---- lib/widgets/nutrition/meal.dart | 8 ++++---- .../nutrition/nutritional_plan_detail.dart | 9 ++++----- .../nutrition/nutritional_plans_list.dart | 10 +++++----- lib/widgets/weight/charts.dart | 8 ++++---- lib/widgets/weight/entries_list.dart | 10 +++++----- lib/widgets/weight/forms.dart | 18 ++++++++++++++++++ lib/widgets/workouts/charts.dart | 9 +++++---- lib/widgets/workouts/day.dart | 10 +++++----- lib/widgets/workouts/exercises.dart | 8 ++++---- lib/widgets/workouts/forms.dart | 8 ++++---- lib/widgets/workouts/gym_mode.dart | 10 +++++----- lib/widgets/workouts/log.dart | 8 ++++---- lib/widgets/workouts/workout_logs.dart | 10 +++++----- lib/widgets/workouts/workout_plan_detail.dart | 10 +++++----- lib/widgets/workouts/workout_plans_list.dart | 10 +++++----- test/auth_screen_test.dart | 10 +++++----- test/base_provider_test.dart | 10 +++++----- test/nutritional_plans_screen_test.dart | 10 +++++----- test/setting_model_test.dart | 10 +++++----- test/utils.dart | 8 ++++---- test/weight_model_test.dart | 10 +++++----- test/weight_provider_test.dart | 10 +++++----- test/weight_screen_test.dart | 10 +++++----- test/workout_plans_screen_test.dart | 10 +++++----- 76 files changed, 502 insertions(+), 359 deletions(-) diff --git a/lib/helpers/consts.dart b/lib/helpers/consts.dart index 2a77ddfc9..37f3318ac 100644 --- a/lib/helpers/consts.dart +++ b/lib/helpers/consts.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ /// Size for the "smaller" icons, e.g. when they belong to less important items @@ -22,7 +22,6 @@ const double ICON_SIZE_SMALL = 20; /// Default wger server during login const DEFAULT_SERVER = 'https://wger.rge.uber.space'; -//final DEFAULT_SERVER = 'http://localhost:8000'; /// Default weight unit is "kg" const DEFAULT_WEIGHT_UNIT = 1; diff --git a/lib/helpers/json.dart b/lib/helpers/json.dart index c6d8e2053..e5f288f39 100644 --- a/lib/helpers/json.dart +++ b/lib/helpers/json.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/helpers/ui.dart b/lib/helpers/ui.dart index c6ae1e976..fc16db870 100644 --- a/lib/helpers/ui.dart +++ b/lib/helpers/ui.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'dart:developer'; diff --git a/lib/main.dart b/lib/main.dart index a0a2a4586..8092024fd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/models/body_weight/weight_entry.dart b/lib/models/body_weight/weight_entry.dart index bcc2a6900..ed8761bdf 100644 --- a/lib/models/body_weight/weight_entry.dart +++ b/lib/models/body_weight/weight_entry.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/exercises/category.dart b/lib/models/exercises/category.dart index 6f93e46e3..ed698d9fb 100644 --- a/lib/models/exercises/category.dart +++ b/lib/models/exercises/category.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/exercises/comment.dart b/lib/models/exercises/comment.dart index 8c242300f..e9461502b 100644 --- a/lib/models/exercises/comment.dart +++ b/lib/models/exercises/comment.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/exercises/equipment.dart b/lib/models/exercises/equipment.dart index f56bbf56c..2a9c3eecc 100644 --- a/lib/models/exercises/equipment.dart +++ b/lib/models/exercises/equipment.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/exercises/exercise.dart b/lib/models/exercises/exercise.dart index e47686e19..b65861110 100644 --- a/lib/models/exercises/exercise.dart +++ b/lib/models/exercises/exercise.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/exercises/image.dart b/lib/models/exercises/image.dart index c57b4a26e..38f9df738 100644 --- a/lib/models/exercises/image.dart +++ b/lib/models/exercises/image.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/exercises/muscle.dart b/lib/models/exercises/muscle.dart index f4ddb82f5..86bafeb80 100644 --- a/lib/models/exercises/muscle.dart +++ b/lib/models/exercises/muscle.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/http_exception.dart b/lib/models/http_exception.dart index e6a018b11..d2d48ddc6 100644 --- a/lib/models/http_exception.dart +++ b/lib/models/http_exception.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'dart:convert'; diff --git a/lib/models/nutrition/ingredient.dart b/lib/models/nutrition/ingredient.dart index 54d723866..f58ffcf4f 100644 --- a/lib/models/nutrition/ingredient.dart +++ b/lib/models/nutrition/ingredient.dart @@ -1,21 +1,20 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ - import 'package:json_annotation/json_annotation.dart'; import 'package:wger/helpers/json.dart'; diff --git a/lib/models/nutrition/ingredient_weight_unit.dart b/lib/models/nutrition/ingredient_weight_unit.dart index 951608273..da71c9c10 100644 --- a/lib/models/nutrition/ingredient_weight_unit.dart +++ b/lib/models/nutrition/ingredient_weight_unit.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/nutrition/log.dart b/lib/models/nutrition/log.dart index 28c80fec0..cdb0155c3 100644 --- a/lib/models/nutrition/log.dart +++ b/lib/models/nutrition/log.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/nutrition/meal.dart b/lib/models/nutrition/meal.dart index ae57244d9..b165e6e84 100644 --- a/lib/models/nutrition/meal.dart +++ b/lib/models/nutrition/meal.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/models/nutrition/meal_item.dart b/lib/models/nutrition/meal_item.dart index 32136ab09..578da11c9 100644 --- a/lib/models/nutrition/meal_item.dart +++ b/lib/models/nutrition/meal_item.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/nutrition/nutritional_plan.dart b/lib/models/nutrition/nutritional_plan.dart index e432a670a..292dd938b 100644 --- a/lib/models/nutrition/nutritional_plan.dart +++ b/lib/models/nutrition/nutritional_plan.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/nutrition/nutritrional_values.dart b/lib/models/nutrition/nutritrional_values.dart index bb1c86cef..4fd856f53 100644 --- a/lib/models/nutrition/nutritrional_values.dart +++ b/lib/models/nutrition/nutritrional_values.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/models/nutrition/weight_unit.dart b/lib/models/nutrition/weight_unit.dart index df4bbf0cc..3bcab86ec 100644 --- a/lib/models/nutrition/weight_unit.dart +++ b/lib/models/nutrition/weight_unit.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:json_annotation/json_annotation.dart'; diff --git a/lib/models/workouts/day.dart b/lib/models/workouts/day.dart index abe6f8a18..1a61b6e8e 100644 --- a/lib/models/workouts/day.dart +++ b/lib/models/workouts/day.dart @@ -1,3 +1,21 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import 'package:json_annotation/json_annotation.dart'; import 'package:wger/models/workouts/set.dart'; diff --git a/lib/models/workouts/log.dart b/lib/models/workouts/log.dart index 4b43826c1..e22f01ef7 100644 --- a/lib/models/workouts/log.dart +++ b/lib/models/workouts/log.dart @@ -1,3 +1,21 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import 'package:json_annotation/json_annotation.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/models/exercises/exercise.dart'; diff --git a/lib/models/workouts/repetition_unit.dart b/lib/models/workouts/repetition_unit.dart index a43bf7d43..6c1c2fb87 100644 --- a/lib/models/workouts/repetition_unit.dart +++ b/lib/models/workouts/repetition_unit.dart @@ -1,3 +1,21 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import 'package:json_annotation/json_annotation.dart'; part 'repetition_unit.g.dart'; diff --git a/lib/models/workouts/session.dart b/lib/models/workouts/session.dart index 65b9108af..46a1a9105 100644 --- a/lib/models/workouts/session.dart +++ b/lib/models/workouts/session.dart @@ -1,3 +1,21 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import 'package:flutter/material.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:wger/helpers/json.dart'; diff --git a/lib/models/workouts/set.dart b/lib/models/workouts/set.dart index e23c0f5a2..8753a094f 100644 --- a/lib/models/workouts/set.dart +++ b/lib/models/workouts/set.dart @@ -1,3 +1,21 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import 'package:json_annotation/json_annotation.dart'; import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/workouts/setting.dart'; diff --git a/lib/models/workouts/setting.dart b/lib/models/workouts/setting.dart index a17a421ac..b08df1437 100644 --- a/lib/models/workouts/setting.dart +++ b/lib/models/workouts/setting.dart @@ -1,3 +1,21 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import 'package:json_annotation/json_annotation.dart'; import 'package:wger/helpers/consts.dart'; import 'package:wger/helpers/json.dart'; diff --git a/lib/models/workouts/weight_unit.dart b/lib/models/workouts/weight_unit.dart index 88aa74fbd..3bcab86ec 100644 --- a/lib/models/workouts/weight_unit.dart +++ b/lib/models/workouts/weight_unit.dart @@ -1,3 +1,21 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import 'package:json_annotation/json_annotation.dart'; part 'weight_unit.g.dart'; diff --git a/lib/providers/auth.dart b/lib/providers/auth.dart index 4891742f6..089b2cd52 100644 --- a/lib/providers/auth.dart +++ b/lib/providers/auth.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'dart:async'; diff --git a/lib/providers/base_provider.dart b/lib/providers/base_provider.dart index 8a9e206d5..4814f5365 100644 --- a/lib/providers/base_provider.dart +++ b/lib/providers/base_provider.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'dart:convert'; diff --git a/lib/providers/body_weight.dart b/lib/providers/body_weight.dart index c096b8183..fa92ade08 100644 --- a/lib/providers/body_weight.dart +++ b/lib/providers/body_weight.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/providers/exercises.dart b/lib/providers/exercises.dart index 861de5f3a..3c3463c95 100644 --- a/lib/providers/exercises.dart +++ b/lib/providers/exercises.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'dart:async'; diff --git a/lib/providers/helpers.dart b/lib/providers/helpers.dart index 4ddf5d401..b792a60fc 100644 --- a/lib/providers/helpers.dart +++ b/lib/providers/helpers.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/providers/nutrition.dart b/lib/providers/nutrition.dart index 4baa6e66d..334e2101d 100644 --- a/lib/providers/nutrition.dart +++ b/lib/providers/nutrition.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'dart:convert'; diff --git a/lib/providers/workout_plans.dart b/lib/providers/workout_plans.dart index 145a274d6..fb9046c4a 100644 --- a/lib/providers/workout_plans.dart +++ b/lib/providers/workout_plans.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'dart:convert'; diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index 97a0c6001..cd7aad147 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/screens/dashboard.dart b/lib/screens/dashboard.dart index f08c51247..bf82bb761 100644 --- a/lib/screens/dashboard.dart +++ b/lib/screens/dashboard.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/cupertino.dart'; diff --git a/lib/screens/form_screen.dart b/lib/screens/form_screen.dart index dc9f70c71..7b092099e 100644 --- a/lib/screens/form_screen.dart +++ b/lib/screens/form_screen.dart @@ -1,20 +1,21 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ + import 'package:flutter/material.dart'; /// Arguments passed to the form screen diff --git a/lib/screens/gym_mode.dart b/lib/screens/gym_mode.dart index 3b457a161..90dbb5b08 100644 --- a/lib/screens/gym_mode.dart +++ b/lib/screens/gym_mode.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/screens/home_tabs_screen.dart b/lib/screens/home_tabs_screen.dart index 3d03b2e7c..674b6853b 100644 --- a/lib/screens/home_tabs_screen.dart +++ b/lib/screens/home_tabs_screen.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * wger Workout Manager is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/screens/nutritional_plan_screen.dart b/lib/screens/nutritional_plan_screen.dart index be6d93334..e878d8984 100644 --- a/lib/screens/nutritional_plan_screen.dart +++ b/lib/screens/nutritional_plan_screen.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/screens/nutritional_plans_screen.dart b/lib/screens/nutritional_plans_screen.dart index 278604e1e..311440802 100644 --- a/lib/screens/nutritional_plans_screen.dart +++ b/lib/screens/nutritional_plans_screen.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/screens/splash_screen.dart b/lib/screens/splash_screen.dart index 78dab998e..8b00bcff5 100644 --- a/lib/screens/splash_screen.dart +++ b/lib/screens/splash_screen.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/screens/weight_screen.dart b/lib/screens/weight_screen.dart index 06cb9e801..b18c22423 100644 --- a/lib/screens/weight_screen.dart +++ b/lib/screens/weight_screen.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/screens/workout_plan_screen.dart b/lib/screens/workout_plan_screen.dart index 4f69103ad..592491f81 100644 --- a/lib/screens/workout_plan_screen.dart +++ b/lib/screens/workout_plan_screen.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/screens/workout_plans_screen.dart b/lib/screens/workout_plans_screen.dart index b7ee37279..8fc20fb77 100644 --- a/lib/screens/workout_plans_screen.dart +++ b/lib/screens/workout_plans_screen.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/cupertino.dart'; diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart index 142607a59..b91abbb12 100644 --- a/lib/theme/theme.dart +++ b/lib/theme/theme.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:charts_flutter/flutter.dart' as charts; diff --git a/lib/widgets/app_drawer.dart b/lib/widgets/app_drawer.dart index 47ac697bc..0e7bd7dd4 100644 --- a/lib/widgets/app_drawer.dart +++ b/lib/widgets/app_drawer.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/gestures.dart'; diff --git a/lib/widgets/core/core.dart b/lib/widgets/core/core.dart index ee041f5ec..8a8382412 100644 --- a/lib/widgets/core/core.dart +++ b/lib/widgets/core/core.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/widgets/dashboard/calendar.dart b/lib/widgets/dashboard/calendar.dart index b3b5e933a..9eaeab26e 100644 --- a/lib/widgets/dashboard/calendar.dart +++ b/lib/widgets/dashboard/calendar.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ import 'dart:developer'; diff --git a/lib/widgets/dashboard/widgets.dart b/lib/widgets/dashboard/widgets.dart index 5a2a63fca..41bd1cc93 100644 --- a/lib/widgets/dashboard/widgets.dart +++ b/lib/widgets/dashboard/widgets.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/widgets/nutrition/charts.dart b/lib/widgets/nutrition/charts.dart index 6c46f82c8..cf8adc7f7 100644 --- a/lib/widgets/nutrition/charts.dart +++ b/lib/widgets/nutrition/charts.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 2fe5fa381..1071e276c 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/widgets/nutrition/meal.dart b/lib/widgets/nutrition/meal.dart index 150dfd533..55e56c370 100644 --- a/lib/widgets/nutrition/meal.dart +++ b/lib/widgets/nutrition/meal.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index a95cd8f96..35713b577 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ @@ -24,7 +24,6 @@ import 'package:wger/models/nutrition/nutritrional_values.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/widgets/nutrition/charts.dart'; import 'package:wger/widgets/nutrition/forms.dart'; -import 'package:wger/widgets/nutrition/meal.dart'; class NutritionalPlanDetailWidget extends StatelessWidget { final NutritionalPlan _nutritionalPlan; diff --git a/lib/widgets/nutrition/nutritional_plans_list.dart b/lib/widgets/nutrition/nutritional_plans_list.dart index 3ceb86ff3..88d70821d 100644 --- a/lib/widgets/nutrition/nutritional_plans_list.dart +++ b/lib/widgets/nutrition/nutritional_plans_list.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/widgets/weight/charts.dart b/lib/widgets/weight/charts.dart index 66e1031d3..4ccfa9d96 100644 --- a/lib/widgets/weight/charts.dart +++ b/lib/widgets/weight/charts.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/widgets/weight/entries_list.dart b/lib/widgets/weight/entries_list.dart index a6580b433..5b21e6a64 100644 --- a/lib/widgets/weight/entries_list.dart +++ b/lib/widgets/weight/entries_list.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/widgets/weight/forms.dart b/lib/widgets/weight/forms.dart index 17e10f0cb..f8f6c0781 100644 --- a/lib/widgets/weight/forms.dart +++ b/lib/widgets/weight/forms.dart @@ -1,3 +1,21 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; diff --git a/lib/widgets/workouts/charts.dart b/lib/widgets/workouts/charts.dart index 1bc0d43cc..f9316f89b 100644 --- a/lib/widgets/workouts/charts.dart +++ b/lib/widgets/workouts/charts.dart @@ -1,20 +1,21 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ + import 'package:charts_flutter/flutter.dart' as charts; import 'package:flutter/widgets.dart'; diff --git a/lib/widgets/workouts/day.dart b/lib/widgets/workouts/day.dart index 39fcbf575..3c09a5392 100644 --- a/lib/widgets/workouts/day.dart +++ b/lib/widgets/workouts/day.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/widgets/workouts/exercises.dart b/lib/widgets/workouts/exercises.dart index fbc075ca2..56b055e0e 100644 --- a/lib/widgets/workouts/exercises.dart +++ b/lib/widgets/workouts/exercises.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index cbf5da270..99cfacc8f 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index c4dba2c6d..c3abe18b7 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'dart:async'; diff --git a/lib/widgets/workouts/log.dart b/lib/widgets/workouts/log.dart index aba676e4c..9a21c9173 100644 --- a/lib/widgets/workouts/log.dart +++ b/lib/widgets/workouts/log.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/lib/widgets/workouts/workout_logs.dart b/lib/widgets/workouts/workout_logs.dart index 280831522..1b47e468d 100644 --- a/lib/widgets/workouts/workout_logs.dart +++ b/lib/widgets/workouts/workout_logs.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/widgets/workouts/workout_plan_detail.dart b/lib/widgets/workouts/workout_plan_detail.dart index 2cd7aed6d..5da82784a 100644 --- a/lib/widgets/workouts/workout_plan_detail.dart +++ b/lib/widgets/workouts/workout_plan_detail.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/lib/widgets/workouts/workout_plans_list.dart b/lib/widgets/workouts/workout_plans_list.dart index 40c73be98..75fcbfc73 100644 --- a/lib/widgets/workouts/workout_plans_list.dart +++ b/lib/widgets/workouts/workout_plans_list.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/test/auth_screen_test.dart b/test/auth_screen_test.dart index cd09dd797..938233757 100644 --- a/test/auth_screen_test.dart +++ b/test/auth_screen_test.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/test/base_provider_test.dart b/test/base_provider_test.dart index 9392cda94..bfec04ae9 100644 --- a/test/base_provider_test.dart +++ b/test/base_provider_test.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter_test/flutter_test.dart'; diff --git a/test/nutritional_plans_screen_test.dart b/test/nutritional_plans_screen_test.dart index 3cddf8500..fa7a235e5 100644 --- a/test/nutritional_plans_screen_test.dart +++ b/test/nutritional_plans_screen_test.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/test/setting_model_test.dart b/test/setting_model_test.dart index 36680d1db..635c9dfc3 100644 --- a/test/setting_model_test.dart +++ b/test/setting_model_test.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter_test/flutter_test.dart'; diff --git a/test/utils.dart b/test/utils.dart index 2ca30996e..4c73d26c3 100644 --- a/test/utils.dart +++ b/test/utils.dart @@ -1,18 +1,18 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ diff --git a/test/weight_model_test.dart b/test/weight_model_test.dart index d3ff463e3..5b006206b 100644 --- a/test/weight_model_test.dart +++ b/test/weight_model_test.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter_test/flutter_test.dart'; diff --git a/test/weight_provider_test.dart b/test/weight_provider_test.dart index 260034daf..474547727 100644 --- a/test/weight_provider_test.dart +++ b/test/weight_provider_test.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'dart:io'; diff --git a/test/weight_screen_test.dart b/test/weight_screen_test.dart index 5dc34f27e..e8e2c489a 100644 --- a/test/weight_screen_test.dart +++ b/test/weight_screen_test.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; diff --git a/test/workout_plans_screen_test.dart b/test/workout_plans_screen_test.dart index 806bc3753..4c23c8549 100644 --- a/test/workout_plans_screen_test.dart +++ b/test/workout_plans_screen_test.dart @@ -1,19 +1,19 @@ /* * This file is part of wger Workout Manager . - * Copyright (C) 2020 wger Team + * Copyright (C) 2020, 2021 wger Team * * wger Workout Manager is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by + * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * wger Workout Manager is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ import 'package:flutter/material.dart'; From c663a65b1eda3a05b8a57fe442bb0f670bfef330 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 10:47:12 +0200 Subject: [PATCH 53/69] add missing import --- lib/widgets/nutrition/nutritional_plan_detail.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index 35713b577..9116af2a2 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -24,6 +24,7 @@ import 'package:wger/models/nutrition/nutritrional_values.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/widgets/nutrition/charts.dart'; import 'package:wger/widgets/nutrition/forms.dart'; +import 'package:wger/widgets/nutrition/meal.dart'; class NutritionalPlanDetailWidget extends StatelessWidget { final NutritionalPlan _nutritionalPlan; From 6973f2eb52611d4f0105f43c9c3129ff68d2599b Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 11:10:40 +0200 Subject: [PATCH 54/69] Read exercise data as UTF8 --- lib/providers/exercises.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/providers/exercises.dart b/lib/providers/exercises.dart index 3c3463c95..3844e6b11 100644 --- a/lib/providers/exercises.dart +++ b/lib/providers/exercises.dart @@ -19,6 +19,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:developer'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; @@ -117,11 +118,15 @@ class Exercises extends WgerBaseProvider with ChangeNotifier { await fetchAndSetMuscles(); await fetchAndSetEquipment(); - final response = await client.get(makeUrl( - _exercisesUrlPath, - query: {'limit': '1000'}, - )); - final exercisesData = json.decode(response.body) as Map; + final response = await client.get( + makeUrl( + _exercisesUrlPath, + query: {'limit': '1000'}, + ), + headers: { + HttpHeaders.contentTypeHeader: 'application/json; charset=UTF-8', + }); + final exercisesData = json.decode(utf8.decode(response.bodyBytes)) as Map; try { // Load exercises From fd32a86865436a4efb1dcef9c08f144f0af8b8e7 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 11:10:53 +0200 Subject: [PATCH 55/69] Bump versions --- pubspec.lock | 16 ++++++++-------- pubspec.yaml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 5b5bde415..4772ff1a0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "19.0.0" + version: "20.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.4.0" android_metadata: dependency: "direct main" description: @@ -196,7 +196,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" css_colors: dependency: transitive description: @@ -264,7 +264,7 @@ packages: name: flutter_calendar_carousel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.1" flutter_html: dependency: "direct main" description: @@ -370,7 +370,7 @@ packages: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.1" http_parser: dependency: transitive description: @@ -461,7 +461,7 @@ packages: name: mockito url: "https://pub.dartlang.org" source: hosted - version: "5.0.3" + version: "5.0.4" nested: dependency: transitive description: @@ -538,7 +538,7 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "4.0.2" + version: "4.1.0" platform: dependency: transitive description: @@ -872,7 +872,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.0.2" + version: "5.1.0" yaml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b770683e6..8de5e2f58 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: intl: ^0.17.0 http: ^0.13.0 shared_preferences: ^2.0.5 - flutter_calendar_carousel: ^2.0.0 + flutter_calendar_carousel: ^2.0.1 cupertino_icons: ^1.0.0 json_annotation: ^4.0.0 url_launcher: ^6.0.2 From d65c3e17799343d0af5fcb7d8ef669621fd16e2a Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 11:55:13 +0200 Subject: [PATCH 56/69] Show exercise category and equipment in gym mode --- lib/widgets/workouts/gym_mode.dart | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index c3abe18b7..25fe4fd87 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -35,6 +35,7 @@ import 'package:wger/models/workouts/workout_plan.dart'; import 'package:wger/providers/exercises.dart'; import 'package:wger/providers/workout_plans.dart'; import 'package:wger/theme/theme.dart'; +import 'package:wger/widgets/workouts/exercises.dart'; import 'package:wger/widgets/workouts/forms.dart'; class GymMode extends StatefulWidget { @@ -420,8 +421,33 @@ class ExerciseOverview extends StatelessWidget { ), Divider(), Expanded( - child: Html( - data: _exercise.description, + child: ListView( + children: [ + Text( + _exercise.categoryObj.name, + style: Theme.of(context).textTheme.headline6, + textAlign: TextAlign.center, + ), + ..._exercise.equipment + .map((e) => Text( + e.name, + style: Theme.of(context).textTheme.headline6, + textAlign: TextAlign.center, + )) + .toList(), + if (_exercise.images.length > 0) + Container( + width: double.infinity, + height: 200, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + ..._exercise.images.map((e) => ExerciseImageWidget(image: e)).toList(), + ], + ), + ), + Html(data: _exercise.description), + ], ), ), NavigationFooter(_controller, _ratioCompleted), From 6911160f1003bf002c7df10a7f5f0d9b85e531e5 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 11:57:03 +0200 Subject: [PATCH 57/69] Reduce vertical padding This is not needed anymore with the SafeArea widget --- lib/screens/gym_mode.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/gym_mode.dart b/lib/screens/gym_mode.dart index 90dbb5b08..0a33d9453 100644 --- a/lib/screens/gym_mode.dart +++ b/lib/screens/gym_mode.dart @@ -34,7 +34,7 @@ class GymModeScreen extends StatelessWidget { body: SafeArea( child: Consumer( builder: (context, value, child) => Padding( - padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 30), + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10), child: GymMode(_day), ), ), From 6275f54b33141e1709104b3003a47338bf51045c Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 12:58:37 +0200 Subject: [PATCH 58/69] Improve validator for set form Check that the user has entered at least the repetitions or the weight for at least one set --- lib/l10n/app_en.arb | 4 ++++ lib/widgets/workouts/forms.dart | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 891b485ad..44337b99b 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -295,6 +295,10 @@ "@goToToday": { "description": "Label on button to jump back to 'today' in the calendar widget" }, + "enterRepetitionsOrWeight": "Please fill in either the repetitions or the weight for at least one of the sets", + "@enterRepetitionsOrWeight": { + "description": "Error message when the user hasn't filled in the forms for exercise sets" + }, "enterValue": "Please enter a value", "@enterValue": { "description": "Error message when the user hasn't entered a value on a required field" diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index 99cfacc8f..dc7edfe49 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -279,6 +279,7 @@ class _SetFormWidgetState extends State { decoration: InputDecoration( labelText: AppLocalizations.of(context)!.exercise, helperMaxLines: 3, + errorMaxLines: 2, helperText: AppLocalizations.of(context)!.selectExercises), ), suggestionsCallback: (pattern) async { @@ -313,9 +314,16 @@ class _SetFormWidgetState extends State { this._exercisesController.text = ''; }, validator: (value) { + // At least one exercise must be selected if (widget._set.exercisesIds.length == 0) { return AppLocalizations.of(context)!.selectExercise; } + + // At least one setting has to be filled in + if (widget._set.settings.where((s) => s.weight == null && s.reps == null).length == + widget._set.settings.length) { + return AppLocalizations.of(context)!.enterRepetitionsOrWeight; + } return null; }, ), @@ -552,9 +560,11 @@ class RepsInputWidget extends StatelessWidget { } return null; }, - onSaved: (newValue) { - if (newValue != null && newValue != '') { - _setting.reps = int.parse(newValue); + onChanged: (newValue) { + if (newValue != '') { + try { + _setting.reps = int.parse(newValue); + } catch (e) {} } }, ); @@ -587,9 +597,11 @@ class WeightInputWidget extends StatelessWidget { } return null; }, - onSaved: (newValue) { - if (newValue != null && newValue != '') { - _setting.weight = double.parse(newValue); + onChanged: (newValue) { + if (newValue != '') { + try { + _setting.weight = double.parse(newValue); + } catch (e) {} } }, ); From e58d855b4f0209c318e614a0628b7d487eea2d85 Mon Sep 17 00:00:00 2001 From: Stefano Rossi Date: Mon, 12 Apr 2021 20:54:38 +0000 Subject: [PATCH 59/69] Translated using Weblate (Italian) Currently translated at 100.0% (99 of 99 strings) Translation: wger Workout Manager/Mobile App Translate-URL: https://hosted.weblate.org/projects/wger/mobile/it/ --- lib/l10n/app_it.arb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index e176b6c58..8795e8fdb 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -319,5 +319,21 @@ "addSet": "Aggiungi serie", "@addSet": { "description": "Label for the button that adds a set (to a workout day)" + }, + "start": "Inizia", + "@start": { + "description": "Label on button to start the gym mode (i.e., an imperative)" + }, + "successfullySaved": "Salvato con successo", + "@successfullySaved": { + "description": "Message when an item was successfully saved" + }, + "labelWorkoutLogs": "Registri allenamenti", + "@labelWorkoutLogs": { + "description": "(Workout) logs" + }, + "logout": "Disconnetti", + "@logout": { + "description": "Text for logout button" } } From 254cc4bdfead5aaa55ac17909e082dc041421fb5 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 16:30:05 +0200 Subject: [PATCH 60/69] Simplify nutrition diary by using a listview --- .../nutrition/nutritional_plan_detail.dart | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/lib/widgets/nutrition/nutritional_plan_detail.dart b/lib/widgets/nutrition/nutritional_plan_detail.dart index 9116af2a2..bee910c18 100644 --- a/lib/widgets/nutrition/nutritional_plan_detail.dart +++ b/lib/widgets/nutrition/nutritional_plan_detail.dart @@ -125,37 +125,35 @@ class NutritionalPlanDetailWidget extends StatelessWidget { ), Container( height: 200, - child: SingleChildScrollView( + child: ListView( scrollDirection: Axis.horizontal, - child: Row( - children: [ - Padding( - padding: const EdgeInsets.all(8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text(''), - Text( - '${AppLocalizations.of(context)!.energy} (${AppLocalizations.of(context)!.kcal})'), - Text( - '${AppLocalizations.of(context)!.protein} (${AppLocalizations.of(context)!.g})'), - Text( - '${AppLocalizations.of(context)!.carbohydrates} (${AppLocalizations.of(context)!.g})'), - Text( - '${AppLocalizations.of(context)!.sugars} (${AppLocalizations.of(context)!.g})'), - Text( - '${AppLocalizations.of(context)!.fat} (${AppLocalizations.of(context)!.g})'), - Text( - '${AppLocalizations.of(context)!.saturatedFat} (${AppLocalizations.of(context)!.g})'), - ], - ), + children: [ + Padding( + padding: const EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(''), + Text( + '${AppLocalizations.of(context)!.energy} (${AppLocalizations.of(context)!.kcal})'), + Text( + '${AppLocalizations.of(context)!.protein} (${AppLocalizations.of(context)!.g})'), + Text( + '${AppLocalizations.of(context)!.carbohydrates} (${AppLocalizations.of(context)!.g})'), + Text( + '${AppLocalizations.of(context)!.sugars} (${AppLocalizations.of(context)!.g})'), + Text( + '${AppLocalizations.of(context)!.fat} (${AppLocalizations.of(context)!.g})'), + Text( + '${AppLocalizations.of(context)!.saturatedFat} (${AppLocalizations.of(context)!.g})'), + ], ), - ..._nutritionalPlan.logEntriesValues.entries - .map((entry) => NutritionDiaryEntry(entry.key, entry.value)) - .toList() - .reversed, - ], - ), + ), + ..._nutritionalPlan.logEntriesValues.entries + .map((entry) => NutritionDiaryEntry(entry.key, entry.value)) + .toList() + .reversed, + ], ), ), ], From a0d3df6d8dc54ce5aec6b096f8d2796448d8912f Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 16:30:23 +0200 Subject: [PATCH 61/69] Delete commented code --- lib/screens/auth_screen.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index cd7aad147..7fc03f680 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -172,10 +172,6 @@ class _AuthCardState extends State { ), elevation: 8.0, child: Container( - //decoration: BoxDecoration(color: Colors.black12), - //height: _authMode == AuthMode.Signup ? 450 : 320, - //constraints: - // BoxConstraints(minHeight: _authMode == AuthMode.Signup ? 450 : 320), width: deviceSize.width * 0.75, padding: EdgeInsets.all(16.0), child: Form( From 47e9c12d2620b0a4680467d75d9c25b6a2c32181 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 17:12:13 +0200 Subject: [PATCH 62/69] Add simple widget test for nutritional plan screen --- test/base_provider_test.mocks.dart | 24 +++--- test/nutritional_plan_screen_test.dart | 102 +++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 10 deletions(-) create mode 100644 test/nutritional_plan_screen_test.dart diff --git a/test/base_provider_test.mocks.dart b/test/base_provider_test.mocks.dart index bb43da439..25938e29e 100644 --- a/test/base_provider_test.mocks.dart +++ b/test/base_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.0.3 from annotations +// Mocks generated by Mockito 5.0.4 from annotations // in wger/test/base_provider_test.dart. // Do not manually edit this file. @@ -32,12 +32,12 @@ class MockClient extends _i1.Mock implements _i5.Client { @override _i6.Future<_i2.Response> head(Uri? url, {Map? headers}) => (super.noSuchMethod(Invocation.method(#head, [url], {#headers: headers}), - returnValue: Future.value(_FakeResponse())) + returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i6.Future<_i2.Response>); @override _i6.Future<_i2.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod(Invocation.method(#get, [url], {#headers: headers}), - returnValue: Future.value(_FakeResponse())) + returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i6.Future<_i2.Response>); @override _i6.Future<_i2.Response> post(Uri? url, @@ -47,7 +47,7 @@ class MockClient extends _i1.Mock implements _i5.Client { (super.noSuchMethod( Invocation.method(#post, [url], {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future.value(_FakeResponse())) + returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i6.Future<_i2.Response>); @override _i6.Future<_i2.Response> put(Uri? url, @@ -57,7 +57,7 @@ class MockClient extends _i1.Mock implements _i5.Client { (super.noSuchMethod( Invocation.method(#put, [url], {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future.value(_FakeResponse())) + returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i6.Future<_i2.Response>); @override _i6.Future<_i2.Response> patch(Uri? url, @@ -67,7 +67,7 @@ class MockClient extends _i1.Mock implements _i5.Client { (super.noSuchMethod( Invocation.method(#patch, [url], {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future.value(_FakeResponse())) + returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i6.Future<_i2.Response>); @override _i6.Future<_i2.Response> delete(Uri? url, @@ -77,22 +77,26 @@ class MockClient extends _i1.Mock implements _i5.Client { (super.noSuchMethod( Invocation.method(#delete, [url], {#headers: headers, #body: body, #encoding: encoding}), - returnValue: Future.value(_FakeResponse())) + returnValue: Future<_i2.Response>.value(_FakeResponse())) as _i6.Future<_i2.Response>); @override _i6.Future read(Uri? url, {Map? headers}) => (super.noSuchMethod(Invocation.method(#read, [url], {#headers: headers}), - returnValue: Future.value('')) as _i6.Future); + returnValue: Future.value('')) as _i6.Future); @override _i6.Future<_i3.Uint8List> readBytes(Uri? url, {Map? headers}) => (super.noSuchMethod( Invocation.method(#readBytes, [url], {#headers: headers}), - returnValue: Future.value(_FakeUint8List())) + returnValue: Future<_i3.Uint8List>.value(_FakeUint8List())) as _i6.Future<_i3.Uint8List>); @override _i6.Future<_i4.StreamedResponse> send(_i8.BaseRequest? request) => (super.noSuchMethod(Invocation.method(#send, [request]), - returnValue: Future.value(_FakeStreamedResponse())) + returnValue: + Future<_i4.StreamedResponse>.value(_FakeStreamedResponse())) as _i6.Future<_i4.StreamedResponse>); + @override + void close() => super.noSuchMethod(Invocation.method(#close, []), + returnValueForMissingStub: null); } diff --git a/test/nutritional_plan_screen_test.dart b/test/nutritional_plan_screen_test.dart new file mode 100644 index 000000000..247426d18 --- /dev/null +++ b/test/nutritional_plan_screen_test.dart @@ -0,0 +1,102 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:provider/provider.dart'; +import 'package:wger/helpers/json.dart'; +import 'package:wger/models/nutrition/meal.dart'; +import 'package:wger/models/nutrition/nutritional_plan.dart'; +import 'package:wger/providers/nutrition.dart'; +import 'package:wger/screens/nutritional_plan_screen.dart'; +import 'package:wger/widgets/nutrition/charts.dart'; + +import 'base_provider_test.mocks.dart'; +import 'utils.dart'; + +void main() { + Widget createNutritionalPlan({locale = 'en'}) { + final key = GlobalKey(); + final client = MockClient(); + + final meal = Meal( + id: 1, + plan: 1, + mealItems: [], + time: stringToTime('17:00'), + ); + final meal2 = Meal( + id: 2, + plan: 1, + mealItems: [], + time: stringToTime('20:00'), + ); + var plan = NutritionalPlan( + id: 1, + description: 'test plan 1', + creationDate: DateTime(2021, 01, 01), + meals: [meal, meal2], + ); + + return ChangeNotifierProvider( + create: (context) => Nutrition(testAuthProvider, [], client), + child: MaterialApp( + locale: Locale(locale), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + navigatorKey: key, + home: TextButton( + onPressed: () => key.currentState!.push( + MaterialPageRoute( + settings: RouteSettings(arguments: plan), + builder: (_) => NutritionalPlanScreen(), + ), + ), + child: const SizedBox(), + ), + ), + ); + } + + testWidgets('Test the widgets on the nutritional plan screen', (WidgetTester tester) async { + await tester.pumpWidget(createNutritionalPlan()); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + expect(find.text('test plan 1'), findsOneWidget); + expect(find.byType(Dismissible), findsNWidgets(2)); + expect(find.byType(NutritionalDiaryChartWidget), findsNothing); + }); + + testWidgets('Tests the localization of times - EN', (WidgetTester tester) async { + await tester.pumpWidget(createNutritionalPlan()); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + expect(find.text('5:00 PM'), findsOneWidget); + }); + + testWidgets('Tests the localization of times - DE', (WidgetTester tester) async { + await tester.pumpWidget(createNutritionalPlan(locale: 'de')); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + expect(find.text('17:00'), findsOneWidget); + }); +} From 9b791eba8cac8be1d98352483cefa1d1d69f93eb Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Tue, 13 Apr 2021 17:50:42 +0200 Subject: [PATCH 63/69] Add simple widget test for workout plan screen --- test/workout_plan_screen_test.dart | 106 +++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 test/workout_plan_screen_test.dart diff --git a/test/workout_plan_screen_test.dart b/test/workout_plan_screen_test.dart new file mode 100644 index 000000000..f57d24a23 --- /dev/null +++ b/test/workout_plan_screen_test.dart @@ -0,0 +1,106 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:provider/provider.dart'; +import 'package:wger/models/workouts/day.dart'; +import 'package:wger/models/workouts/workout_plan.dart'; +import 'package:wger/providers/workout_plans.dart'; +import 'package:wger/screens/workout_plan_screen.dart'; + +import 'base_provider_test.mocks.dart'; +import 'utils.dart'; + +void main() { + Widget createHomeScreen({locale = 'en'}) { + final key = GlobalKey(); + final client = MockClient(); + + var day = Day() + ..id = 1 + ..workoutId = 1 + ..description = 'test day 1' + ..daysOfWeek = [1, 2]; + + var day2 = Day() + ..id = 2 + ..workoutId = 1 + ..description = 'test day 2' + ..daysOfWeek = [4]; + + WorkoutPlan workout = WorkoutPlan( + id: 1, + creationDate: DateTime(2021, 01, 01), + description: 'test workout 1', + days: [day, day2], + ); + + return ChangeNotifierProvider( + create: (context) => WorkoutPlans(testAuthProvider, testExercisesProvider, [], client), + child: MaterialApp( + locale: Locale(locale), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + navigatorKey: key, + home: TextButton( + onPressed: () => key.currentState!.push( + MaterialPageRoute( + settings: RouteSettings(arguments: workout), + builder: (_) => WorkoutPlanScreen(), + ), + ), + child: const SizedBox(), + ), + routes: { + WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(), + }, + ), + ); + } + + testWidgets('Test the widgets on the nutritional plan screen', (WidgetTester tester) async { + await tester.pumpWidget(createHomeScreen()); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + expect(find.text('test workout 1'), findsOneWidget); + expect(find.text('test day 1'), findsOneWidget); + expect(find.text('test day 2'), findsOneWidget); + expect(find.byType(Dismissible), findsNWidgets(2)); + }); + + testWidgets('Tests the localization of times - EN', (WidgetTester tester) async { + await tester.pumpWidget(createHomeScreen()); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + expect(find.text('Monday, Tuesday'), findsOneWidget); + expect(find.text('Thursday'), findsOneWidget); + }); + + testWidgets('Tests the localization of times - DE', (WidgetTester tester) async { + await tester.pumpWidget(createHomeScreen(locale: 'de')); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + expect(find.text('Monday, Tuesday'), findsOneWidget); + expect(find.text('Thursday'), findsOneWidget); + }); +} From e76ba740c87119a63e0d2f3c172245f6009a2a4c Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 14 Apr 2021 12:21:40 +0200 Subject: [PATCH 64/69] Use setter to save ID and object references --- lib/models/exercises/category.dart | 2 +- lib/models/exercises/equipment.dart | 2 +- lib/models/exercises/exercise.dart | 36 ++++++++++++++++----------- lib/models/exercises/muscle.dart | 2 +- lib/models/workouts/log.dart | 26 +++++++++---------- lib/models/workouts/log.g.dart | 12 ++++----- lib/models/workouts/setting.dart | 6 ++--- lib/models/workouts/workout_plan.dart | 2 +- lib/widgets/workouts/forms.dart | 15 +++++------ lib/widgets/workouts/gym_mode.dart | 6 ++--- test/setting_model_test.dart | 20 +++++++-------- 11 files changed, 67 insertions(+), 62 deletions(-) diff --git a/lib/models/exercises/category.dart b/lib/models/exercises/category.dart index ed698d9fb..9b15dc1b2 100644 --- a/lib/models/exercises/category.dart +++ b/lib/models/exercises/category.dart @@ -28,7 +28,7 @@ class ExerciseCategory { @JsonKey(required: true) final String name; - ExerciseCategory({ + const ExerciseCategory({ required this.id, required this.name, }); diff --git a/lib/models/exercises/equipment.dart b/lib/models/exercises/equipment.dart index 2a9c3eecc..ea7713b85 100644 --- a/lib/models/exercises/equipment.dart +++ b/lib/models/exercises/equipment.dart @@ -28,7 +28,7 @@ class Equipment { @JsonKey(required: true) final String name; - Equipment({ + const Equipment({ required this.id, required this.name, }); diff --git a/lib/models/exercises/exercise.dart b/lib/models/exercises/exercise.dart index b65861110..2ee6f398a 100644 --- a/lib/models/exercises/exercise.dart +++ b/lib/models/exercises/exercise.dart @@ -43,7 +43,7 @@ class Exercise { final String description; @JsonKey(required: false) - final int categoryId; + late int categoryId; @JsonKey(required: true, name: 'category') late final ExerciseCategory categoryObj; @@ -63,24 +63,27 @@ class Exercise { @JsonKey(required: true, name: 'comments') List tips = []; - Exercise({ - required this.id, - required this.uuid, - required this.creationDate, - required this.name, - required this.description, - required this.categoryId, - List? muscles, - List? musclesSecondary, - List? equipment, - List? images, - List? tips, - }) { + Exercise( + {required this.id, + required this.uuid, + required this.creationDate, + required this.name, + required this.description, + required this.categoryId, + List? muscles, + List? musclesSecondary, + List? equipment, + List? images, + List? tips, + ExerciseCategory? category}) { this.tips = tips ?? []; this.images = images ?? []; this.equipment = equipment ?? []; this.musclesSecondary = musclesSecondary ?? []; this.muscles = muscles ?? []; + if (category != null) { + this.categoryObj = category; + } } ExerciseImage? get getMainImage { @@ -91,6 +94,11 @@ class Exercise { } } + set category(ExerciseCategory category) { + this.categoryId = category.id; + this.categoryObj = category; + } + // Boilerplate factory Exercise.fromJson(Map json) => _$ExerciseFromJson(json); Map toJson() => _$ExerciseToJson(this); diff --git a/lib/models/exercises/muscle.dart b/lib/models/exercises/muscle.dart index 86bafeb80..19dac14f9 100644 --- a/lib/models/exercises/muscle.dart +++ b/lib/models/exercises/muscle.dart @@ -31,7 +31,7 @@ class Muscle { @JsonKey(name: 'is_front', required: true) final bool isFront; - Muscle({ + const Muscle({ required this.id, required this.name, required this.isFront, diff --git a/lib/models/workouts/log.dart b/lib/models/workouts/log.dart index e22f01ef7..bed4b5407 100644 --- a/lib/models/workouts/log.dart +++ b/lib/models/workouts/log.dart @@ -29,8 +29,8 @@ class Log { @JsonKey(required: true) int? id; - @JsonKey(required: true) - late int exercise; + @JsonKey(required: true, name: 'exercise') + late int exerciseId; @JsonKey(ignore: true) late Exercise exerciseObj; @@ -45,7 +45,7 @@ class Log { String? rir; @JsonKey(required: true, name: 'repetition_unit') - late int repetitionUnit; + late int repetitionUnitId; @JsonKey(ignore: true) late RepetitionUnit repetitionUnitObj; @@ -54,7 +54,7 @@ class Log { late num weight; @JsonKey(required: true, name: 'weight_unit') - late int weightUnit; + late int weightUnitId; @JsonKey(ignore: true) late WeightUnit weightUnitObj; @@ -67,13 +67,13 @@ class Log { Log( {this.id, - required this.exercise, + required this.exerciseId, required this.workoutPlan, required this.reps, required this.rir, - required this.repetitionUnit, + required this.repetitionUnitId, required this.weight, - required this.weightUnit, + required this.weightUnitId, required this.date}); Log.empty(); @@ -82,19 +82,19 @@ class Log { factory Log.fromJson(Map json) => _$LogFromJson(json); Map toJson() => _$LogToJson(this); - void setExercise(Exercise exercise) { + set exercise(Exercise exercise) { this.exerciseObj = exercise; - this.exercise = exercise.id; + this.exerciseId = exercise.id; } - void setWeightUnit(WeightUnit weightUnit) { + set weightUnit(WeightUnit weightUnit) { this.weightUnitObj = weightUnit; - this.weightUnit = weightUnit.id; + this.weightUnitId = weightUnit.id; } - void setRepetitionUnit(RepetitionUnit repetitionUnit) { + set repetitionUnit(RepetitionUnit repetitionUnit) { this.repetitionUnitObj = repetitionUnit; - this.repetitionUnit = repetitionUnit.id; + this.repetitionUnitId = repetitionUnit.id; } void setRir(String rir) { diff --git a/lib/models/workouts/log.g.dart b/lib/models/workouts/log.g.dart index d3e2167eb..309464a43 100644 --- a/lib/models/workouts/log.g.dart +++ b/lib/models/workouts/log.g.dart @@ -19,25 +19,25 @@ Log _$LogFromJson(Map json) { ]); return Log( id: json['id'] as int?, - exercise: json['exercise'] as int, + exerciseId: json['exercise'] as int, workoutPlan: json['workout'] as int, reps: json['reps'] as int, rir: json['rir'] as String?, - repetitionUnit: json['repetition_unit'] as int, + repetitionUnitId: json['repetition_unit'] as int, weight: toNum(json['weight'] as String?), - weightUnit: json['weight_unit'] as int, + weightUnitId: json['weight_unit'] as int, date: DateTime.parse(json['date'] as String), ); } Map _$LogToJson(Log instance) => { 'id': instance.id, - 'exercise': instance.exercise, + 'exercise': instance.exerciseId, 'workout': instance.workoutPlan, 'reps': instance.reps, 'rir': instance.rir, - 'repetition_unit': instance.repetitionUnit, + 'repetition_unit': instance.repetitionUnitId, 'weight': toString(instance.weight), - 'weight_unit': instance.weightUnit, + 'weight_unit': instance.weightUnitId, 'date': toDate(instance.date), }; diff --git a/lib/models/workouts/setting.dart b/lib/models/workouts/setting.dart index b08df1437..8af734b45 100644 --- a/lib/models/workouts/setting.dart +++ b/lib/models/workouts/setting.dart @@ -91,17 +91,17 @@ class Setting { factory Setting.fromJson(Map json) => _$SettingFromJson(json); Map toJson() => _$SettingToJson(this); - void setExercise(Exercise exercise) { + set exercise(Exercise exercise) { exerciseObj = exercise; exerciseId = exercise.id; } - void setWeightUnit(WeightUnit weightUnit) { + set weightUnit(WeightUnit weightUnit) { weightUnitObj = weightUnit; weightUnitId = weightUnit.id; } - void setRepetitionUnit(RepetitionUnit repetitionUnit) { + set repetitionUnit(RepetitionUnit repetitionUnit) { repetitionUnitObj = repetitionUnit; repetitionUnitId = repetitionUnit.id; } diff --git a/lib/models/workouts/workout_plan.dart b/lib/models/workouts/workout_plan.dart index 9d769ed7f..2e63967fb 100644 --- a/lib/models/workouts/workout_plan.dart +++ b/lib/models/workouts/workout_plan.dart @@ -57,7 +57,7 @@ class WorkoutPlan { /// Filters the workout logs by exercise and sorts them by date List filterLogsByExercise(Exercise exercise) { - var out = logs.where((element) => element.exercise == exercise.id).toList(); + var out = logs.where((element) => element.exerciseId == exercise.id).toList(); out.sort((a, b) => a.date.compareTo(b.date)); return out; } diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index dc7edfe49..1061b8ef5 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -254,13 +254,10 @@ class _SetFormWidgetState extends State { for (int loop = 0; loop < widget._set.sets; loop++) { Setting setting = Setting.empty(); setting.order = order; - setting.setExercise(exercise); - setting.setRepetitionUnit( - Provider.of(context, listen: false).defaultRepetitionUnit, - ); - setting.setWeightUnit( - Provider.of(context, listen: false).defaultWeightUnit, - ); + setting.exercise = exercise; + setting.weightUnit = Provider.of(context, listen: false).defaultWeightUnit; + setting.repetitionUnit = + Provider.of(context, listen: false).defaultRepetitionUnit; widget._set.settings.add(setting); } @@ -669,7 +666,7 @@ class _WeightUnitInputWidgetState extends State { onChanged: (WeightUnit? newValue) { setState(() { selectedWeightUnit = newValue!; - widget._setting.setWeightUnit(newValue); + widget._setting.weightUnit = newValue; }); }, items: Provider.of(context, listen: false) @@ -707,7 +704,7 @@ class _RepetitionUnitInputWidgetState extends State { onChanged: (RepetitionUnit? newValue) { setState(() { selectedWeightUnit = newValue!; - widget._setting.setRepetitionUnit(newValue); + widget._setting.repetitionUnit = newValue; }); }, items: Provider.of(context, listen: false) diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 25fe4fd87..1c812abc5 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -214,9 +214,9 @@ class LogPage extends StatefulWidget { _log.date = DateTime.now(); _log.workoutPlan = _workoutPlan.id!; - _log.setExercise(_exercise); - _log.setWeightUnit(_setting.weightUnitObj); - _log.setRepetitionUnit(_setting.repetitionUnitObj); + _log.exercise = _exercise; + _log.weightUnit = _setting.weightUnitObj; + _log.repetitionUnit = _setting.repetitionUnitObj; } @override diff --git a/test/setting_model_test.dart b/test/setting_model_test.dart index 635c9dfc3..93200852d 100644 --- a/test/setting_model_test.dart +++ b/test/setting_model_test.dart @@ -31,8 +31,8 @@ void main() { setting.reps = 2; setting.weight = 30; setting.rir = ''; - setting.setRepetitionUnit(repUnit); - setting.setWeightUnit(weightUnit); + setting.repetitionUnit = repUnit; + setting.weightUnit = weightUnit; expect(setting.singleSettingRepText, '2 × 30 mg'); }); @@ -44,8 +44,8 @@ void main() { setting.reps = 2; setting.weight = 30; setting.rir = '1.5'; - setting.setRepetitionUnit(repUnit); - setting.setWeightUnit(weightUnit); + setting.repetitionUnit = repUnit; + setting.weightUnit = weightUnit; expect(setting.singleSettingRepText, '2 × 30 mg \n (1.5 RiR)'); }); @@ -57,8 +57,8 @@ void main() { setting.reps = 2; setting.weight = null; setting.rir = '1.5'; - setting.setRepetitionUnit(repUnit); - setting.setWeightUnit(weightUnit); + setting.repetitionUnit = repUnit; + setting.weightUnit = weightUnit; expect(setting.singleSettingRepText, '2 mol \n (1.5 RiR)'); }); @@ -70,8 +70,8 @@ void main() { setting.reps = 2; setting.weight = 30; setting.rir = ''; - setting.setRepetitionUnit(repUnit); - setting.setWeightUnit(weightUnit); + setting.repetitionUnit = repUnit; + setting.weightUnit = weightUnit; expect(setting.singleSettingRepText, '2 mol × 30 mg'); }); @@ -83,8 +83,8 @@ void main() { setting.reps = 2; setting.weight = 30; setting.rir = '3'; - setting.setRepetitionUnit(repUnit); - setting.setWeightUnit(weightUnit); + setting.repetitionUnit = repUnit; + setting.weightUnit = weightUnit; expect(setting.singleSettingRepText, '2 mol × 30 mg \n (3 RiR)'); }); }); From d2a7733703d4b5639cb36e5311b51a2a113b4b7d Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 14 Apr 2021 20:28:49 +0200 Subject: [PATCH 65/69] Add simple widget test for gym mode screen --- lib/models/workouts/repetition_unit.dart | 2 +- lib/models/workouts/weight_unit.dart | 2 +- test/gym_mode_screen_test.dart | 140 +++++++++++++++++++++++ test/utils.dart | 4 +- test_data/exercises.dart | 57 +++++++++ test_data/workouts.dart | 79 +++++++++++++ 6 files changed, 281 insertions(+), 3 deletions(-) create mode 100644 test/gym_mode_screen_test.dart create mode 100644 test_data/exercises.dart create mode 100644 test_data/workouts.dart diff --git a/lib/models/workouts/repetition_unit.dart b/lib/models/workouts/repetition_unit.dart index 6c1c2fb87..a732c9a12 100644 --- a/lib/models/workouts/repetition_unit.dart +++ b/lib/models/workouts/repetition_unit.dart @@ -28,7 +28,7 @@ class RepetitionUnit { @JsonKey(required: true) final String name; - RepetitionUnit({ + const RepetitionUnit({ required this.id, required this.name, }); diff --git a/lib/models/workouts/weight_unit.dart b/lib/models/workouts/weight_unit.dart index 3bcab86ec..82463c758 100644 --- a/lib/models/workouts/weight_unit.dart +++ b/lib/models/workouts/weight_unit.dart @@ -28,7 +28,7 @@ class WeightUnit { @JsonKey(required: true) final String name; - WeightUnit({ + const WeightUnit({ required this.id, required this.name, }); diff --git a/test/gym_mode_screen_test.dart b/test/gym_mode_screen_test.dart new file mode 100644 index 000000000..e93591593 --- /dev/null +++ b/test/gym_mode_screen_test.dart @@ -0,0 +1,140 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:provider/provider.dart'; +import 'package:wger/models/workouts/workout_plan.dart'; +import 'package:wger/providers/workout_plans.dart'; +import 'package:wger/screens/gym_mode.dart'; +import 'package:wger/screens/workout_plan_screen.dart'; +import 'package:wger/widgets/workouts/gym_mode.dart'; + +import '../test_data/workouts.dart'; +import 'base_provider_test.mocks.dart'; +import 'utils.dart'; + +void main() { + Widget createHomeScreen({locale = 'en'}) { + final key = GlobalKey(); + final client = MockClient(); + + WorkoutPlan workoutPlan = getWorkout(); + + return ChangeNotifierProvider( + create: (context) => WorkoutPlans( + testAuthProvider, + testExercisesProvider, + [workoutPlan], + client, + ), + child: ChangeNotifierProvider( + create: (context) => testExercisesProvider, + child: MaterialApp( + locale: Locale(locale), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + navigatorKey: key, + home: TextButton( + onPressed: () => key.currentState!.push( + MaterialPageRoute( + settings: RouteSettings(arguments: workoutPlan.days.first), + builder: (_) => GymModeScreen(), + ), + ), + child: const SizedBox(), + ), + routes: { + WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(), + }, + ), + ), + ); + } + + testWidgets('Test the widgets on the gym mode screen', (WidgetTester tester) async { + await tester.pumpWidget(createHomeScreen()); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + + // Start page + expect(find.byType(StartPage), findsOneWidget); + expect(find.text('Your workout today'), findsOneWidget); + expect(find.text('test exercise 1'), findsOneWidget); + expect(find.byIcon(Icons.chevron_left), findsNothing); + expect(find.byIcon(Icons.exit_to_app), findsOneWidget); + expect(find.byIcon(Icons.chevron_right), findsOneWidget); + await tester.tap(find.byIcon(Icons.chevron_right)); + await tester.pumpAndSettle(); + + // Exercise overview page + expect(find.text('test exercise 1'), findsOneWidget); + expect(find.byType(ExerciseOverview), findsOneWidget); + expect(find.byIcon(Icons.chevron_left), findsOneWidget); + expect(find.byIcon(Icons.exit_to_app), findsOneWidget); + expect(find.byIcon(Icons.chevron_right), findsOneWidget); + await tester.drag(find.byType(ExerciseOverview), Offset(-500.0, 0.0)); + await tester.pumpAndSettle(); + + // Log + expect(find.text('test exercise 1'), findsOneWidget); + expect(find.byType(LogPage), findsOneWidget); + expect(find.byType(Form), findsOneWidget); + expect(find.byIcon(Icons.chevron_left), findsOneWidget); + expect(find.byIcon(Icons.exit_to_app), findsOneWidget); + expect(find.byIcon(Icons.chevron_right), findsOneWidget); + await tester.drag(find.byType(LogPage), Offset(-500.0, 0.0)); + await tester.pumpAndSettle(); + + // Pause + expect(find.text('0:00'), findsOneWidget); + expect(find.byType(TimerWidget), findsOneWidget); + expect(find.byIcon(Icons.chevron_left), findsOneWidget); + expect(find.byIcon(Icons.exit_to_app), findsOneWidget); + expect(find.byIcon(Icons.chevron_right), findsOneWidget); + await tester.tap(find.byIcon(Icons.chevron_right)); + await tester.pumpAndSettle(); + + // Log + expect(find.text('test exercise 1'), findsOneWidget); + expect(find.byType(LogPage), findsOneWidget); + expect(find.byType(Form), findsOneWidget); + await tester.drag(find.byType(LogPage), Offset(-500.0, 0.0)); + await tester.pumpAndSettle(); + + // Pause + expect(find.text('0:00'), findsOneWidget); + expect(find.byType(TimerWidget), findsOneWidget); + expect(find.byIcon(Icons.chevron_left), findsOneWidget); + expect(find.byIcon(Icons.exit_to_app), findsOneWidget); + expect(find.byIcon(Icons.chevron_right), findsOneWidget); + await tester.tap(find.byIcon(Icons.chevron_right)); + await tester.pumpAndSettle(); + + // Session + expect(find.text('Workout session'), findsOneWidget); + expect(find.byType(SessionPage), findsOneWidget); + expect(find.byType(Form), findsOneWidget); + expect(find.byIcon(Icons.chevron_left), findsOneWidget); + expect(find.byIcon(Icons.exit_to_app), findsOneWidget); + expect(find.byIcon(Icons.chevron_right), findsNothing); + + // + }); +} diff --git a/test/utils.dart b/test/utils.dart index 4c73d26c3..81d432977 100644 --- a/test/utils.dart +++ b/test/utils.dart @@ -19,10 +19,12 @@ import 'package:wger/providers/auth.dart'; import 'package:wger/providers/exercises.dart'; +import '../test_data/exercises.dart'; + // Test Auth provider final Auth testAuthProvider = Auth() ..token = 'FooBar' ..serverUrl = 'https://localhost'; // Test Exercises provider -final Exercises testExercisesProvider = Exercises(testAuthProvider, []); +final Exercises testExercisesProvider = Exercises(testAuthProvider, [exercise1, exercise2]); diff --git a/test_data/exercises.dart b/test_data/exercises.dart new file mode 100644 index 000000000..be305fd61 --- /dev/null +++ b/test_data/exercises.dart @@ -0,0 +1,57 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:wger/models/exercises/category.dart'; +import 'package:wger/models/exercises/equipment.dart'; +import 'package:wger/models/exercises/exercise.dart'; +import 'package:wger/models/exercises/muscle.dart'; + +const muscle1 = Muscle(id: 1, name: 'Flutterus maximus', isFront: true); +const muscle2 = Muscle(id: 2, name: 'Biceps', isFront: true); + +const category1 = ExerciseCategory(id: 1, name: 'Arms'); +const category2 = ExerciseCategory(id: 2, name: 'Legs'); +const category3 = ExerciseCategory(id: 3, name: 'Abs'); + +const equipment1 = Equipment(id: 1, name: 'Bench'); +const equipment2 = Equipment(id: 1, name: 'Dumbbell'); + +final exercise1 = Exercise( + id: 1, + uuid: 'uuid', + creationDate: DateTime(2021, 1, 15), + name: 'test exercise 1', + description: 'add clever text', + categoryId: 1, + muscles: [muscle1, muscle2], + equipment: [equipment1, equipment2], + category: category1, +); + +final exercise2 = Exercise( + id: 2, + uuid: '111-2222-44444', + creationDate: DateTime(2021, 1, 15), + name: 'test exercise 2', + description: 'Lorem ipsum etc', + categoryId: 2, + muscles: [muscle1], + musclesSecondary: [muscle2], + equipment: [equipment2], + category: category2, +); diff --git a/test_data/workouts.dart b/test_data/workouts.dart new file mode 100644 index 000000000..1cc3ba12a --- /dev/null +++ b/test_data/workouts.dart @@ -0,0 +1,79 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:wger/models/workouts/day.dart'; +import 'package:wger/models/workouts/repetition_unit.dart'; +import 'package:wger/models/workouts/set.dart'; +import 'package:wger/models/workouts/setting.dart'; +import 'package:wger/models/workouts/weight_unit.dart'; +import 'package:wger/models/workouts/workout_plan.dart'; + +import './exercises.dart'; + +const weightUnit1 = WeightUnit(id: 1, name: 'kg'); +const weightUnit2 = WeightUnit(id: 2, name: 'metric tonnes'); + +const RepetitionUnit repetitionUnit1 = RepetitionUnit(id: 1, name: 'Repetitions'); +const RepetitionUnit repetitionUnit2 = RepetitionUnit(id: 2, name: 'Hours'); + +WorkoutPlan getWorkout() { + var setting1 = Setting( + setId: 1, + order: 1, + exerciseId: 1, + repetitionUnitId: 1, + reps: 2, + weightUnitId: 1, + comment: 'ddd', + rir: '2', + ); + setting1.repetitionUnit = repetitionUnit1; + setting1.weightUnit = weightUnit1; + setting1.exercise = exercise1; + + var set1 = Set.withData( + id: 1, + day: 1, + sets: 3, + order: 1, + ); + set1.settings.add(setting1); + set1.settingsComputed = [setting1, setting1]; + + var day1 = Day() + ..id = 1 + ..workoutId = 1 + ..description = 'test day 1' + ..daysOfWeek = [1, 2]; + day1.sets.add(set1); + + var day2 = Day() + ..id = 2 + ..workoutId = 1 + ..description = 'test day 2' + ..daysOfWeek = [4]; + + var workout = WorkoutPlan( + id: 1, + creationDate: DateTime(2021, 01, 01), + description: 'test workout 1', + days: [day1, day2], + ); + + return workout; +} From 2e1b1f56361e2a2cdfbead2da5523b6639092ed1 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Wed, 14 Apr 2021 20:34:39 +0200 Subject: [PATCH 66/69] Copy issue templates from wger server --- .github/ISSUE_TEMPLATE/1_bug.md | 34 +++++++++++++++++++++ .github/ISSUE_TEMPLATE/2_feature_request.md | 26 ++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 +++ 3 files changed, 65 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/1_bug.md create mode 100644 .github/ISSUE_TEMPLATE/2_feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/1_bug.md b/.github/ISSUE_TEMPLATE/1_bug.md new file mode 100644 index 000000000..e12f7506c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_bug.md @@ -0,0 +1,34 @@ +--- +name: I found a problem with wger +about: While using wger the application crashes or throws an exception, a + widget is buggy, or something looks wrong. +title: '' +labels: '' +assignees: '' + +--- + +## Steps to Reproduce + + + +1. ... +2. ... +3. ... + +**Expected results:** + +**Actual results:** + +
+ Logs + + + +``` +``` + + +
diff --git a/.github/ISSUE_TEMPLATE/2_feature_request.md b/.github/ISSUE_TEMPLATE/2_feature_request.md new file mode 100644 index 000000000..924b1e420 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2_feature_request.md @@ -0,0 +1,26 @@ +--- +name: Feature request +about: Suggest a new idea for wger. +title: '' +labels: '' +assignees: '' + +--- + +## Use case + + + +## Proposal + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..6b0a08bd6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Get in touch with the community + url: https://discord.gg/rPWFv6W + about: Hop on the Discord server if you want to discuss new features or problem with us From 9988807c2577604bb7246dfe0b8fa46523be7dfe Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 15 Apr 2021 11:05:35 +0200 Subject: [PATCH 67/69] Move data to test data folder --- test/weight_screen_test.dart | 6 +++--- test/workout_plan_screen_test.dart | 24 ++---------------------- test_data/body_weight.dart | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 25 deletions(-) create mode 100644 test_data/body_weight.dart diff --git a/test/weight_screen_test.dart b/test/weight_screen_test.dart index e8e2c489a..17a4dcb9d 100644 --- a/test/weight_screen_test.dart +++ b/test/weight_screen_test.dart @@ -22,13 +22,13 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:http/http.dart' as http; import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; -import 'package:wger/models/body_weight/weight_entry.dart'; import 'package:wger/providers/body_weight.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/weight_screen.dart'; import 'package:wger/widgets/weight/charts.dart'; import 'package:wger/widgets/weight/forms.dart'; +import '../test_data/body_weight.dart'; import 'base_provider_test.mocks.dart'; import 'utils.dart'; @@ -50,8 +50,8 @@ void main() { create: (context) => BodyWeight( testAuthProvider, [ - WeightEntry(id: 1, weight: 80, date: DateTime(2021, 01, 01)), - WeightEntry(id: 2, weight: 81, date: DateTime(2021, 01, 10)), + weightEntry1, + weightEntry2, ], client, ), diff --git a/test/workout_plan_screen_test.dart b/test/workout_plan_screen_test.dart index f57d24a23..cc2aba378 100644 --- a/test/workout_plan_screen_test.dart +++ b/test/workout_plan_screen_test.dart @@ -20,11 +20,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:provider/provider.dart'; -import 'package:wger/models/workouts/day.dart'; -import 'package:wger/models/workouts/workout_plan.dart'; import 'package:wger/providers/workout_plans.dart'; import 'package:wger/screens/workout_plan_screen.dart'; +import '../test_data/workouts.dart'; import 'base_provider_test.mocks.dart'; import 'utils.dart'; @@ -33,25 +32,6 @@ void main() { final key = GlobalKey(); final client = MockClient(); - var day = Day() - ..id = 1 - ..workoutId = 1 - ..description = 'test day 1' - ..daysOfWeek = [1, 2]; - - var day2 = Day() - ..id = 2 - ..workoutId = 1 - ..description = 'test day 2' - ..daysOfWeek = [4]; - - WorkoutPlan workout = WorkoutPlan( - id: 1, - creationDate: DateTime(2021, 01, 01), - description: 'test workout 1', - days: [day, day2], - ); - return ChangeNotifierProvider( create: (context) => WorkoutPlans(testAuthProvider, testExercisesProvider, [], client), child: MaterialApp( @@ -62,7 +42,7 @@ void main() { home: TextButton( onPressed: () => key.currentState!.push( MaterialPageRoute( - settings: RouteSettings(arguments: workout), + settings: RouteSettings(arguments: getWorkout()), builder: (_) => WorkoutPlanScreen(), ), ), diff --git a/test_data/body_weight.dart b/test_data/body_weight.dart new file mode 100644 index 000000000..409a1abdd --- /dev/null +++ b/test_data/body_weight.dart @@ -0,0 +1,22 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:wger/models/body_weight/weight_entry.dart'; + +final weightEntry1 = WeightEntry(id: 1, weight: 80, date: DateTime(2021, 01, 01)); +final weightEntry2 = WeightEntry(id: 2, weight: 81, date: DateTime(2021, 01, 10)); From 6fe0841cc1efa7ea9135bbce03384a232bd34f1a Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 15 Apr 2021 11:10:32 +0200 Subject: [PATCH 68/69] Use correct label for button --- lib/widgets/workouts/workout_plan_detail.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/workouts/workout_plan_detail.dart b/lib/widgets/workouts/workout_plan_detail.dart index 5da82784a..019fa98b6 100644 --- a/lib/widgets/workouts/workout_plan_detail.dart +++ b/lib/widgets/workouts/workout_plan_detail.dart @@ -56,7 +56,7 @@ class _WorkoutPlanDetailState extends State { Column( children: [ ElevatedButton( - child: Text(AppLocalizations.of(context)!.addSet), + child: Text(AppLocalizations.of(context)!.newDay), onPressed: () { Navigator.pushNamed( context, From 7e2ba3468d0e3739246e7cba6bec52cfd10aa437 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 15 Apr 2021 13:28:12 +0200 Subject: [PATCH 69/69] Show past logs in gym mode See #13 --- lib/helpers/misc.dart | 60 ++++++++++++++++++++++++++++++ lib/models/workouts/log.dart | 6 +++ lib/models/workouts/setting.dart | 32 +--------------- lib/providers/workout_plans.dart | 15 +++++++- lib/screens/dashboard.dart | 2 - lib/widgets/workouts/gym_mode.dart | 31 ++++++++++++++- test/workout_plan_model_test.dart | 42 +++++++++++++++++++++ test_data/exercises.dart | 17 ++++++++- test_data/workouts.dart | 44 +++++++++++++++++++--- 9 files changed, 208 insertions(+), 41 deletions(-) create mode 100644 lib/helpers/misc.dart create mode 100644 test/workout_plan_model_test.dart diff --git a/lib/helpers/misc.dart b/lib/helpers/misc.dart new file mode 100644 index 000000000..4e40b5521 --- /dev/null +++ b/lib/helpers/misc.dart @@ -0,0 +1,60 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:wger/helpers/consts.dart'; +import 'package:wger/models/workouts/repetition_unit.dart'; +import 'package:wger/models/workouts/weight_unit.dart'; + +/// Returns the text representation for a single setting, used in the gym mode +String repText( + int? reps, + RepetitionUnit repetitionUnitObj, + num? weight, + WeightUnit weightUnitObj, + String? rir, +) { + // TODO: how to (easily?) translate strings like the units or 'RiR'? + + List out = []; + + if (reps != null) { + out.add(reps.toString()); + + // The default repetition unit is 'reps', which we don't show unless there + // is no weight defined so that we don't just output something like "8" but + // rather "8 repetitions". If there is weight we want to output "8 x 50kg", + // since the repetitions are implied. If other units are used, we always + // print them + if (repetitionUnitObj.id != DEFAULT_REPETITION_UNIT || weight == 0 || weight == null) { + out.add(repetitionUnitObj.name); + } + } + + if (weight != null && weight != 0) { + out.add('×'); + out.add(weight.toString()); + out.add(weightUnitObj.name); + } + + if (rir != null && rir != '') { + out.add('\n'); + out.add('($rir RiR)'); + } + + return out.join(' '); +} diff --git a/lib/models/workouts/log.dart b/lib/models/workouts/log.dart index bed4b5407..94cd85682 100644 --- a/lib/models/workouts/log.dart +++ b/lib/models/workouts/log.dart @@ -18,6 +18,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:wger/helpers/json.dart'; +import 'package:wger/helpers/misc.dart'; import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/workouts/repetition_unit.dart'; import 'package:wger/models/workouts/weight_unit.dart'; @@ -100,4 +101,9 @@ class Log { void setRir(String rir) { this.rir = rir; } + + /// Returns the text representation for a single setting, used in the gym mode + String get singleLogRepText { + return repText(reps, repetitionUnitObj, weight, weightUnitObj, rir); + } } diff --git a/lib/models/workouts/setting.dart b/lib/models/workouts/setting.dart index 8af734b45..d02ba5ebc 100644 --- a/lib/models/workouts/setting.dart +++ b/lib/models/workouts/setting.dart @@ -17,8 +17,8 @@ */ import 'package:json_annotation/json_annotation.dart'; -import 'package:wger/helpers/consts.dart'; import 'package:wger/helpers/json.dart'; +import 'package:wger/helpers/misc.dart'; import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/workouts/repetition_unit.dart'; import 'package:wger/models/workouts/weight_unit.dart'; @@ -116,34 +116,6 @@ class Setting { /// Returns the text representation for a single setting, used in the gym mode String get singleSettingRepText { - // TODO: how to (easily?) translate strings like the units or 'RiR'? - - List out = []; - - if (reps != null) { - out.add(reps.toString()); - - // The default repetition unit is 'reps', which we don't show unless there - // is no weight defined so that we don't just output something like "8" but - // rather "8 repetitions". If there is weight we want to output "8 x 50kg", - // since the repetitions are implied. If other units are used, we always - // print them - if (repetitionUnitId != DEFAULT_REPETITION_UNIT || weight == 0 || weight == null) { - out.add(repetitionUnitObj.name); - } - } - - if (weight != null && weight != 0) { - out.add('×'); - out.add(weight.toString()); - out.add(weightUnitObj.name); - } - - if (rir != null && rir != '') { - out.add('\n'); - out.add('($rir RiR)'); - } - - return out.join(' '); + return repText(reps, repetitionUnitObj, weight, weightUnitObj, rir); } } diff --git a/lib/providers/workout_plans.dart b/lib/providers/workout_plans.dart index fb9046c4a..4c7fa532a 100644 --- a/lib/providers/workout_plans.dart +++ b/lib/providers/workout_plans.dart @@ -174,7 +174,12 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { // Logs final logData = await fetch(makeUrl(_logsUrlPath, query: {'workout': workoutId.toString()})); for (final entry in logData['results']) { - plan.logs.add(Log.fromJson(entry)); + var log = Log.fromJson(entry); + log.weightUnit = _weightUnits.firstWhere((e) => e.id == log.weightUnitId); + log.repetitionUnit = _repetitionUnit.firstWhere((e) => e.id == log.weightUnitId); + log.exercise = _exercises.findById(log.exerciseId); + + plan.logs.add(log); } // ... and done @@ -396,6 +401,14 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier { Future addLog(Log log) async { final data = await post(log.toJson(), makeUrl(_logsUrlPath)); final newLog = Log.fromJson(data); + + log.id = newLog.id; + log.weightUnit = _weightUnits.firstWhere((e) => e.id == log.weightUnitId); + log.repetitionUnit = _repetitionUnit.firstWhere((e) => e.id == log.weightUnitId); + log.exercise = _exercises.findById(log.exerciseId); + + final plan = findById(log.workoutPlan); + plan.logs.add(log); notifyListeners(); return newLog; } diff --git a/lib/screens/dashboard.dart b/lib/screens/dashboard.dart index bf82bb761..8c4661dbc 100644 --- a/lib/screens/dashboard.dart +++ b/lib/screens/dashboard.dart @@ -70,8 +70,6 @@ class _DashboardScreenState extends State { // Workouts await Provider.of(context, listen: false).fetchAndSetUnits(); await Provider.of(context, listen: false).fetchAndSetAllPlans(); - //await Provider.of(context, listen: false).fetchAndSetWorkouts(); - //await Provider.of(context, listen: false).setAllFullWorkouts(); if (Provider.of(context, listen: false).activePlan != null) { Provider.of(context, listen: false).setCurrentPlan( Provider.of(context, listen: false).activePlan!.id!, diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index 1c812abc5..0432c27af 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -249,7 +249,36 @@ class _LogPageState extends State { textAlign: TextAlign.center, ), ), - Expanded(child: Container()), + Expanded( + child: (widget._workoutPlan.filterLogsByExercise(widget._exercise).length > 0) + ? ListView( + children: [ + Text( + 'Logs', + style: Theme.of(context).textTheme.headline6, + textAlign: TextAlign.center, + ), + ...widget._workoutPlan.filterLogsByExercise(widget._exercise).map((log) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 40), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(DateFormat.yMd(Localizations.localeOf(context).languageCode) + .format(log.date)), + Text( + log.singleLogRepText, + textAlign: TextAlign.center, + ), + ], + ), + ); + }).toList(), + ], + ) + : Container()), + SizedBox(height: 15), Form( key: _form, child: Column( diff --git a/test/workout_plan_model_test.dart b/test/workout_plan_model_test.dart new file mode 100644 index 000000000..b02507749 --- /dev/null +++ b/test/workout_plan_model_test.dart @@ -0,0 +1,42 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * wger Workout Manager is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:flutter_test/flutter_test.dart'; + +import '../test_data/exercises.dart'; +import '../test_data/workouts.dart'; + +void main() { + group('model tests', () { + test('Test the filterLogsByExercise method', () { + final workout = getWorkout(); + + expect(workout.logs.length, 3); + final logExercise1 = workout.filterLogsByExercise(exercise1); + expect(logExercise1.length, 2); + expect(logExercise1[0].id, 1); + expect(logExercise1[1].id, 2); + + final logExercise2 = workout.filterLogsByExercise(exercise2); + expect(logExercise2.length, 1); + expect(logExercise2[0].id, 3); + + expect(workout.filterLogsByExercise(exercise3).length, 0); + }); + }); +} diff --git a/test_data/exercises.dart b/test_data/exercises.dart index be305fd61..0bccf7214 100644 --- a/test_data/exercises.dart +++ b/test_data/exercises.dart @@ -37,10 +37,10 @@ final exercise1 = Exercise( creationDate: DateTime(2021, 1, 15), name: 'test exercise 1', description: 'add clever text', + category: category1, categoryId: 1, muscles: [muscle1, muscle2], equipment: [equipment1, equipment2], - category: category1, ); final exercise2 = Exercise( @@ -49,9 +49,22 @@ final exercise2 = Exercise( creationDate: DateTime(2021, 1, 15), name: 'test exercise 2', description: 'Lorem ipsum etc', + category: category2, categoryId: 2, muscles: [muscle1], musclesSecondary: [muscle2], equipment: [equipment2], - category: category2, +); + +final exercise3 = Exercise( + id: 3, + uuid: 'a3b6c7bb-9d22-4119-a5fc-818584d5e9bc', + creationDate: DateTime(2021, 4, 1), + name: 'test exercise 3', + description: 'The man in black fled across the desert, and the gunslinger followed', + category: category3, + categoryId: 3, + muscles: [muscle1], + musclesSecondary: [muscle2], + equipment: [equipment2], ); diff --git a/test_data/workouts.dart b/test_data/workouts.dart index 1cc3ba12a..20f401a9e 100644 --- a/test_data/workouts.dart +++ b/test_data/workouts.dart @@ -17,6 +17,7 @@ */ import 'package:wger/models/workouts/day.dart'; +import 'package:wger/models/workouts/log.dart'; import 'package:wger/models/workouts/repetition_unit.dart'; import 'package:wger/models/workouts/set.dart'; import 'package:wger/models/workouts/setting.dart'; @@ -46,6 +47,39 @@ WorkoutPlan getWorkout() { setting1.weightUnit = weightUnit1; setting1.exercise = exercise1; + var log1 = Log.empty() + ..id = 1 + ..weight = 10 + ..rir = '1.5' + ..date = DateTime(2021, 5, 1) + ..reps = 10 + ..workoutPlan = 1; + log1.exercise = exercise1; + log1.weightUnit = weightUnit1; + log1.repetitionUnit = repetitionUnit1; + + var log2 = Log.empty() + ..id = 2 + ..weight = 10 + ..rir = '1.5' + ..date = DateTime(2021, 5, 1) + ..reps = 12 + ..workoutPlan = 1; + log2.exercise = exercise1; + log2.weightUnit = weightUnit1; + log2.repetitionUnit = repetitionUnit1; + + var log3 = Log.empty() + ..id = 3 + ..weight = 50 + ..rir = '' + ..date = DateTime(2021, 5, 2) + ..reps = 8 + ..workoutPlan = 1; + log3.exercise = exercise2; + log3.weightUnit = weightUnit1; + log3.repetitionUnit = repetitionUnit1; + var set1 = Set.withData( id: 1, day: 1, @@ -69,11 +103,11 @@ WorkoutPlan getWorkout() { ..daysOfWeek = [4]; var workout = WorkoutPlan( - id: 1, - creationDate: DateTime(2021, 01, 01), - description: 'test workout 1', - days: [day1, day2], - ); + id: 1, + creationDate: DateTime(2021, 01, 01), + description: 'test workout 1', + days: [day1, day2], + logs: [log1, log2, log3]); return workout; }