video_new_model.dart 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. class VideoNewModel {
  2. VideoNewModel({
  3. String? contentId,
  4. String? url,
  5. String? title,
  6. int? likeCount,
  7. int? commentCount,
  8. int? favoriteCount,
  9. int? shareCount,
  10. //List<dynamic>? commentList,
  11. String? coverImage,
  12. bool? isLiked,
  13. bool? isFavorite,
  14. int? viewCount,
  15. String? createTime,
  16. String? author,
  17. String? shareUrl,
  18. String? shareDesc,
  19. }) {
  20. _contentId = contentId;
  21. _url = url;
  22. _title = title;
  23. _likeCount = likeCount;
  24. _commentCount = commentCount;
  25. _favoriteCount = favoriteCount;
  26. _shareCount = shareCount;
  27. //_commentList = commentList;
  28. _coverImage = coverImage;
  29. _isLiked = isLiked;
  30. _isFavorite = isFavorite;
  31. _viewCount = viewCount;
  32. _createTime = createTime;
  33. _author = author;
  34. _shareUrl = shareUrl;
  35. _shareDesc = shareDesc;
  36. }
  37. VideoNewModel.fromJson(dynamic json) {
  38. _contentId = json['contentId'];
  39. _url = json['url'];
  40. _title = json['title'];
  41. _likeCount = json['likeCount'];
  42. _commentCount = json['commentCount'];
  43. _favoriteCount = json['favoriteCount'];
  44. _shareCount = json['shareCount'];
  45. _isLiked = json['isLiked'];
  46. _isFavorite = json['isFavorite'];
  47. _viewCount = json['viewCount'];
  48. _createTime = json['createTime'];
  49. _author = json['author'];
  50. /* if (json['commentList'] != null) {
  51. _commentList = [];
  52. json['commentList'].forEach((v) {
  53. _commentList?.add(Dynamic.fromJson(v));
  54. });
  55. }*/
  56. _coverImage = json['coverImage'];
  57. _shareUrl = json['shareUrl'];
  58. _shareDesc = json['shareDesc'];
  59. }
  60. String? _contentId;
  61. String? _url;
  62. String? _title;
  63. int? _likeCount;
  64. int? _commentCount;
  65. int? _favoriteCount;
  66. int? _shareCount;
  67. bool? _isLiked;
  68. bool? _isFavorite;
  69. int? _viewCount;
  70. String? _createTime;
  71. // List<dynamic>? _commentList;
  72. String? _coverImage;
  73. String? _author;
  74. String? _shareUrl;
  75. String? _shareDesc;
  76. VideoNewModel copyWith({
  77. String? contentId,
  78. String? url,
  79. String? title,
  80. int? likeCount,
  81. int? commentCount,
  82. int? favoriteCount,
  83. // List<Comment>? commentList,
  84. int? shareCount,
  85. bool? isLiked,
  86. bool? isFavorite,
  87. int? viewCount,
  88. String? createTime,
  89. String? coverImage,
  90. String? author,
  91. String? shareUrl,
  92. String? shareDesc,
  93. }) => VideoNewModel(
  94. contentId: contentId ?? _contentId,
  95. url: url ?? _url,
  96. title: title ?? _title,
  97. likeCount: likeCount ?? _likeCount,
  98. commentCount: commentCount ?? _commentCount,
  99. favoriteCount: favoriteCount ?? _favoriteCount,
  100. // commentList: commentList ?? _commentList,
  101. shareCount: shareCount ?? _shareCount,
  102. coverImage: coverImage ?? _coverImage,
  103. isLiked: isLiked ?? _isLiked,
  104. isFavorite: isFavorite ?? _isFavorite,
  105. viewCount: viewCount ?? _viewCount,
  106. createTime: createTime ?? _createTime,
  107. author: author ?? _author,
  108. shareUrl:shareUrl ?? _shareUrl,
  109. shareDesc:shareDesc ?? _shareDesc,
  110. );
  111. String? get contentId => _contentId;
  112. String? get url => _url;
  113. String? get title => _title;
  114. int? get likeCount => _likeCount;
  115. int? get commentCount => _commentCount;
  116. int? get favoriteCount => _favoriteCount;
  117. int? get shareCount => _shareCount;
  118. bool? get isLiked => _isLiked;
  119. bool? get isFavorite => _isFavorite;
  120. int? get viewCount => _viewCount;
  121. String? get createTime => _createTime;
  122. // List<dynamic>? get commentList => _commentList;
  123. String? get coverImage => _coverImage;
  124. String? get author => _author;
  125. String? get shareUrl=> _shareUrl;
  126. String? get shareDesc=> _shareDesc;
  127. Map<String, dynamic> toJson() {
  128. final map = <String, dynamic>{};
  129. map['contentId'] = _contentId;
  130. map['url'] = _url;
  131. map['title'] = _title;
  132. map['likeCount'] = _likeCount;
  133. map['commentCount'] = _commentCount;
  134. map['favoriteCount'] = _favoriteCount;
  135. map['shareCount'] = _shareCount;
  136. /* if (_commentList != null) {
  137. map['commentList'] = _commentList?.map((v) => v.toJson()).toList();
  138. }*/
  139. map['coverImage'] = _coverImage;
  140. map['isLiked'] = _isLiked;
  141. map['isFavorite'] = _isFavorite;
  142. map['viewCount'] = _viewCount;
  143. map['createTime'] = _createTime;
  144. map['author'] = _author;
  145. map['shareUrl'] = _shareUrl;
  146. map['shareDesc'] = _shareDesc;
  147. return map;
  148. }
  149. }