import 'dart:convert'; import 'package:PiliPlus/common/widgets/pendant_avatar.dart'; import 'package:PiliPlus/models/dynamics/article_content_model.dart'; import 'package:PiliPlus/models/model_avatar.dart'; class DynamicsDataModel { bool? hasMore; List? items; String? offset; int? total; DynamicsDataModel.fromJson(Map json) { hasMore = json['has_more']; items = (json['items'] as List?) ?.map((e) => DynamicItemModel.fromJson(e)) .toList(); offset = json['offset']; total = json['total']; } } // 单个动态 class DynamicItemModel { Basic? basic; dynamic idStr; late ItemModulesModel modules; DynamicItemModel? orig; String? type; bool? visible; // opus Fallback? fallback; DynamicItemModel.fromJson(Map json) { if (json['basic'] != null) basic = Basic.fromJson(json['basic']); idStr = json['id_str']; modules = json['modules'] == null ? ItemModulesModel() : ItemModulesModel.fromJson(json['modules']); if (json['orig'] != null) { orig = DynamicItemModel.fromJson(json['orig']); } type = json['type']; visible = json['visible']; } DynamicItemModel.fromOpusJson(Map json) { if (json['item']?['basic'] != null) { basic = Basic.fromJson(json['item']['basic']); } idStr = json['item']?['id_str']; // type = json['type']; // int modules = json['item']?['modules'] == null ? ItemModulesModel() : ItemModulesModel.fromOpusJson( (json['item']?['modules'] as List).cast()); if (json['fallback'] != null) { fallback = Fallback.fromJson(json['fallback']); } } } class Fallback { String? id; int? type; Fallback({ this.id, this.type, }); factory Fallback.fromJson(Map json) => Fallback( id: json['id'], type: json['type'], ); } // 单个动态详情 class ItemModulesModel { ItemModulesModel(); ModuleAuthorModel? moduleAuthor; ModuleStatModel? moduleStat; ModuleTag? moduleTag; // 也做opus的title用 // 动态 ModuleDynamicModel? moduleDynamic; // ModuleInterModel? moduleInter; // 专栏 ModuleTop? moduleTop; ModuleCollection? moduleCollection; List? moduleExtend; // opus的tag List? moduleContent; ModuleBlocked? moduleBlocked; // moduleBottom ItemModulesModel.fromJson(Map json) { moduleAuthor = json['module_author'] != null ? ModuleAuthorModel.fromJson(json['module_author']) : null; moduleDynamic = json['module_dynamic'] != null ? ModuleDynamicModel.fromJson(json['module_dynamic']) : null; // moduleInter = ModuleInterModel.fromJson(json['module_interaction']); moduleStat = json['module_stat'] != null ? ModuleStatModel.fromJson(json['module_stat']) : null; moduleTag = json['module_tag'] != null ? ModuleTag.fromJson(json['module_tag']) : null; } ItemModulesModel.fromOpusJson(List> json) { for (var i in json) { switch (i['module_type']) { case 'MODULE_TYPE_TOP': moduleTop = i['module_top'] == null ? null : ModuleTop.fromJson(i['module_top']); break; case 'MODULE_TYPE_TITLE': moduleTag = i['module_title'] == null ? null : ModuleTag.fromJson(i['module_title']); break; case 'MODULE_TYPE_COLLECTION': moduleCollection = i['module_collection'] == null ? null : ModuleCollection.fromJson(i['module_collection']); break; case 'MODULE_TYPE_AUTHOR': moduleAuthor = i['module_author'] == null ? null : ModuleAuthorModel.fromJson(i['module_author']); break; case 'MODULE_TYPE_CONTENT': moduleContent = (i['module_content']?['paragraphs'] as List?) ?.map((i) => ArticleContentModel.fromJson(i)) .toList(); break; case 'MODULE_TYPE_BLOCKED': moduleBlocked = i['module_blocked'] == null ? null : ModuleBlocked.fromJson(i['module_blocked']); break; case 'MODULE_TYPE_EXTEND': moduleExtend = (i['module_extend']['items'] as List?) ?.map((i) => ModuleTag.fromJson(i)) .toList(); break; case 'MODULE_TYPE_STAT': moduleStat = i['module_stat'] == null ? null : ModuleStatModel.fromJson(i['module_stat']); break; // case 'MODULE_TYPE_BOTTOM': // break; // default: // debugPrint('unknown type: ${i}'); } } } } class ModuleCollection { String? count; int? id; String? name; String? title; ModuleCollection.fromJson(Map json) { count = json['count']; id = json['id']; name = json['name']; title = json['title']; } } class ModuleTop { ModuleTopDisplay? display; ModuleTop.fromJson(Map json) { display = json['display'] == null ? null : ModuleTopDisplay.fromJson(json['display']); } } class ModuleTopDisplay { ModuleTopAlbum? album; int? type; ModuleTopDisplay.fromJson(Map json) { album = json['album'] == null ? null : ModuleTopAlbum.fromJson(json['album']); type = json['type']; } } class ModuleTopAlbum { List? pics; int? type; ModuleTopAlbum.fromJson(Map json) { pics = (json['pics'] as List?)?.map((e) => Pic.fromJson(e)).toList(); type = json['type']; } } class ModuleBlocked { BgImg? bgImg; int? blockedType; Button? button; String? title; String? hintMessage; BgImg? icon; ModuleBlocked.fromJson(Map json) { bgImg = json['bg_img'] == null ? null : BgImg.fromJson(json['bg_img']); blockedType = json['blocked_type']; button = json['button'] == null ? null : Button.fromJson(json['button']); title = json['title']; hintMessage = json['hint_message']; icon = json['icon'] == null ? null : BgImg.fromJson(json['icon']); } } class Button { int? handleType; String? icon; String? jumpUrl; String? text; JumpStyle? jumpStyle; int? status; int? type; Check? check; Button.fromJson(Map json) { handleType = json['handle_type']; icon = json['icon']; jumpUrl = json['jump_url']; text = json['text']; jumpStyle = json['jump_style'] == null ? null : JumpStyle.fromJson(json['jump_style']); status = json['status']; type = json['type']; check = json['check'] == null ? null : Check.fromJson(json['check']); } } class Check { int? disable; String? text; Check.fromJson(Map json) { disable = json['disable']; text = json['text']; } } class BgImg { String? imgDark; String? imgDay; BgImg.fromJson(Map json) { imgDark = json['img_dark']; imgDay = json['img_day']; } } class Basic { String? commentIdStr; int? commentType; Map? likeIcon; String? ridStr; Basic.fromJson(Map json) { commentIdStr = json['comment_id_str']; commentType = json['comment_type']; likeIcon = json['like_icon']; ridStr = json['rid_str']; } } // 单个动态详情 - 作者信息 class ModuleAuthorModel extends Avatar { bool? following; String? jumpUrl; String? label; String? pubAction; String? pubTime; int? pubTs; String? type; Decorate? decorate; ModuleAuthorModel.fromJson(Map json) : super.fromJson(json) { if (json['official'] != null) { officialVerify ??= BaseOfficialVerify.fromJson(json['official']); // opus } following = json['following']; jumpUrl = json['jump_url']; label = json['label']; pubAction = json['pub_action']; pubTime = json['pub_time']; pubTs = json['pub_ts'] == 0 ? null : json['pub_ts']; type = json['type']; if (PendantAvatar.showDynDecorate) { decorate = json['decorate'] == null ? null : Decorate.fromJson(json['decorate']); } else { pendant = null; } } } class Decorate { String? cardUrl; Fan? fan; int? id; String? jumpUrl; String? name; int? type; Decorate({ this.cardUrl, this.fan, this.id, this.jumpUrl, this.name, this.type, }); factory Decorate.fromJson(Map json) => Decorate( cardUrl: json["card_url"], fan: json["fan"] == null ? null : Fan.fromJson(json["fan"]), id: json["id"], jumpUrl: json["jump_url"], name: json["name"], type: json["type"], ); } class Fan { String? color; bool? isFan; String? numPrefix; String? numStr; int? number; Fan({ this.color, this.isFan, this.numPrefix, this.numStr, this.number, }); factory Fan.fromJson(Map json) => Fan( color: json["color"], isFan: json["is_fan"], numPrefix: json["num_prefix"], numStr: json["num_str"], number: json["number"], ); } // 单个动态详情 - 动态信息 class ModuleDynamicModel { ModuleDynamicModel({ this.additional, this.desc, this.major, this.topic, }); DynamicAddModel? additional; DynamicDescModel? desc; DynamicMajorModel? major; DynamicTopicModel? topic; ModuleDynamicModel.fromJson(Map json) { additional = json['additional'] != null ? DynamicAddModel.fromJson(json['additional']) : null; desc = json['desc'] != null ? DynamicDescModel.fromJson(json['desc']) : null; if (json['major'] != null) { major = DynamicMajorModel.fromJson(json['major']); } topic = json['topic'] != null ? DynamicTopicModel.fromJson(json['topic']) : null; } } // 单个动态详情 - 评论?信息 // class ModuleInterModel { // ModuleInterModel({ // }); // ModuleInterModel.fromJson(Map json) { // } // } class DynamicAddModel { DynamicAddModel({ this.type, this.vote, this.ugc, this.reserve, this.goods, }); String? type; Vote? vote; Ugc? ugc; Reserve? reserve; Good? goods; UpowerLottery? upowerLottery; AddCommon? common; AddMatch? match; DynamicAddModel.fromJson(Map json) { type = json['type']; vote = json['vote'] != null ? Vote.fromJson(json['vote']) : null; ugc = json['ugc'] != null ? Ugc.fromJson(json['ugc']) : null; reserve = json['reserve'] != null ? Reserve.fromJson(json['reserve']) : null; goods = json['goods'] != null ? Good.fromJson(json['goods']) : null; upowerLottery = json['upower_lottery'] != null ? UpowerLottery.fromJson(json['upower_lottery']) : null; common = json['common'] != null ? AddCommon.fromJson(json['common']) : null; match = json['match'] != null ? AddMatch.fromJson(json['match']) : null; } } class AddMatch { Button? button; String? headText; String? idStr; String? jumpUrl; MatchInfo? matchInfo; AddMatch({ this.button, this.headText, this.idStr, this.jumpUrl, this.matchInfo, }); factory AddMatch.fromJson(Map json) => AddMatch( button: json["button"] == null ? null : Button.fromJson(json["button"]), headText: json["head_text"], idStr: json["id_str"], jumpUrl: json["jump_url"], matchInfo: json["match_info"] == null ? null : MatchInfo.fromJson(json["match_info"]), ); } class MatchInfo { String? centerBottom; List? centerTop; TTeam? leftTeam; TTeam? rightTeam; int? status; dynamic subTitle; String? title; MatchInfo({ this.centerBottom, this.centerTop, this.leftTeam, this.rightTeam, this.status, this.subTitle, this.title, }); factory MatchInfo.fromJson(Map json) => MatchInfo( centerBottom: json["center_bottom"], centerTop: json["center_top"], leftTeam: json["left_team"] == null ? null : TTeam.fromJson(json["left_team"]), rightTeam: json["right_team"] == null ? null : TTeam.fromJson(json["right_team"]), status: json["status"], subTitle: json["sub_title"], title: json["title"], ); } class TTeam { int? id; String? name; String? pic; TTeam({ this.id, this.name, this.pic, }); factory TTeam.fromJson(Map json) => TTeam( id: json["id"], name: json["name"], pic: json["pic"], ); } class AddCommon { Button? button; String? cover; String? desc1; String? desc2; String? headText; String? idStr; String? jumpUrl; int? style; String? subType; String? title; AddCommon({ this.button, this.cover, this.desc1, this.desc2, this.headText, this.idStr, this.jumpUrl, this.style, this.subType, this.title, }); factory AddCommon.fromJson(Map json) => AddCommon( button: json["button"] == null ? null : Button.fromJson(json["button"]), cover: json["cover"], desc1: json["desc1"], desc2: json["desc2"], headText: json["head_text"], idStr: json["id_str"], jumpUrl: json["jump_url"], style: json["style"], subType: json["sub_type"], title: json["title"], ); } class UpowerLottery { Button? button; Desc? desc; Hint? hint; String? jumpUrl; int? rid; int? state; String? title; int? upMid; int? upowerActionState; int? upowerLevel; UpowerLottery({ this.button, this.desc, this.hint, this.jumpUrl, this.rid, this.state, this.title, this.upMid, this.upowerActionState, this.upowerLevel, }); factory UpowerLottery.fromJson(Map json) => UpowerLottery( button: json["button"] == null ? null : Button.fromJson(json["button"]), desc: json["desc"] == null ? null : Desc.fromJson(json["desc"]), hint: json["hint"] == null ? null : Hint.fromJson(json["hint"]), jumpUrl: json["jump_url"], rid: json["rid"], state: json["state"], title: json["title"], upMid: json["up_mid"], upowerActionState: json["upower_action_state"], upowerLevel: json["upower_level"], ); } class Hint { int? style; String? text; Hint({ this.style, this.text, }); factory Hint.fromJson(Map json) => Hint( style: json["style"], text: json["text"], ); } class JumpStyle { String? iconUrl; String? text; JumpStyle({ this.iconUrl, this.text, }); factory JumpStyle.fromJson(Map json) => JumpStyle( iconUrl: json["icon_url"], text: json["text"], ); } class Vote { Vote({ this.choiceCnt, this.defaultShare, this.share, this.endTime, this.joinNum, this.status, this.type, this.uid, this.voteId, }); int? choiceCnt; String? share; int? defaultShare; int? endTime; int? joinNum; int? status; int? type; int? uid; int? voteId; String? desc; Vote.fromJson(Map json) { desc = json['desc']; choiceCnt = json['choice_cnt']; share = json['share']; defaultShare = json['default_share']; endTime = json['end_time'] is int ? json['end_time'] : int.parse(json['end_time']); joinNum = json['join_num']; status = json['status']; type = json['type']; uid = json['uid']; voteId = json['vote_id']; } } class Ugc { Ugc({ this.cover, this.descSecond, this.duration, this.headText, this.idStr, this.jumpUrl, this.multiLine, this.title, }); String? cover; String? descSecond; String? duration; String? headText; String? idStr; String? jumpUrl; bool? multiLine; String? title; Ugc.fromJson(Map json) { cover = json['cover']; descSecond = json['desc_second']; duration = json['duration']; headText = json['head_text']; idStr = json['id_str']; jumpUrl = json['jump_url']; multiLine = json['multi_line']; title = json['title']; } } class Reserve { Reserve({ this.button, this.desc1, this.desc2, this.desc3, this.jumpUrl, this.reserveTotal, this.rid, this.state, this.stype, this.title, this.upMid, }); ReserveBtn? button; Desc? desc1; Desc? desc2; Desc? desc3; String? jumpUrl; int? reserveTotal; int? rid; int? state; int? stype; String? title; int? upMid; Reserve.fromJson(Map json) { button = json['button'] == null ? null : ReserveBtn.fromJson(json['button']); desc1 = json['desc1'] == null ? null : Desc.fromJson(json['desc1']); desc2 = json['desc2'] == null ? null : Desc.fromJson(json['desc2']); desc3 = json['desc3'] == null ? null : Desc.fromJson(json['desc3']); jumpUrl = json['jump_url']; reserveTotal = json['reserve_total']; rid = json['rid']; state = json['state']; state = json['state']; stype = json['stype']; title = json['title']; upMid = json['up_mid']; } } class ReserveBtn { ReserveBtn({ this.status, this.type, this.checkText, this.uncheckText, }); int? status; int? type; String? checkText; String? uncheckText; int? disable; String? jumpText; String? jumpUrl; ReserveBtn.fromJson(Map json) { status = json['status']; type = json['type']; checkText = json['check']?['text'] ?? '已预约'; uncheckText = json['uncheck']?['text'] ?? '预约'; disable = json['uncheck']?['disable']; jumpText = json['jump_style']?['text']; jumpUrl = json['jump_url']; } } class Desc { Desc({ this.style, this.text, this.visible, this.jumpUrl, }); int? style; String? text; bool? visible; String? jumpUrl; Desc.fromJson(Map json) { style = json['style']; text = json['text']; visible = json['visible']; jumpUrl = json["jump_url"]; } } class Good { Good({ this.headIcon, this.headText, this.items, this.jumpUrl, }); String? headIcon; String? headText; List? items; String? jumpUrl; Good.fromJson(Map json) { headIcon = json['head_icon']; headText = json['head_text']; items = (json['items'] as List?) ?.map((e) => GoodItem.fromJson(e)) .toList(); jumpUrl = json['jump_url']; } } class GoodItem { GoodItem({ this.brief, this.cover, this.id, this.jumpDesc, this.jumpUrl, this.name, this.price, }); String? brief; String? cover; dynamic id; String? jumpDesc; String? jumpUrl; String? name; String? price; GoodItem.fromJson(Map json) { brief = json['brief']; cover = json['cover']; id = json['id']; jumpDesc = json['jump_desc']; jumpUrl = json['jump_url']; name = json['name']; price = json['price']; } } class DynamicDescModel { DynamicDescModel({ this.richTextNodes, this.text, }); List? richTextNodes; String? text; DynamicDescModel.fromJson(Map json) { richTextNodes = (json['rich_text_nodes'] as List?) ?.map((e) => RichTextNodeItem.fromJson(e)) .toList(); text = json['text']; } } // class DynamicMajorModel { DynamicMajorModel({ this.archive, this.draw, this.ugcSeason, this.opus, this.pgc, this.liveRcmd, this.live, this.none, this.type, this.courses, this.common, this.music, this.blocked, this.medialist, }); DynamicArchiveModel? archive; DynamicDrawModel? draw; DynamicArchiveModel? ugcSeason; DynamicOpusModel? opus; DynamicArchiveModel? pgc; DynamicLiveModel? liveRcmd; DynamicLive2Model? live; DynamicNoneModel? none; // MAJOR_TYPE_DRAW 图片 // MAJOR_TYPE_ARCHIVE 视频 // MAJOR_TYPE_OPUS 图文/文章 String? type; Map? courses; Common? common; Map? music; ModuleBlocked? blocked; Medialist? medialist; SubscriptionNew? subscriptionNew; DynamicMajorModel.fromJson(Map json) { archive = json['archive'] != null ? DynamicArchiveModel.fromJson(json['archive']) : null; draw = json['draw'] != null ? DynamicDrawModel.fromJson(json['draw']) : null; ugcSeason = json['ugc_season'] != null ? DynamicArchiveModel.fromJson(json['ugc_season']) : null; opus = json['opus'] != null ? DynamicOpusModel.fromJson(json['opus']) : null; pgc = json['pgc'] != null ? DynamicArchiveModel.fromJson(json['pgc']) : null; liveRcmd = json['live_rcmd'] != null ? DynamicLiveModel.fromJson(json['live_rcmd']) : null; live = json['live'] != null ? DynamicLive2Model.fromJson(json['live']) : null; none = json['none'] != null ? DynamicNoneModel.fromJson(json['none']) : null; type = json['type']; courses = json['courses']; common = json['common'] == null ? null : Common.fromJson(json['common']); music = json['music']; blocked = json['blocked'] == null ? null : ModuleBlocked.fromJson(json['blocked']); medialist = json['medialist'] == null ? null : Medialist.fromJson(json['medialist']); subscriptionNew = json['subscription_new'] == null ? null : SubscriptionNew.fromJson(json['subscription_new']); } } class Medialist { dynamic id; String? cover; String? title; String? subTitle; String? jumpUrl; Badge? badge; Medialist.fromJson(Map json) { id = json['id']; cover = json['cover']; title = json['title']; subTitle = json['sub_title']; jumpUrl = json['jump_url']; badge = json['badge'] == null ? null : Badge.fromJson(json['badge']); } } class SubscriptionNew { LiveRcmd? liveRcmd; String? style; SubscriptionNew({ this.liveRcmd, this.style, }); factory SubscriptionNew.fromJson(Map json) => SubscriptionNew( liveRcmd: json["live_rcmd"] == null ? null : LiveRcmd.fromJson(json["live_rcmd"]), style: json["style"], ); } class LiveRcmd { LiveRcmdContent? content; int? reserveType; LiveRcmd({ this.content, this.reserveType, }); factory LiveRcmd.fromJson(Map json) => LiveRcmd( content: json["content"] == null ? null : LiveRcmdContent.fromJson(jsonDecode(json["content"])), reserveType: json["reserve_type"], ); } class LiveRcmdContent { int? type; LivePlayInfo? livePlayInfo; LiveRcmdContent({ this.type, this.livePlayInfo, }); factory LiveRcmdContent.fromJson(Map json) => LiveRcmdContent( type: json["type"], livePlayInfo: json["live_play_info"] == null ? null : LivePlayInfo.fromJson(json["live_play_info"]), ); } class LivePlayInfo { int? roomId; int? uid; int? liveStatus; int? roomType; int? playType; String? title; String? cover; int? online; int? areaId; String? areaName; int? parentAreaId; String? parentAreaName; int? liveScreenType; int? liveStartTime; String? link; WatchedShow? watchedShow; int? roomPaidType; LivePlayInfo({ this.roomId, this.uid, this.liveStatus, this.roomType, this.playType, this.title, this.cover, this.online, this.areaId, this.areaName, this.parentAreaId, this.parentAreaName, this.liveScreenType, this.liveStartTime, this.link, this.watchedShow, this.roomPaidType, }); factory LivePlayInfo.fromJson(Map json) => LivePlayInfo( roomId: json["room_id"], uid: json["uid"], liveStatus: json["live_status"], roomType: json["room_type"], playType: json["play_type"], title: json["title"], cover: json["cover"], online: json["online"], areaId: json["area_id"], areaName: json["area_name"], parentAreaId: json["parent_area_id"], parentAreaName: json["parent_area_name"], liveScreenType: json["live_screen_type"], liveStartTime: json["live_start_time"], link: json["link"], watchedShow: json["watched_show"] == null ? null : WatchedShow.fromJson(json["watched_show"]), roomPaidType: json["room_paid_type"], ); } class WatchedShow { bool? watchedShowSwitch; int? num; String? textSmall; String? textLarge; WatchedShow({ this.watchedShowSwitch, this.num, this.textSmall, this.textLarge, }); factory WatchedShow.fromJson(Map json) => WatchedShow( watchedShowSwitch: json["switch"], num: json["num"], textSmall: json["text_small"], textLarge: json["text_large"], ); } class DynamicTopicModel { DynamicTopicModel({ this.id, this.jumpUrl, this.name, }); int? id; String? jumpUrl; String? name; DynamicTopicModel.fromJson(Map json) { id = json['id']; jumpUrl = json['jump_url']; name = json['name']; } } class DynamicArchiveModel { DynamicArchiveModel({ this.aid, this.badge, this.bvid, this.cover, this.desc, this.disablePreview, this.durationText, this.jumpUrl, this.stat, this.title, this.type, this.epid, this.seasonId, }); int? aid; Badge? badge; String? bvid; String? cover; String? desc; int? disablePreview; String? durationText; String? jumpUrl; Stat? stat; String? title; int? type; int? epid; int? seasonId; DynamicArchiveModel.fromJson(Map json) { aid = json['aid'] is String ? int.parse(json['aid']) : json['aid']; badge = json['badge'] == null ? null : Badge.fromJson(json['badge']); bvid = json['bvid'] ?? json['epid'].toString() ?? ' '; cover = json['cover']; disablePreview = json['disable_preview']; durationText = json['duration_text']; jumpUrl = json['jump_url']; stat = json['stat'] != null ? Stat.fromJson(json['stat']) : null; title = json['title']; type = json['type']; epid = json['epid']; seasonId = json['season_id']; } } class Badge { Badge({ this.text, }); String? text; Badge.fromJson(Map json) { text = json['text'] == '投稿视频' ? null : json['text']; } } class DynamicDrawModel { DynamicDrawModel({ this.id, this.items, }); int? id; List? items; DynamicDrawModel.fromJson(Map json) { id = json['id']; items = (json['items'] as List?) ?.map((e) => DynamicDrawItemModel.fromJson(e)) .toList(); } } class DynamicOpusModel { DynamicOpusModel({ this.jumpUrl, this.pics, this.summary, this.title, }); String? jumpUrl; List? pics; SummaryModel? summary; String? title; DynamicOpusModel.fromJson(Map json) { jumpUrl = json['jump_url']; pics = (json['pics'] as List?) ?.map((e) => OpusPicsModel.fromJson(e)) .toList(); summary = json['summary'] != null ? SummaryModel.fromJson(json['summary']) : null; title = json['title']; } } class SummaryModel { SummaryModel({ this.richTextNodes, this.text, }); List? richTextNodes; String? text; SummaryModel.fromJson(Map json) { richTextNodes = (json['rich_text_nodes'] as List?) ?.map((e) => RichTextNodeItem.fromJson(e)) .toList(); text = json['text']; } } class RichTextNodeItem { RichTextNodeItem({ this.emoji, this.origText, this.text, this.type, this.rid, }); Emoji? emoji; String? origText; String? text; String? type; String? rid; List? pics; String? jumpUrl; RichTextNodeItem.fromJson(Map json) { emoji = json['emoji'] != null ? Emoji.fromJson(json['emoji']) : null; origText = json['orig_text']; text = json['text']; type = json['type']; rid = json['rid']; pics = json['pics'] == null ? null : (json['pics'] as List?) ?.map((e) => OpusPicsModel.fromJson(e)) .toList(); jumpUrl = json['jump_url']; } } class Emoji { // String? iconUrl; // String? webpUrl; // String? gifUrl; String? url; late num size; String? text; num? type; Emoji.fromJson(Map json) { // iconUrl = json['icon_url']; // webpUrl = json['webp_url']; // gifUrl = json['gif_url']; url = json['webp_url'] ?? json['gif_url'] ?? json['icon_url']; size = json['size'] ?? 1; text = json['text']; type = json['type']; } } class DynamicNoneModel { DynamicNoneModel({ this.tips, }); String? tips; DynamicNoneModel.fromJson(Map json) { tips = json['tips']; } } class OpusPicsModel { OpusPicsModel({ this.width, this.height, this.size, this.src, this.url, }); int? width; int? height; int? size; String? src; String? url; String? liveUrl; OpusPicsModel.fromJson(Map json) { width = json['width']; height = json['height']; size = json['size'] != null ? json['size'].toInt() : 0; src = json['src']; url = json['url']; liveUrl = json['live_url']; } } class DynamicDrawItemModel { DynamicDrawItemModel({ this.height, this.size, this.src, this.tags, this.width, }); int? height; int? size; String? src; List? tags; int? width; DynamicDrawItemModel.fromJson(Map json) { height = json['height']; size = json['size'].toInt(); src = json['src']; tags = json['tags']; width = json['width']; } } class DynamicLiveModel { DynamicLiveModel({ this.content, }); String? content; int? type; Map? livePlayInfo; int? uid; String? parentAreaName; int? roomId; String? liveId; int? liveStatus; String? cover; int? online; String? areaName; String? title; int? liveStartTime; WatchedShow? watchedShow; DynamicLiveModel.fromJson(Map json) { content = json['content']; if (json['content'] != null) { Map data = jsonDecode(json['content']); type = data['type']; Map livePlayInfo = data['live_play_info']; uid = livePlayInfo['uid']; parentAreaName = livePlayInfo['parent_area_name']; roomId = livePlayInfo['room_id']; liveId = livePlayInfo['live_id']; liveStatus = livePlayInfo['live_status']; cover = livePlayInfo['cover']; online = livePlayInfo['online']; areaName = livePlayInfo['area_name']; title = livePlayInfo['title']; liveStartTime = livePlayInfo['live_start_time']; watchedShow = livePlayInfo['watched_show'] == null ? null : WatchedShow.fromJson(livePlayInfo['watched_show']); } } } class DynamicLive2Model { DynamicLive2Model({ this.badge, this.cover, this.descFirst, this.descSecond, this.id, this.jumpUrl, this.liveState, this.reserveType, this.title, }); Badge? badge; String? cover; String? descFirst; String? descSecond; int? id; String? jumpUrl; int? liveState; int? reserveType; String? title; DynamicLive2Model.fromJson(Map json) { badge = json['badge'] == null ? null : Badge.fromJson(json['badge']); cover = json['cover']; descFirst = json['desc_first']; descSecond = json['desc_second']; id = json['id']; jumpUrl = json['jump_url']; liveState = json['liv_state']; reserveType = json['reserve_type']; title = json['title']; } } class ModuleTag { ModuleTag({ this.text, }); String? text; ModuleTag.fromJson(Map json) { text = json['text']; } } // 动态状态 转发、评论、点赞 class ModuleStatModel { ModuleStatModel({ this.comment, this.forward, this.like, this.favorite, }); DynamicStat? comment; DynamicStat? forward; DynamicStat? like; DynamicStat? favorite; // DynamicStat? coin; ModuleStatModel.fromJson(Map json) { comment = DynamicStat.fromJson(json['comment']); forward = DynamicStat.fromJson(json['forward']); like = DynamicStat.fromJson(json['like']); if (json['favorite'] != null) { favorite = DynamicStat.fromJson(json['favorite']); } } } // 动态状态 class DynamicStat { DynamicStat({ this.count, this.forbidden, this.status, }); int? count; bool? forbidden; bool? status; DynamicStat.fromJson(Map json) { count = json['count'] == 0 ? null : _parseInt(json['count']); forbidden = json['forbidden']; status = json['status']; } static int? _parseInt(dynamic x) => switch (x) { int() => x, String() => int.tryParse(x), double() => x.toInt(), _ => null }; } class Stat { Stat({ this.danmu, this.play, }); String? danmu; String? play; Stat.fromJson(Map json) { danmu = json['danmaku']; play = json['play']; } }