diff --git a/lib/Models/exercise.dart b/lib/Models/exercise.dart index 9ec9800..4fa9b90 100644 --- a/lib/Models/exercise.dart +++ b/lib/Models/exercise.dart @@ -8,14 +8,14 @@ class Exercise { this.totalWeight,); Exercise.fromJson(Map exercise) - : this.name = exercise['name']! as String, + : name = exercise['name']! as String, - this.sets = exercise['sets']! as List, + sets = exercise['sets']! as List, - this.bodyParts = exercise['body_parts']! as List, - 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, + totalReps = exercise['total_reps']! as int, + totalWeight = exercise['total_weight']! as double, + totalSets = exercise['total_sets']! as int; String name; List sets; diff --git a/lib/Models/maxes.dart b/lib/Models/maxes.dart index 5850d52..81fef1d 100644 --- a/lib/Models/maxes.dart +++ b/lib/Models/maxes.dart @@ -5,11 +5,11 @@ class Max { Max(this.weight, this.reps, this.sets, this.exercise,); Max.fromJson(Map 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; diff --git a/lib/Models/prev_workout_data.dart b/lib/Models/prev_workout_data.dart index c80c01f..d5dcc37 100644 --- a/lib/Models/prev_workout_data.dart +++ b/lib/Models/prev_workout_data.dart @@ -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; diff --git a/lib/Models/user.dart b/lib/Models/user.dart index f36eb5e..a310a9d 100644 --- a/lib/Models/user.dart +++ b/lib/Models/user.dart @@ -6,16 +6,15 @@ class UserClass { this.firstname, this.lastname, this.system, this.userID,); UserClass.fromJson(Map 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; @@ -42,6 +41,6 @@ class UserClass { } void setUserID(String id) { - this.userID = id; + userID = id; } } diff --git a/lib/Models/workout.dart b/lib/Models/workout.dart index b6b2a7f..97e0cae 100644 --- a/lib/Models/workout.dart +++ b/lib/Models/workout.dart @@ -19,7 +19,6 @@ class Workout { this.totalSets,); Workout.fromJson(Map workout) - : this.exercises = workout['exercises']! as List, this.notes = workout['notes']! as String, this.rating = workout['rating']! as String, @@ -32,31 +31,31 @@ class Workout { this.template = workout['template']! as bool; Workout.fromJsonQuery(QueryDocumentSnapshot> workout) - : this.exercises = workout['exercises']! as List, - 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, + 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> 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; diff --git a/lib/Models/workout_data.dart b/lib/Models/workout_data.dart index 34c5aaf..ea85700 100644 --- a/lib/Models/workout_data.dart +++ b/lib/Models/workout_data.dart @@ -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; diff --git a/lib/UI/exercise/add_exercise_widget.dart b/lib/UI/exercise/add_exercise_widget.dart index 68314a5..104c5e7 100644 --- a/lib/UI/exercise/add_exercise_widget.dart +++ b/lib/UI/exercise/add_exercise_widget.dart @@ -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 diff --git a/lib/UI/maxes/max_builder.dart b/lib/UI/maxes/max_builder.dart index 4421391..1a34bbb 100644 --- a/lib/UI/maxes/max_builder.dart +++ b/lib/UI/maxes/max_builder.dart @@ -76,10 +76,10 @@ class _MaxInformationState extends State { 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) { diff --git a/lib/UI/workout/save_workout_dialog.dart b/lib/UI/workout/save_workout_dialog.dart index 19f78b1..96f4beb 100644 --- a/lib/UI/workout/save_workout_dialog.dart +++ b/lib/UI/workout/save_workout_dialog.dart @@ -88,7 +88,7 @@ class _SaveWorkoutAlertState extends State { ), Checkbox( fillColor: MaterialStateProperty.all(theme.colorTheme.primaryColor), - value: this.template, + value: template, onChanged: (bool? value) { setState(() { Log.info(value.toString()); diff --git a/lib/UI/workout/workout_name_selection_widget.dart b/lib/UI/workout/workout_name_selection_widget.dart index faf8c17..73a50d3 100644 --- a/lib/UI/workout/workout_name_selection_widget.dart +++ b/lib/UI/workout/workout_name_selection_widget.dart @@ -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 workoutList; diff --git a/lib/UI/workout/workout_toatals_widget.dart b/lib/UI/workout/workout_toatals_widget.dart index 3fa12f5..195e264 100644 --- a/lib/UI/workout/workout_toatals_widget.dart +++ b/lib/UI/workout/workout_toatals_widget.dart @@ -140,11 +140,11 @@ class _WorkoutTotalsWidgetState extends State { 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; diff --git a/lib/src/core/base/extensions/string_extension.dart b/lib/src/core/base/extensions/string_extension.dart index 06d9f3e..0a6d4ed 100644 --- a/lib/src/core/base/extensions/string_extension.dart +++ b/lib/src/core/base/extensions/string_extension.dart @@ -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!;