87 lines
1.8 KiB
Dart
87 lines
1.8 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) => toString() == type.toString();
|
|
bool equalsString(String type) => toString() == type;
|
|
|
|
String? get menu => WorkoutTypeMenu[this];
|
|
}
|
|
|
|
class WorkoutMenuTree {
|
|
late int id;
|
|
late int parent;
|
|
late String name;
|
|
late String imageName;
|
|
late Color color;
|
|
late double fontSize;
|
|
late bool child;
|
|
late int exerciseTypeId;
|
|
ExerciseType? exerciseType;
|
|
late bool base;
|
|
|
|
late bool is1RM;
|
|
late bool isRunning;
|
|
List<WorkoutType> workoutTypes = [];
|
|
bool selected = false;
|
|
bool executed = false;
|
|
late String exerciseDetail;
|
|
late String nameEnglish;
|
|
late String parentName;
|
|
late String parentNameEnglish;
|
|
late int sort;
|
|
late String internalName;
|
|
|
|
WorkoutMenuTree(
|
|
id,
|
|
parent,
|
|
name,
|
|
imageName,
|
|
color,
|
|
fontSize,
|
|
child,
|
|
exerciseTypeId,
|
|
exerciseType,
|
|
base,
|
|
is1RM,
|
|
isRunning,
|
|
nameEnglish,
|
|
parentName,
|
|
parentNameEnglish,
|
|
sort,
|
|
internalName);
|
|
|
|
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(),
|
|
"isRunning": isRunning.toString(),
|
|
"sort": sort,
|
|
"internalName": internalName,
|
|
};
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return toJson().toString();
|
|
}
|
|
}
|