mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
60 lines
1.2 KiB
Dart
60 lines
1.2 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:wger/helpers/json.dart';
|
|
import 'package:wger/models/exercises/exercise.dart';
|
|
|
|
part 'setting.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class Setting {
|
|
@JsonKey(required: true)
|
|
int id;
|
|
|
|
@JsonKey(required: true, name: 'set')
|
|
int setId;
|
|
|
|
@JsonKey(required: false)
|
|
Exercise exerciseObj;
|
|
|
|
@JsonKey(required: true, name: 'exercise')
|
|
int exerciseId;
|
|
|
|
@JsonKey(required: true, name: 'repetition_unit')
|
|
int repetitionUnit;
|
|
|
|
@JsonKey(required: true)
|
|
int reps;
|
|
|
|
@JsonKey(required: true, fromJson: toNum, toJson: toString)
|
|
num weight;
|
|
|
|
@JsonKey(required: true, name: 'weight_unit')
|
|
int weightUnit;
|
|
|
|
@JsonKey(required: true, defaultValue: '')
|
|
String comment = '';
|
|
|
|
// Generated by Server
|
|
@JsonKey(required: false)
|
|
String repsText;
|
|
|
|
Setting({
|
|
this.id,
|
|
this.setId,
|
|
this.exerciseObj,
|
|
this.repetitionUnit,
|
|
this.reps,
|
|
this.weight,
|
|
this.weightUnit,
|
|
this.comment,
|
|
this.repsText,
|
|
}) {
|
|
if (exerciseObj != null) {
|
|
this.exerciseId = exerciseObj.id;
|
|
}
|
|
}
|
|
|
|
// Boilerplate
|
|
factory Setting.fromJson(Map<String, dynamic> json) => _$SettingFromJson(json);
|
|
Map<String, dynamic> toJson() => _$SettingToJson(this);
|
|
}
|