87 lines
1.9 KiB
Dart
87 lines
1.9 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'exercise_type.dart';
|
|
|
|
enum WorkoutType { endurance, oneRepMax, cardio, staticExercise }
|
|
|
|
extension WorkoutTypeExt on WorkoutType {
|
|
static const WorkoutTypeMenu = {
|
|
WorkoutType.endurance: "Endurance",
|
|
WorkoutType.cardio: "Cardio",
|
|
WorkoutType.oneRepMax: "One Rep Max",
|
|
WorkoutType.staticExercise: "Static"
|
|
};
|
|
|
|
bool equals(WorkoutType type) => this.toString() == type.toString();
|
|
bool equalsString(String type) => this.toString() == type;
|
|
|
|
String get menu => WorkoutTypeMenu[this];
|
|
}
|
|
|
|
class WorkoutMenuTree {
|
|
int id;
|
|
int parent;
|
|
String name;
|
|
String imageName;
|
|
Color color;
|
|
double fontSize;
|
|
bool child;
|
|
int exerciseTypeId;
|
|
ExerciseType exerciseType;
|
|
bool base;
|
|
|
|
bool is1RM;
|
|
bool isEndurance;
|
|
bool isRunning;
|
|
List<WorkoutType> workoutTypes = List();
|
|
bool selected = false;
|
|
bool executed = false;
|
|
String exerciseDetail;
|
|
String nameEnglish;
|
|
String parentName;
|
|
String parentNameEnglish;
|
|
int sort;
|
|
|
|
WorkoutMenuTree(
|
|
this.id,
|
|
this.parent,
|
|
this.name,
|
|
this.imageName,
|
|
this.color,
|
|
this.fontSize,
|
|
this.child,
|
|
this.exerciseTypeId,
|
|
this.exerciseType,
|
|
this.base,
|
|
this.is1RM,
|
|
this.isEndurance,
|
|
this.isRunning,
|
|
this.nameEnglish,
|
|
this.parentName,
|
|
this.parentNameEnglish,
|
|
this.sort);
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
"id": id,
|
|
"parent": parent,
|
|
"name": name,
|
|
"imageName": imageName,
|
|
"color": color.toString(),
|
|
"fontSize": fontSize.toString(),
|
|
"child": child.toString(),
|
|
"exerciseTypeId": exerciseTypeId.toString(),
|
|
"base": base.toString(),
|
|
"is1RM": is1RM.toString(),
|
|
"isEndurance": isEndurance.toString(),
|
|
"isRunning": isRunning.toString(),
|
|
"sort": sort,
|
|
};
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return this.toJson().toString();
|
|
}
|
|
}
|