12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- class SportTargetDay {
- int id;
- int userId;
- int consume;
- int duration;
- int consumeTarget;
- int durationTarget;
- bool finish;
- String type;
- String createdAt;
- int durationMinute;
- int durationTargetMinute;
- SportTargetDay(
- {this.id,
- this.userId,
- this.consume,
- this.duration,
- this.consumeTarget,
- this.durationTarget,
- this.finish,
- this.type,
- this.createdAt,
- this.durationMinute,
- this.durationTargetMinute});
- SportTargetDay.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- userId = json['user_id'];
- consume = json['consume'];
- duration = json['duration'];
- consumeTarget = json['consume_target'];
- durationTarget = json['duration_target'];
- finish = json['finish'];
- type = json['type'];
- createdAt = json['created_at'];
- durationMinute = json['duration_minute'];
- durationTargetMinute = json['duration_target_minute'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['user_id'] = this.userId;
- data['consume'] = this.consume;
- data['duration'] = this.duration;
- data['consume_target'] = this.consumeTarget;
- data['duration_target'] = this.durationTarget;
- data['finish'] = this.finish;
- data['type'] = this.type;
- data['created_at'] = this.createdAt;
- data['duration_minute'] = this.durationMinute;
- data['duration_target_minute'] = this.durationTargetMinute;
- return data;
- }
- int get value => type == "consume" ? consume : durationMinute;
- int get valueTarget => type == "consume" ? consumeTarget : durationTargetMinute;
- String get label => type == "consume" ? "卡" : "分钟";
- }
|