game_record_history.dart 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import 'package:sport/bean/game_record_sum.dart';
  2. import 'package:sport/services/Converter.dart';
  3. class GameRecordHistory {
  4. List<GameRecordSum>? records;
  5. JogInfo? jogInfo;
  6. GameRecordHistory({this.records, this.jogInfo});
  7. GameRecordHistory.fromJson(Map<String, dynamic> json) {
  8. if (json['records'] != null) {
  9. records = [];
  10. json['records'].forEach((v) {
  11. records!.add(GameRecordSum.fromJson(v));
  12. });
  13. }
  14. jogInfo = json['jog_info'] != null ? JogInfo.fromJson(json['jog_info']) : null;
  15. }
  16. Map<String, dynamic> toJson() {
  17. final Map<String, dynamic> data = new Map<String, dynamic>();
  18. if (this.records != null) {
  19. data['records'] = this.records!.map((v) => v.toJson()).toList();
  20. }
  21. if (this.jogInfo != null) {
  22. data['jog_info'] = this.jogInfo!.toJson();
  23. }
  24. return data;
  25. }
  26. }
  27. class JogInfo {
  28. int distanceJog = 0;
  29. int durationJog = 0;
  30. double stepRateJog = 0;
  31. int jogUserCount = 0;
  32. JogInfo({this.distanceJog = 0, this.durationJog = 0, this.stepRateJog = 0, this.jogUserCount = 0});
  33. JogInfo.fromJson(Map<String, dynamic> json) {
  34. distanceJog = json['distance_jog'];
  35. durationJog = json['duration_jog'];
  36. stepRateJog = Converter.toDouble(json['step_rate_jog']);
  37. jogUserCount = json['jog_user_count'];
  38. }
  39. Map<String, dynamic> toJson() {
  40. final Map<String, dynamic> data = new Map<String, dynamic>();
  41. data['distance_jog'] = this.distanceJog;
  42. data['duration_jog'] = this.durationJog;
  43. data['step_rate_jog'] = this.stepRateJog;
  44. data['jog_user_count'] = this.jogUserCount;
  45. return data;
  46. }
  47. }