selection_model.dart 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. import 'package:equatable/equatable.dart';
  2. import 'package:json_annotation/json_annotation.dart';
  3. part 'selection_model.g.dart';
  4. @JsonSerializable()
  5. class SelectionModel extends Equatable {
  6. @JsonKey(name: 'itemList')
  7. final List<Selection> selectionList;
  8. @JsonKey(name: 'count')
  9. final int count;
  10. @JsonKey(name: 'total')
  11. final int total;
  12. @JsonKey(name: 'nextPageUrl')
  13. final String nextPageUrl;
  14. @JsonKey(name: 'adExist')
  15. final bool adExist;
  16. SelectionModel(this.selectionList, this.count, this.total, this.nextPageUrl,
  17. this.adExist);
  18. factory SelectionModel.fromJson(Map<String, dynamic> srcJson) =>
  19. _$SelectionModelFromJson(srcJson);
  20. Map<String, dynamic> toJson() => _$SelectionModelToJson(this);
  21. @override
  22. List<Object> get props => [selectionList, count, total, nextPageUrl, adExist];
  23. }
  24. @JsonSerializable()
  25. class Selection extends Equatable {
  26. @JsonKey(name: 'type')
  27. final String type;
  28. @JsonKey(name: 'data')
  29. final SelectionData data;
  30. @JsonKey(name: 'tag')
  31. final String tag;
  32. @JsonKey(name: 'id')
  33. final int id;
  34. @JsonKey(name: 'adIndex')
  35. final int adIndex;
  36. Selection(this.type, this.data, this.tag, this.id, this.adIndex);
  37. factory Selection.fromJson(Map<String, dynamic> srcJson) {
  38. try {
  39. return _$SelectionFromJson(srcJson);
  40. } catch (e) {
  41. print('$e');
  42. }
  43. }
  44. Map<String, dynamic> toJson() => _$SelectionToJson(this);
  45. @override
  46. List<Object> get props => [type, data, tag, id, adIndex];
  47. }
  48. @JsonSerializable()
  49. class SelectionData extends Equatable {
  50. @JsonKey(name: 'dataType')
  51. final String dataType;
  52. @JsonKey(name: 'header')
  53. final SelectionHeader header;
  54. @JsonKey(name: 'itemList')
  55. final List<Selection> selectionList;
  56. @JsonKey(name: 'count')
  57. final int count;
  58. @JsonKey(name: 'addTrack')
  59. final List<String> addTrack;
  60. @JsonKey(name: 'id')
  61. final int id;
  62. @JsonKey(name: 'type')
  63. final String type;
  64. @JsonKey(name: 'text')
  65. final String text;
  66. @JsonKey(name: 'subTitle')
  67. final String subTitle;
  68. @JsonKey(name: 'actionUrl')
  69. final String actionUrl;
  70. @JsonKey(name: 'follow')
  71. final Follow follow;
  72. @JsonKey(name: 'content')
  73. final Selection content;
  74. @JsonKey(name: 'title')
  75. final String title;
  76. @JsonKey(name: 'description')
  77. final String description;
  78. @JsonKey(name: 'tags')
  79. final List<Tags> tags;
  80. @JsonKey(name: 'consumption')
  81. final Consumption consumption;
  82. @JsonKey(name: 'resourceType')
  83. final String resourceType;
  84. @JsonKey(name: 'provider')
  85. final Provider provider;
  86. @JsonKey(name: 'category')
  87. final String category;
  88. @JsonKey(name: 'author')
  89. final Author author;
  90. @JsonKey(name: 'cover')
  91. final Cover cover;
  92. @JsonKey(name: 'playUrl')
  93. final String playUrl;
  94. @JsonKey(name: 'duration')
  95. final int duration;
  96. @JsonKey(name: 'webUrl')
  97. final WebUrl webUrl;
  98. @JsonKey(name: 'releaseTime')
  99. final int releaseTime;
  100. @JsonKey(name: 'playInfo')
  101. final List<PlayInfo> playInfo;
  102. @JsonKey(name: 'date')
  103. final int date;
  104. @JsonKey(name: 'labelList')
  105. final List<String> labelList;
  106. @JsonKey(name: 'collected')
  107. final bool collected;
  108. @JsonKey(name: 'reallyCollected')
  109. final bool reallyCollected;
  110. @JsonKey(name: 'played')
  111. final bool played;
  112. @JsonKey(name: 'src')
  113. final int src;
  114. SelectionData(
  115. this.dataType,
  116. this.header,
  117. this.selectionList,
  118. this.count,
  119. this.addTrack,
  120. this.id,
  121. this.type,
  122. this.text,
  123. this.subTitle,
  124. this.actionUrl,
  125. this.follow,
  126. this.content,
  127. this.title,
  128. this.description,
  129. this.tags,
  130. this.consumption,
  131. this.resourceType,
  132. this.provider,
  133. this.category,
  134. this.author,
  135. this.cover,
  136. this.playUrl,
  137. this.duration,
  138. this.webUrl,
  139. this.releaseTime,
  140. this.playInfo,
  141. this.date,
  142. this.labelList,
  143. this.collected,
  144. this.reallyCollected,
  145. this.played,
  146. this.src);
  147. @override
  148. List<Object> get props => [
  149. dataType,
  150. header,
  151. selectionList,
  152. count,
  153. addTrack,
  154. id,
  155. type,
  156. text,
  157. subTitle,
  158. actionUrl,
  159. follow,
  160. content,
  161. title,
  162. description,
  163. tags,
  164. consumption,
  165. resourceType,
  166. provider,
  167. category,
  168. author,
  169. cover,
  170. playUrl,
  171. duration,
  172. webUrl,
  173. releaseTime,
  174. playInfo,
  175. date,
  176. labelList,
  177. collected,
  178. reallyCollected,
  179. played,
  180. src
  181. ];
  182. factory SelectionData.fromJson(Map<String, dynamic> srcJson) {
  183. try {
  184. return _$SelectionDataFromJson(srcJson);
  185. } catch (e) {
  186. print('$e');
  187. }
  188. }
  189. Map<String, dynamic> toJson() => _$SelectionDataToJson(this);
  190. }
  191. @JsonSerializable()
  192. class SelectionHeader extends Equatable {
  193. @JsonKey(name: 'id')
  194. final int id;
  195. @JsonKey(name: 'title')
  196. final String title;
  197. @JsonKey(name: 'font')
  198. final String font;
  199. @JsonKey(name: 'subTitle')
  200. final String subTitle;
  201. @JsonKey(name: 'subTitleFont')
  202. final String subTitleFont;
  203. @JsonKey(name: 'textAlign')
  204. final String textAlign;
  205. @JsonKey(name: 'cover')
  206. final String cover;
  207. @JsonKey(name: 'label')
  208. final String label;
  209. @JsonKey(name: 'actionUrl')
  210. final String actionUrl;
  211. @JsonKey(name: 'labelList')
  212. final List<String> labelList;
  213. @JsonKey(name: 'rightText')
  214. final String rightText;
  215. @JsonKey(name: 'icon')
  216. final String icon;
  217. @JsonKey(name: 'iconType')
  218. final String iconType;
  219. @JsonKey(name: 'description')
  220. final String description;
  221. @JsonKey(name: 'time')
  222. final int time;
  223. @JsonKey(name: 'showHateVideo')
  224. final bool showHateVideo;
  225. const SelectionHeader(
  226. this.id,
  227. this.title,
  228. this.font,
  229. this.subTitle,
  230. this.subTitleFont,
  231. this.textAlign,
  232. this.cover,
  233. this.label,
  234. this.actionUrl,
  235. this.labelList,
  236. this.rightText,
  237. this.icon,
  238. this.iconType,
  239. this.description,
  240. this.time,
  241. this.showHateVideo,
  242. );
  243. @override
  244. List<Object> get props => [
  245. this.id,
  246. this.title,
  247. this.font,
  248. this.subTitle,
  249. this.subTitleFont,
  250. this.textAlign,
  251. this.cover,
  252. this.label,
  253. this.actionUrl,
  254. this.labelList,
  255. this.rightText,
  256. this.icon,
  257. this.iconType,
  258. this.description,
  259. this.time,
  260. this.showHateVideo
  261. ];
  262. factory SelectionHeader.fromJson(Map<String, dynamic> srcJson) {
  263. try {
  264. return _$SelectionHeaderFromJson(srcJson);
  265. } catch (e) {
  266. print('$e');
  267. }
  268. }
  269. Map<String, dynamic> toJson() => _$SelectionHeaderToJson(this);
  270. }
  271. @JsonSerializable()
  272. class Tags extends Equatable {
  273. @JsonKey(name: 'id')
  274. final int id;
  275. @JsonKey(name: 'name')
  276. final String name;
  277. @JsonKey(name: 'actionUrl')
  278. final String actionUrl;
  279. @JsonKey(name: 'desc')
  280. final String desc;
  281. @JsonKey(name: 'bgPicture')
  282. final String bgPicture;
  283. @JsonKey(name: 'headerImage')
  284. final String headerImage;
  285. @JsonKey(name: 'tagRecType')
  286. final String tagRecType;
  287. @JsonKey(name: 'haveReward')
  288. final bool haveReward;
  289. @JsonKey(name: 'ifNewest')
  290. final bool ifNewest;
  291. @JsonKey(name: 'communityIndex')
  292. final int communityIndex;
  293. Tags(
  294. this.id,
  295. this.name,
  296. this.actionUrl,
  297. this.desc,
  298. this.bgPicture,
  299. this.headerImage,
  300. this.tagRecType,
  301. this.haveReward,
  302. this.ifNewest,
  303. this.communityIndex,
  304. );
  305. factory Tags.fromJson(Map<String, dynamic> srcJson) {
  306. try {
  307. return _$TagsFromJson(srcJson);
  308. } catch (e) {
  309. print('$e');
  310. }
  311. }
  312. @override
  313. List<Object> get props => [
  314. id,
  315. name,
  316. actionUrl,
  317. desc,
  318. bgPicture,
  319. headerImage,
  320. tagRecType,
  321. haveReward,
  322. ifNewest,
  323. communityIndex,
  324. ];
  325. }
  326. @JsonSerializable()
  327. class Consumption extends Equatable {
  328. @JsonKey(name: 'collectionCount')
  329. final int collectionCount;
  330. @JsonKey(name: 'shareCount')
  331. final int shareCount;
  332. @JsonKey(name: 'replyCount')
  333. final int replyCount;
  334. @JsonKey(name: 'realCollectionCount')
  335. final int realCollectionCount;
  336. Consumption(
  337. this.collectionCount,
  338. this.shareCount,
  339. this.replyCount,
  340. this.realCollectionCount,
  341. );
  342. factory Consumption.fromJson(Map<String, dynamic> srcJson) {
  343. try {
  344. return _$ConsumptionFromJson(srcJson);
  345. } catch (e) {
  346. print('$e');
  347. }
  348. }
  349. @override
  350. List<Object> get props => [
  351. collectionCount,
  352. shareCount,
  353. replyCount,
  354. realCollectionCount,
  355. ];
  356. }
  357. @JsonSerializable()
  358. class Provider extends Equatable {
  359. @JsonKey(name: 'name')
  360. final String name;
  361. @JsonKey(name: 'alias')
  362. final String alias;
  363. @JsonKey(name: 'icon')
  364. final String icon;
  365. Provider(
  366. this.name,
  367. this.alias,
  368. this.icon,
  369. );
  370. factory Provider.fromJson(Map<String, dynamic> srcJson) {
  371. try {
  372. return _$ProviderFromJson(srcJson);
  373. } catch (e) {
  374. print('$e');
  375. }
  376. }
  377. @override
  378. List<Object> get props => [
  379. name,
  380. alias,
  381. icon,
  382. ];
  383. }
  384. @JsonSerializable()
  385. class Author extends Equatable {
  386. @JsonKey(name: 'id')
  387. final int id;
  388. @JsonKey(name: 'icon')
  389. final String icon;
  390. @JsonKey(name: 'name')
  391. final String name;
  392. @JsonKey(name: 'description')
  393. final String description;
  394. @JsonKey(name: 'link')
  395. final String link;
  396. @JsonKey(name: 'latestReleaseTime')
  397. final int latestReleaseTime;
  398. @JsonKey(name: 'videoNum')
  399. final int videoNum;
  400. @JsonKey(name: 'follow')
  401. final Follow follow;
  402. @JsonKey(name: 'shield')
  403. final Shield shield;
  404. @JsonKey(name: 'approvedNotReadyVideoCount')
  405. final int approvedNotReadyVideoCount;
  406. @JsonKey(name: 'ifPgc')
  407. final bool ifPgc;
  408. @JsonKey(name: 'recSort')
  409. final int recSort;
  410. @JsonKey(name: 'expert')
  411. final bool expert;
  412. Author(
  413. this.id,
  414. this.icon,
  415. this.name,
  416. this.description,
  417. this.link,
  418. this.latestReleaseTime,
  419. this.videoNum,
  420. this.follow,
  421. this.shield,
  422. this.approvedNotReadyVideoCount,
  423. this.ifPgc,
  424. this.recSort,
  425. this.expert,
  426. );
  427. factory Author.fromJson(Map<String, dynamic> srcJson) {
  428. try {
  429. return _$AuthorFromJson(srcJson);
  430. } catch (e) {
  431. print('$e');
  432. }
  433. }
  434. @override
  435. List<Object> get props => [
  436. id,
  437. icon,
  438. name,
  439. description,
  440. link,
  441. latestReleaseTime,
  442. videoNum,
  443. follow,
  444. shield,
  445. approvedNotReadyVideoCount,
  446. ifPgc,
  447. recSort,
  448. expert,
  449. ];
  450. }
  451. @JsonSerializable()
  452. class Follow extends Equatable {
  453. @JsonKey(name: 'itemType')
  454. final String itemType;
  455. @JsonKey(name: 'itemId')
  456. final int itemId;
  457. @JsonKey(name: 'followed')
  458. final bool followed;
  459. Follow(
  460. this.itemType,
  461. this.itemId,
  462. this.followed,
  463. );
  464. factory Follow.fromJson(Map<String, dynamic> srcJson) {
  465. try {
  466. return _$FollowFromJson(srcJson);
  467. } catch (e) {
  468. print('$e');
  469. }
  470. }
  471. @override
  472. List<Object> get props => [
  473. itemType,
  474. itemId,
  475. followed,
  476. ];
  477. }
  478. @JsonSerializable()
  479. class Shield extends Equatable {
  480. @JsonKey(name: 'itemType')
  481. final String itemType;
  482. @JsonKey(name: 'itemId')
  483. final int itemId;
  484. @JsonKey(name: 'shielded')
  485. final bool shielded;
  486. Shield(
  487. this.itemType,
  488. this.itemId,
  489. this.shielded,
  490. );
  491. factory Shield.fromJson(Map<String, dynamic> srcJson) {
  492. try {
  493. return _$ShieldFromJson(srcJson);
  494. } catch (e) {
  495. print('$e');
  496. }
  497. }
  498. @override
  499. List<Object> get props => [itemType, itemId, shielded];
  500. }
  501. @JsonSerializable()
  502. class Cover extends Equatable {
  503. @JsonKey(name: 'feed')
  504. final String feed;
  505. @JsonKey(name: 'detail')
  506. final String detail;
  507. @JsonKey(name: 'blurred')
  508. final String blurred;
  509. @JsonKey(name: 'homepage')
  510. final String homepage;
  511. Cover(
  512. this.feed,
  513. this.detail,
  514. this.blurred,
  515. this.homepage,
  516. );
  517. factory Cover.fromJson(Map<String, dynamic> srcJson) {
  518. try {
  519. return _$CoverFromJson(srcJson);
  520. } catch (e) {
  521. print('$e');
  522. }
  523. }
  524. @override
  525. List<Object> get props => [
  526. feed,
  527. detail,
  528. blurred,
  529. homepage,
  530. ];
  531. }
  532. @JsonSerializable()
  533. class WebUrl extends Equatable {
  534. @JsonKey(name: 'raw')
  535. final String raw;
  536. @JsonKey(name: 'forWeibo')
  537. final String forWeibo;
  538. WebUrl(
  539. this.raw,
  540. this.forWeibo,
  541. );
  542. factory WebUrl.fromJson(Map<String, dynamic> srcJson) {
  543. try {
  544. return _$WebUrlFromJson(srcJson);
  545. } catch (e) {
  546. print('$e');
  547. }
  548. }
  549. @override
  550. List<Object> get props => [raw, forWeibo];
  551. }
  552. @JsonSerializable()
  553. class PlayInfo extends Equatable {
  554. @JsonKey(name: 'height')
  555. final int height;
  556. @JsonKey(name: 'width')
  557. final int width;
  558. @JsonKey(name: 'urlList')
  559. final List<UrlList> urlList;
  560. @JsonKey(name: 'name')
  561. final String name;
  562. @JsonKey(name: 'type')
  563. final String type;
  564. @JsonKey(name: 'url')
  565. final String url;
  566. PlayInfo(
  567. this.height,
  568. this.width,
  569. this.urlList,
  570. this.name,
  571. this.type,
  572. this.url,
  573. );
  574. factory PlayInfo.fromJson(Map<String, dynamic> srcJson) {
  575. try {
  576. return _$PlayInfoFromJson(srcJson);
  577. } catch (e) {
  578. print('$e');
  579. }
  580. }
  581. @override
  582. List<Object> get props => [
  583. height,
  584. width,
  585. urlList,
  586. name,
  587. type,
  588. url,
  589. ];
  590. }
  591. @JsonSerializable()
  592. class UrlList extends Equatable {
  593. @JsonKey(name: 'name')
  594. final String name;
  595. @JsonKey(name: 'url')
  596. final String url;
  597. @JsonKey(name: 'size')
  598. final int size;
  599. UrlList(
  600. this.name,
  601. this.url,
  602. this.size,
  603. );
  604. factory UrlList.fromJson(Map<String, dynamic> srcJson) {
  605. try {
  606. return _$UrlListFromJson(srcJson);
  607. } catch (e) {
  608. print('$e');
  609. }
  610. }
  611. @override
  612. List<Object> get props => [
  613. name,
  614. url,
  615. size,
  616. ];
  617. }