94 lines
2.7 KiB
Dart
94 lines
2.7 KiB
Dart
enum ResultItem {
|
|
calorie,
|
|
development_percent_bodypart,
|
|
distance,
|
|
fatburn_percent,
|
|
bpm_avg,
|
|
bpm_min,
|
|
bpm_max,
|
|
speed_max,
|
|
reps_volume,
|
|
steps,
|
|
//time,
|
|
weight_volume
|
|
}
|
|
|
|
extension ResultItemExt on ResultItem {
|
|
static const ResultItemDesc = {
|
|
ResultItem.calorie: "Calorie",
|
|
ResultItem.development_percent_bodypart: "Development in %",
|
|
ResultItem.distance: "Distance",
|
|
ResultItem.bpm_avg: "Average BPM",
|
|
ResultItem.bpm_min: "Min BPM",
|
|
ResultItem.bpm_max: "Max BPM",
|
|
ResultItem.speed_max: "Max speed",
|
|
ResultItem.reps_volume: "Repeats volume",
|
|
ResultItem.steps: "Steps",
|
|
//ResultItem.time: "Time",
|
|
ResultItem.weight_volume: "Weight volume",
|
|
ResultItem.fatburn_percent: "Fatburn %",
|
|
};
|
|
|
|
static const ResultItemImg = {
|
|
ResultItem.calorie: "pict_calorie.png",
|
|
ResultItem.development_percent_bodypart: "pic_development_by_bodypart_percent.png",
|
|
ResultItem.distance: "pict_distance_m.png",
|
|
ResultItem.bpm_avg: "pict_hravg_bpm.png",
|
|
ResultItem.bpm_min: "pict_hrmin_bpm.png",
|
|
ResultItem.bpm_max: "pict_hrmax_bpm.png",
|
|
ResultItem.speed_max: "pict_maxspeed_kmh.png",
|
|
ResultItem.reps_volume: "pict_reps_volumen_db.png",
|
|
ResultItem.steps: "pict_steps.png",
|
|
//ResultItem.time: "pict_time_h.png",
|
|
ResultItem.weight_volume: "pict_weight_volumen_tonna.png",
|
|
ResultItem.fatburn_percent: "pict_fatburn_percent.png",
|
|
};
|
|
|
|
static const HardwareData = {
|
|
ResultItem.calorie: true,
|
|
ResultItem.development_percent_bodypart: false,
|
|
ResultItem.distance: true,
|
|
ResultItem.bpm_avg: true,
|
|
ResultItem.bpm_min: true,
|
|
ResultItem.bpm_max: true,
|
|
ResultItem.speed_max: true,
|
|
ResultItem.reps_volume: false,
|
|
ResultItem.steps: true,
|
|
//ResultItem.time: false,
|
|
ResultItem.weight_volume: false,
|
|
ResultItem.fatburn_percent: true,
|
|
};
|
|
|
|
bool equals(ResultItem item) => this.toString() == item.toString();
|
|
bool equalsString(String item) => this.description == item;
|
|
|
|
String get description => ResultItemDesc[this];
|
|
String get image => ResultItemImg[this];
|
|
bool get isHardware => HardwareData[this];
|
|
|
|
String displayString() => description;
|
|
}
|
|
|
|
class ResultExt {
|
|
final String itemString;
|
|
ResultItem item;
|
|
String data = "0";
|
|
|
|
ResultExt({this.itemString}) {
|
|
ResultItem.values.forEach((element) {
|
|
if (element.equalsString(itemString)) {
|
|
item = element;
|
|
}
|
|
});
|
|
}
|
|
|
|
String getDescription() => item.description;
|
|
String getImage() => "asset/image/" + item.image;
|
|
bool isHardware() {
|
|
return item.isHardware;
|
|
}
|
|
|
|
bool equals(ResultItem item) => this.item.equals(item);
|
|
bool equalsString(String item) => this.item.equalsString(item);
|
|
}
|