mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: season with part
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -520,10 +520,13 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
heroTag: heroTag,
|
heroTag: heroTag,
|
||||||
ugcSeason: widget.videoDetail!.ugcSeason!,
|
ugcSeason: widget.videoDetail!.ugcSeason!,
|
||||||
cid: videoIntroController.lastPlayCid.value != 0
|
cid: videoIntroController.lastPlayCid.value != 0
|
||||||
? videoIntroController.lastPlayCid.value
|
? (widget.videoDetail!.pages?.isNotEmpty == true
|
||||||
|
? widget.videoDetail!.pages!.first.cid
|
||||||
|
: videoIntroController.lastPlayCid.value)
|
||||||
: widget.videoDetail!.pages!.first.cid,
|
: widget.videoDetail!.pages!.first.cid,
|
||||||
changeFuc: videoIntroController.changeSeasonOrbangu,
|
changeFuc: videoIntroController.changeSeasonOrbangu,
|
||||||
showEpisodes: widget.showEpisodes,
|
showEpisodes: widget.showEpisodes,
|
||||||
|
pages: widget.videoDetail!.pages,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ class PagesPanel extends StatefulWidget {
|
|||||||
const PagesPanel({
|
const PagesPanel({
|
||||||
super.key,
|
super.key,
|
||||||
required this.pages,
|
required this.pages,
|
||||||
this.cid,
|
required this.cid,
|
||||||
required this.bvid,
|
required this.bvid,
|
||||||
required this.changeFuc,
|
required this.changeFuc,
|
||||||
required this.heroTag,
|
required this.heroTag,
|
||||||
required this.showEpisodes,
|
required this.showEpisodes,
|
||||||
});
|
});
|
||||||
final List<Part> pages;
|
final List<Part> pages;
|
||||||
final int? cid;
|
final int cid;
|
||||||
final String bvid;
|
final String bvid;
|
||||||
final Function changeFuc;
|
final Function changeFuc;
|
||||||
final String heroTag;
|
final String heroTag;
|
||||||
@@ -29,7 +29,6 @@ class PagesPanel extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PagesPanelState extends State<PagesPanel> {
|
class _PagesPanelState extends State<PagesPanel> {
|
||||||
late List<Part> episodes;
|
|
||||||
late int cid;
|
late int cid;
|
||||||
late int currentIndex;
|
late int currentIndex;
|
||||||
// final String heroTag = Get.arguments['heroTag'];
|
// final String heroTag = Get.arguments['heroTag'];
|
||||||
@@ -40,14 +39,13 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
cid = widget.cid!;
|
cid = widget.cid;
|
||||||
episodes = widget.pages;
|
|
||||||
heroTag = widget.heroTag;
|
heroTag = widget.heroTag;
|
||||||
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
||||||
currentIndex = episodes.indexWhere((Part e) => e.cid == cid);
|
currentIndex = widget.pages.indexWhere((Part e) => e.cid == cid);
|
||||||
_videoDetailController.cid.listen((int p0) {
|
_videoDetailController.cid.listen((int p0) {
|
||||||
cid = p0;
|
cid = p0;
|
||||||
currentIndex = episodes.indexWhere((Part e) => e.cid == cid);
|
currentIndex = max(0, widget.pages.indexWhere((Part e) => e.cid == cid));
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
const double itemWidth = 150; // 每个列表项的宽度
|
const double itemWidth = 150; // 每个列表项的宽度
|
||||||
final double targetOffset = min(
|
final double targetOffset = min(
|
||||||
@@ -98,7 +96,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
onPressed: () => widget.showEpisodes(
|
onPressed: () => widget.showEpisodes(
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
episodes,
|
widget.pages,
|
||||||
widget.bvid,
|
widget.bvid,
|
||||||
IdUtils.bv2av(widget.bvid),
|
IdUtils.bv2av(widget.bvid),
|
||||||
cid,
|
cid,
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ class SeasonPanel extends StatefulWidget {
|
|||||||
required this.changeFuc,
|
required this.changeFuc,
|
||||||
required this.heroTag,
|
required this.heroTag,
|
||||||
required this.showEpisodes,
|
required this.showEpisodes,
|
||||||
|
required this.pages,
|
||||||
});
|
});
|
||||||
final UgcSeason ugcSeason;
|
final UgcSeason ugcSeason;
|
||||||
final int? cid;
|
final int? cid;
|
||||||
final Function changeFuc;
|
final Function changeFuc;
|
||||||
final String heroTag;
|
final String heroTag;
|
||||||
final Function showEpisodes;
|
final Function showEpisodes;
|
||||||
|
final List<Part>? pages;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SeasonPanel> createState() => _SeasonPanelState();
|
State<SeasonPanel> createState() => _SeasonPanelState();
|
||||||
@@ -49,6 +51,8 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
// .episodes!;
|
// .episodes!;
|
||||||
currentIndex = episodes!.indexWhere((EpisodeItem e) => e.cid == cid);
|
currentIndex = episodes!.indexWhere((EpisodeItem e) => e.cid == cid);
|
||||||
_videoDetailController.cid.listen((int p0) {
|
_videoDetailController.cid.listen((int p0) {
|
||||||
|
bool isPart = widget.pages?.indexWhere((item) => item.cid == p0) != -1;
|
||||||
|
if (isPart) return;
|
||||||
cid = p0;
|
cid = p0;
|
||||||
_findEpisode();
|
_findEpisode();
|
||||||
currentIndex = episodes!.indexWhere((EpisodeItem e) => e.cid == cid);
|
currentIndex = episodes!.indexWhere((EpisodeItem e) => e.cid == cid);
|
||||||
|
|||||||
@@ -347,7 +347,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
String bvid = widget.controller.bvid;
|
String bvid = widget.controller.bvid;
|
||||||
List episodes = [];
|
List episodes = [];
|
||||||
late Function changeFucCall;
|
late Function changeFucCall;
|
||||||
if (isSeason) {
|
if (isPage) {
|
||||||
|
final List<Part> pages =
|
||||||
|
videoIntroController!.videoDetail.value.pages!;
|
||||||
|
episodes = pages;
|
||||||
|
changeFucCall = videoIntroController!.changeSeasonOrbangu;
|
||||||
|
} else if (isSeason) {
|
||||||
final List<SectionItem> sections =
|
final List<SectionItem> sections =
|
||||||
videoIntroController!.videoDetail.value.ugcSeason!.sections!;
|
videoIntroController!.videoDetail.value.ugcSeason!.sections!;
|
||||||
for (int i = 0; i < sections.length; i++) {
|
for (int i = 0; i < sections.length; i++) {
|
||||||
@@ -361,11 +366,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
changeFucCall = videoIntroController!.changeSeasonOrbangu;
|
changeFucCall = videoIntroController!.changeSeasonOrbangu;
|
||||||
} else if (isPage) {
|
|
||||||
final List<Part> pages =
|
|
||||||
videoIntroController!.videoDetail.value.pages!;
|
|
||||||
episodes = pages;
|
|
||||||
changeFucCall = videoIntroController!.changeSeasonOrbangu;
|
|
||||||
} else if (isBangumi) {
|
} else if (isBangumi) {
|
||||||
episodes = (bangumiIntroController!.loadingState.value as Success)
|
episodes = (bangumiIntroController!.loadingState.value as Success)
|
||||||
.response
|
.response
|
||||||
@@ -375,7 +375,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
if (widget.showEpisodes != null) {
|
if (widget.showEpisodes != null) {
|
||||||
widget.showEpisodes!(
|
widget.showEpisodes!(
|
||||||
index,
|
index,
|
||||||
videoIntroController?.videoDetail.value.ugcSeason,
|
isPage
|
||||||
|
? null
|
||||||
|
: videoIntroController?.videoDetail.value.ugcSeason,
|
||||||
episodes,
|
episodes,
|
||||||
bvid,
|
bvid,
|
||||||
IdUtils.bv2av(bvid),
|
IdUtils.bv2av(bvid),
|
||||||
|
|||||||
Reference in New Issue
Block a user