123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- import 'package:sport/services/Converter.dart';
- class SportStep {
- List<Record> records;
- Sum sum;
- SportStep({this.records, this.sum});
- SportStep.fromJson(Map<String, dynamic> json) {
- if (json['records'] != null) {
- records = new List<Record>();
- json['records'].forEach((v) {
- records.add(new Record.fromJson(v));
- });
- }
- sum = json['sum'] != null ? new Sum.fromJson(json['sum']) : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- if (this.records != null) {
- data['records'] = this.records.map((v) => v.toJson()).toList();
- }
- if (this.sum != null) {
- data['sum'] = this.sum.toJson();
- }
- return data;
- }
- }
- class Record {
- int id;
- int userId;
- int step;
- int distance;
- int stepGame;
- int stepDaily;
- String createdAt;
- int year;
- int month;
- Record({this.id, this.userId, this.step, this.distance, this.stepGame, this.stepDaily, this.createdAt});
- Record.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- userId = json['user_id'];
- step = json['step'];
- distance = json['distance'];
- stepGame = json['step_game'];
- stepDaily = json['step_daily'];
- createdAt = json['created_at'];
- year = json['year'];
- month = json['month'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['user_id'] = this.userId;
- data['step'] = this.step;
- data['distance'] = this.distance;
- data['step_game'] = this.stepGame;
- data['step_daily'] = this.stepDaily;
- data['created_at'] = this.createdAt;
- return data;
- }
- }
- class Sum {
- int stepDayAvg;
- int distance;
- int step;
- int stepDaily;
- int stepGame;
- double stepRate;
- double stepRateMax;
- Sum({this.stepDayAvg, this.distance, this.step, this.stepDaily, this.stepGame, this.stepRate, this.stepRateMax});
- Sum.fromJson(Map<String, dynamic> json) {
- stepDayAvg = json['step_day_avg'];
- distance = json['distance'];
- step = json['step'];
- stepDaily = json['step_daily'];
- stepGame = json['step_game'];
- stepRate = Converter.toDouble(json['step_rate']);
- stepRateMax = Converter.toDouble(json['step_rate_max']);
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['step_day_avg'] = this.stepDayAvg;
- data['distance'] = this.distance;
- data['step'] = this.step;
- data['step_daily'] = this.stepDaily;
- data['step_game'] = this.stepGame;
- data['step_rate'] = this.stepRate;
- data['step_rate_max'] = this.stepRateMax;
- return data;
- }
- }
|