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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/Models/exercise.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class Exercise {
this.totalWeight,);

Exercise.fromJson(Map<String, Object?> exercise)
: this.name = exercise['name']! as String,
: name = exercise['name']! as String,

this.sets = exercise['sets']! as List<dynamic>,
sets = exercise['sets']! as List<dynamic>,

this.bodyParts = exercise['body_parts']! as List<dynamic>,
this.totalReps = exercise['total_reps']! as int,
this.totalWeight = exercise['total_weight']! as double,
this.totalSets = exercise['total_sets']! as int;
bodyParts = exercise['body_parts']! as List<dynamic>,
totalReps = exercise['total_reps']! as int,
totalWeight = exercise['total_weight']! as double,
totalSets = exercise['total_sets']! as int;

String name;
List<dynamic> sets;
Expand Down
10 changes: 5 additions & 5 deletions lib/Models/maxes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ class Max {
Max(this.weight, this.reps, this.sets, this.exercise,);

Max.fromJson(Map<String, Object?> max)
: this.sets = max['sets']! as int,
this.reps = max['reps']! as int,
this.weight = max['weight']! as double,
this.exercise = max['exercise']! as String,
this.exerciseID = max['exerciseID']! as String;
: sets = max['sets']! as int,
reps = max['reps']! as int,
weight = max['weight']! as double,
exercise = max['exercise']! as String,
exerciseID = max['exerciseID']! as String;

int reps;
int sets;
Expand Down
2 changes: 1 addition & 1 deletion lib/Models/prev_workout_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PrevWorkoutData {

PrevWorkoutData(this.workout, this.totals, this.updateTotals, this.addNewSet) {

workout = this.workout;
workout = workout;

loadWorkoutData().then((Workout value) {
workout = value;
Expand Down
21 changes: 10 additions & 11 deletions lib/Models/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ class UserClass {
this.firstname, this.lastname, this.system, this.userID,);

UserClass.fromJson(Map<String, Object?> user)
: this.username = user['username']! as String,
this.height = user['height']! as double,
this.weight = user['weight']! as double,
this.age = user['age']! as int,
this.email = user['email']! as String,
this.firstname = user['firstname']! as String,
this.lastname = user['lastname'] as String,
this.system = user['system']! as String,
this.userID = user['userID']! as String;

: username = user['username']! as String,
height = user['height']! as double,
weight = user['weight']! as double,
age = user['age']! as int,
email = user['email']! as String,
firstname = user['firstname']! as String,
lastname = user['lastname'] as String,
system = user['system']! as String,
userID = user['userID']! as String;
String username;
double weight;
double height;
Expand All @@ -42,6 +41,6 @@ class UserClass {
}

void setUserID(String id) {
this.userID = id;
userID = id;
}
}
43 changes: 21 additions & 22 deletions lib/Models/workout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Workout {
this.totalSets,);

Workout.fromJson(Map<String, Object?> workout)

: this.exercises = workout['exercises']! as List,
this.notes = workout['notes']! as String,
this.rating = workout['rating']! as String,
Expand All @@ -32,31 +31,31 @@ class Workout {
this.template = workout['template']! as bool;

Workout.fromJsonQuery(QueryDocumentSnapshot<Map<String, dynamic>> workout)
: this.exercises = workout['exercises']! as List<Exercise>,
this.notes = workout['notes']! as String,
this.rating = workout['rating']! as String,
this.time = workout['time']! as double,
this.totalReps = workout['total_reps']! as int,
this.totalWeight = workout['total_weight']! as double,
this.totalSets = workout['total_sets']! as int,
this.name = workout['name']! as String,
this.type = workout['type']! as String,
this.template = workout['template']! as bool;
: exercises = workout['exercises']! as List<Exercise>,
notes = workout['notes']! as String,
rating = workout['rating']! as String,
time = workout['time']! as double,
totalReps = workout['total_reps']! as int,
totalWeight = workout['total_weight']! as double,
totalSets = workout['total_sets']! as int,
name = workout['name']! as String,
type = workout['type']! as String,
template = workout['template']! as bool;

Workout.fromJsonQuerySnapshot(QuerySnapshot<Map<String, dynamic>> workout)

: this.exercises = workout.docs.last['exercises']! as List,
this.notes = workout.docs.last['notes']! as String,
this.date =
: exercises = workout.docs.last['exercises']! as List,
notes = workout.docs.last['notes']! as String,
date =
DateTime.parse(workout.docs.last['date']!.toDate().toString()),
this.rating = workout.docs.last['rating']! as String,
this.time = workout.docs.last['time']! as double,
this.totalReps = workout.docs.last['total_reps']! as int,
this.totalWeight = workout.docs.last['total_weight']! as double,
this.totalSets = workout.docs.last['total_sets']! as int,
this.name = workout.docs.last['name']! as String,
this.type = workout.docs.last['type']! as String,
this.template = workout.docs.last['template']! as bool;
rating = workout.docs.last['rating']! as String,
time = workout.docs.last['time']! as double,
totalReps = workout.docs.last['total_reps']! as int,
totalWeight = workout.docs.last['total_weight']! as double,
totalSets = workout.docs.last['total_sets']! as int,
name = workout.docs.last['name']! as String,
type = workout.docs.last['type']! as String,
template = workout.docs.last['template']! as bool;

List exercises;
String notes;
Expand Down
2 changes: 1 addition & 1 deletion lib/Models/workout_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:flutter/widgets.dart';
class WorkoutData {

WorkoutData(this.workout, this.totals, this.updateTotals) {
workout = this.workout;
workout = workout;

loadWorkoutData().then((Workout value) {
workout = value;
Expand Down
2 changes: 1 addition & 1 deletion lib/UI/exercise/add_exercise_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ExerciseNameSelectionWidget extends StatefulWidget {

ExerciseNameSelectionWidget({required this.setExercisename, Key? key})
: super(key: key) {
setExercisename = this.setExercisename;
setExercisename = setExercisename;
}
Function(String) setExercisename;
@override
Expand Down
4 changes: 2 additions & 2 deletions lib/UI/maxes/max_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ class _MaxInformationState extends State<MaxInformation> {

String oneRepMaxPercentLabel(double weight, double oneRepMax) {
if (oneRepMax > 0.0) {
this.text = '${((weight / oneRepMax) * 100).round()}%';
text = '${((weight / oneRepMax) * 100).round()}%';
}

return this.text;
return text;
}

bool minimumOneWeightRep(Sets sets) {
Expand Down
2 changes: 1 addition & 1 deletion lib/UI/workout/save_workout_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class _SaveWorkoutAlertState extends State<SaveWorkoutAlert> {
),
Checkbox(
fillColor: MaterialStateProperty.all<Color>(theme.colorTheme.primaryColor),
value: this.template,
value: template,
onChanged: (bool? value) {
setState(() {
Log.info(value.toString());
Expand Down
2 changes: 1 addition & 1 deletion lib/UI/workout/workout_name_selection_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WorkoutTemplateSelectionWidget extends StatefulWidget {
WorkoutTemplateSelectionWidget(
{required this.setWorkout, required this.workoutList, Key? key,})
: super(key: key) {
setWorkout = this.setWorkout;
setWorkout = setWorkout;
}
Function(Workout) setWorkout;
List <dynamic>workoutList;
Expand Down
10 changes: 5 additions & 5 deletions lib/UI/workout/workout_toatals_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ class _WorkoutTotalsWidgetState extends State<WorkoutTotalsWidget> {
class WorkoutTotals {

WorkoutTotals(this.sets, this.reps, this.weight, this.avgKgs, this.exercises) {
sets = this.sets;
reps = this.reps;
weight = this.weight;
avgKgs = this.avgKgs;
exercises = this.exercises;
sets = sets;
reps = reps;
weight = weight;
avgKgs = avgKgs;
exercises = exercises;
}

int sets;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/core/base/extensions/string_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extension StringExtension on String? {

// Check null string, return given value if null
String validate({String value = ''}) {
if (this.isEmptyOrNull) {
if (isEmptyOrNull) {
return value;
} else {
return this!;
Expand Down