123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import 'package:sport/services/Converter.dart';
- class SportTarget {
- int id;
- String name;
- String intension;
- int duration;
- int consume;
- String fitPeople;
- int sort;
- int userId;
- String type;
- int monthFinish;
- int durationMinute;
- SportTarget(
- {this.id,
- this.name,
- this.intension,
- this.duration,
- this.consume,
- this.fitPeople,
- this.sort,
- this.userId});
- SportTarget.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- name = json['name'];
- intension = json['intension'];
- duration = json['duration'];
- consume = json['consume'];
- fitPeople = json['fit_people'];
- sort = json['sort'];
- userId = Converter.toInt(json['user_id']);
- type = json['type'];
- monthFinish = json['month_finish'];
- durationMinute = json['duration_minute'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['name'] = this.name;
- data['intension'] = this.intension;
- data['duration'] = this.duration;
- data['consume'] = this.consume;
- data['fit_people'] = this.fitPeople;
- data['sort'] = this.sort;
- data['user_id'] = this.userId;
- data['type'] = this.type;
- data['month_finish'] = this.monthFinish;
- data['duration_minute'] = this.durationMinute;
- return data;
- }
- int get valueTarget => type == "consume" ? consume : durationMinute;
- String get label => type == "consume" ? "卡" : "分钟";
- }
|