12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- import 'package:sport/bean/sport_target_day.dart';
- import 'package:sport/bean/sport_target_record.dart';
- import 'sport_target.dart';
- class SportTargetIndex {
- SportTarget target;
- SportTargetDay today;
- List<SportTargetRecord> records;
- List<Rewards> rewards;
- SportTargetIndex({this.target, this.today, this.records, this.rewards});
- SportTargetIndex.fromJson(Map<String, dynamic> json) {
- target =
- json['target'] != null ? new SportTarget.fromJson(json['target']) : null;
- today = json['today'] != null ? new SportTargetDay.fromJson(json['today']) : null;
- if (json['records'] != null) {
- records = new List<SportTargetRecord>();
- json['records'].forEach((v) {
- records.add(new SportTargetRecord.fromJson(v));
- });
- }
- if (json['rewards'] != null) {
- rewards = new List<Rewards>();
- json['rewards'].forEach((v) {
- rewards.add(new Rewards.fromJson(v));
- });
- }
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- if (this.target != null) {
- data['target'] = this.target.toJson();
- }
- if (this.today != null) {
- data['today'] = this.today.toJson();
- }
- if (this.records != null) {
- data['records'] = this.records.map((v) => v.toJson()).toList();
- }
- if (this.rewards != null) {
- data['rewards'] = this.rewards.map((v) => v.toJson()).toList();
- }
- return data;
- }
- }
- class Rewards {
- int id;
- int fullMonth;
- int score;
- String status;
- int days;
- Rewards({this.id, this.fullMonth, this.score, this.status, this.days});
- Rewards.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- fullMonth = json['full_month'];
- score = json['score'];
- status = json['status'];
- days = json['days'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['full_month'] = this.fullMonth;
- data['score'] = this.score;
- data['status'] = this.status;
- data['days'] = this.days;
- return data;
- }
- }
|