diff --git a/lib/models_new/pgc/pgc_info_model/episode.dart b/lib/models_new/pgc/pgc_info_model/episode.dart index 06596ec80..58c390468 100644 --- a/lib/models_new/pgc/pgc_info_model/episode.dart +++ b/lib/models_new/pgc/pgc_info_model/episode.dart @@ -2,21 +2,18 @@ import 'package:PiliPlus/models_new/pgc/pgc_info_model/badge_info.dart'; import 'package:PiliPlus/models_new/pgc/pgc_info_model/dimension.dart'; import 'package:PiliPlus/models_new/pgc/pgc_info_model/rights.dart'; import 'package:PiliPlus/models_new/pgc/pgc_info_model/skip.dart'; +import 'package:PiliPlus/models_new/video/video_detail/episode.dart' + show BaseEpisodeItem; -class EpisodeItem { - int? aid; - String? badge; +class EpisodeItem extends BaseEpisodeItem { BadgeInfo? badgeInfo; int? badgeType; - String? bvid; - int? cid; String? cover; Dimension? dimension; int? duration; bool? enableVt; int? epId; String? from; - int? id; bool? isViewHide; String? link; String? longTitle; @@ -33,23 +30,22 @@ class EpisodeItem { Skip? skip; int? status; String? subtitle; - String? title; String? vid; EpisodeItem({ - this.aid, - this.badge, + super.aid, + super.badge, this.badgeInfo, this.badgeType, - this.bvid, - this.cid, + super.bvid, + super.cid, this.cover, this.dimension, this.duration, this.enableVt, this.epId, this.from, - this.id, + super.id, this.isViewHide, this.link, this.longTitle, @@ -66,7 +62,7 @@ class EpisodeItem { this.skip, this.status, this.subtitle, - this.title, + super.title, this.vid, }); diff --git a/lib/models_new/video/video_detail/episode.dart b/lib/models_new/video/video_detail/episode.dart index 39efe79fc..15c26bc14 100644 --- a/lib/models_new/video/video_detail/episode.dart +++ b/lib/models_new/video/video_detail/episode.dart @@ -1,33 +1,45 @@ import 'package:PiliPlus/models_new/video/video_detail/arc.dart'; import 'package:PiliPlus/models_new/video/video_detail/page.dart'; -class EpisodeItem { - int? seasonId; - int? sectionId; +abstract class BaseEpisodeItem { int? id; int? aid; int? cid; + String? bvid; + String? badge; String? title; + + BaseEpisodeItem({ + this.id, + this.aid, + this.cid, + this.bvid, + this.badge, + this.title, + }); +} + +class EpisodeItem extends BaseEpisodeItem { + int? seasonId; + int? sectionId; int? attribute; Arc? arc; Part? page; - String? bvid; List? pages; - String? badge; EpisodeItem({ this.seasonId, this.sectionId, - this.id, - this.aid, - this.cid, - this.title, + super.id, + super.aid, + super.cid, + super.title, this.attribute, this.arc, this.page, - this.bvid, + super.bvid, this.pages, - this.badge, + super.badge, }); factory EpisodeItem.fromJson(Map json) => EpisodeItem( diff --git a/lib/pages/episode_panel/view.dart b/lib/pages/episode_panel/view.dart index db7833042..5da1358f2 100644 --- a/lib/pages/episode_panel/view.dart +++ b/lib/pages/episode_panel/view.dart @@ -402,15 +402,12 @@ class _EpisodePanelState extends CommonSlidePageState { if (!widget.showTitle) { _currentItemIndex = index; } + final isEpisode = episode is ugc.BaseEpisodeItem; widget.changeFucCall( episode is pgc.EpisodeItem ? episode.epId : null, - episode.runtimeType.toString() == "EpisodeItem" - ? episode.bvid - : widget.bvid, + isEpisode ? episode.bvid : widget.bvid, episode.cid, - episode.runtimeType.toString() == "EpisodeItem" - ? episode.aid - : widget.aid, + isEpisode ? episode.aid : widget.aid, cover, ); if (widget.type == EpisodeType.season) { diff --git a/lib/pages/video/view.dart b/lib/pages/video/view.dart index 3ce4fa2e8..25e5e1ca3 100644 --- a/lib/pages/video/view.dart +++ b/lib/pages/video/view.dart @@ -2148,14 +2148,16 @@ class _VideoDetailPageVState extends State } void changeEpisode(episode) { + final isEpisode = episode is BaseEpisodeItem; + final isPgc = episode is pgc.EpisodeItem; videoIntroController.changeSeasonOrbangu( - episode is pgc.EpisodeItem ? episode.epId : null, - episode.runtimeType.toString() == "EpisodeItem" ? episode.bvid : bvid, + isPgc ? episode.epId : null, + isEpisode ? episode.bvid : bvid, episode.cid, - episode.runtimeType.toString() == "EpisodeItem" ? episode.aid : aid, + isEpisode ? episode.aid : aid, episode is EpisodeItem ? episode.arc?.pic - : episode is pgc.EpisodeItem + : isPgc ? episode.cover : null, );