achievement_rule.dart 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import 'package:sport/bean/rank_game_info.dart';
  2. import 'package:sport/bean/user.dart';
  3. import 'package:sport/services/Converter.dart';
  4. class AchievementRule {
  5. List<Table>? table;
  6. List<Texts>? texts;
  7. AchievementRule({this.table, this.texts});
  8. AchievementRule.fromJson(Map<String, dynamic> json) {
  9. if (json['table'] != null) {
  10. table =[];
  11. json['table'].forEach((v) {
  12. table!.add(new Table.fromJson(v));
  13. });
  14. }
  15. if (json['texts'] != null) {
  16. texts = [];
  17. json['texts'].forEach((v) {
  18. texts!.add(new Texts.fromJson(v));
  19. });
  20. }
  21. }
  22. Map<String, dynamic> toJson() {
  23. final Map<String, dynamic> data = new Map<String, dynamic>();
  24. if (this.table != null) {
  25. data['table'] = this.table!.map((v) => v.toJson()).toList();
  26. }
  27. if (this.texts != null) {
  28. data['texts'] = this.texts!.map((v) => v.toJson()).toList();
  29. }
  30. return data;
  31. }
  32. }
  33. class Table {
  34. String? condition;
  35. int score = 0;
  36. int exp = 0;
  37. Table({this.condition, this.score=0, this.exp=0});
  38. Table.fromJson(Map<String, dynamic> json) {
  39. condition = json['condition'];
  40. score = json['score']??0;
  41. exp = json['exp']??0;
  42. }
  43. Map<String, dynamic> toJson() {
  44. final Map<String, dynamic> data = new Map<String, dynamic>();
  45. data['condition'] = this.condition;
  46. data['score'] = this.score;
  47. data['exp'] = this.exp;
  48. return data;
  49. }
  50. }
  51. class Texts {
  52. String? title;
  53. String? content;
  54. Texts({this.title, this.content});
  55. Texts.fromJson(Map<String, dynamic> json) {
  56. title = json['title'];
  57. content = json['content'];
  58. }
  59. Map<String, dynamic> toJson() {
  60. final Map<String, dynamic> data = new Map<String, dynamic>();
  61. data['title'] = this.title;
  62. data['content'] = this.content;
  63. return data;
  64. }
  65. }