1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import 'package:sport/services/Converter.dart';
- class SportTarget {
- late int id;
- late String name;
- String? intension;
- int duration = 0;
- int consume = 0;
- String? fitPeople;
- int? sort;
- int? userId;
- String? type;
- int? monthFinish;
- int? durationMinute;
- SportTarget(
- {this.id = 0,
- this.name = "",
- this.intension,
- this.duration = 0,
- this.consume = 0,
- 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" ? "大卡" : "分钟";
- }
|