mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-16 15:16:15 +08:00
opt find pgc episode
tweak Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -622,7 +622,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
|
|||||||
_tabController.animateTo(widget.initialTabIndex);
|
_tabController.animateTo(widget.initialTabIndex);
|
||||||
await Future.delayed(const Duration(milliseconds: 225));
|
await Future.delayed(const Duration(milliseconds: 225));
|
||||||
}
|
}
|
||||||
_itemScrollController[currentTabIndex].scrollTo(
|
_itemScrollController[widget.initialTabIndex].scrollTo(
|
||||||
index: _currentItemIndex,
|
index: _currentItemIndex,
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -305,10 +305,13 @@ class _UgcIntroPanelState extends TripleState<UgcIntroPanel>
|
|||||||
!videoDetailCtr
|
!videoDetailCtr
|
||||||
.plPlayerController
|
.plPlayerController
|
||||||
.horizontalSeasonPanel))
|
.horizontalSeasonPanel))
|
||||||
SeasonPanel(
|
Obx(
|
||||||
heroTag: widget.heroTag,
|
() => SeasonPanel(
|
||||||
showEpisodes: widget.showEpisodes,
|
key: ValueKey(introController.videoDetail.value),
|
||||||
ugcIntroController: introController,
|
heroTag: widget.heroTag,
|
||||||
|
showEpisodes: widget.showEpisodes,
|
||||||
|
ugcIntroController: introController,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (!isLoading &&
|
if (!isLoading &&
|
||||||
videoDetail.pages != null &&
|
videoDetail.pages != null &&
|
||||||
@@ -316,14 +319,16 @@ class _UgcIntroPanelState extends TripleState<UgcIntroPanel>
|
|||||||
(isPortrait ||
|
(isPortrait ||
|
||||||
!videoDetailCtr
|
!videoDetailCtr
|
||||||
.plPlayerController
|
.plPlayerController
|
||||||
.horizontalSeasonPanel)) ...[
|
.horizontalSeasonPanel))
|
||||||
PagesPanel(
|
Obx(
|
||||||
heroTag: widget.heroTag,
|
() => PagesPanel(
|
||||||
ugcIntroController: introController,
|
key: ValueKey(introController.videoDetail.value),
|
||||||
bvid: introController.bvid,
|
heroTag: widget.heroTag,
|
||||||
showEpisodes: widget.showEpisodes,
|
ugcIntroController: introController,
|
||||||
|
bvid: introController.bvid,
|
||||||
|
showEpisodes: widget.showEpisodes,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:PiliPlus/utils/id_utils.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
// TODO refa
|
||||||
class PagesPanel extends StatefulWidget {
|
class PagesPanel extends StatefulWidget {
|
||||||
const PagesPanel({
|
const PagesPanel({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -156,7 +157,9 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
if (widget.showEpisodes == null) {
|
if (widget.showEpisodes == null) {
|
||||||
Get.back();
|
Get.back();
|
||||||
}
|
}
|
||||||
widget.ugcIntroController.onChangeEpisode(item);
|
widget.ugcIntroController.onChangeEpisode(
|
||||||
|
item..bvid ??= widget.bvid,
|
||||||
|
);
|
||||||
if (widget.list != null &&
|
if (widget.list != null &&
|
||||||
widget
|
widget
|
||||||
.ugcIntroController
|
.ugcIntroController
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:PiliPlus/pages/video/introduction/ugc/controller.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
// TODO refa
|
||||||
class SeasonPanel extends StatefulWidget {
|
class SeasonPanel extends StatefulWidget {
|
||||||
const SeasonPanel({
|
const SeasonPanel({
|
||||||
super.key,
|
super.key,
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ class PiliScheme {
|
|||||||
cid: int.parse(cid),
|
cid: int.parse(cid),
|
||||||
progress: progress == null ? null : int.parse(progress),
|
progress: progress == null ? null : int.parse(progress),
|
||||||
off: off,
|
off: off,
|
||||||
preventDuplicates: false,
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
videoPush(
|
videoPush(
|
||||||
@@ -906,7 +905,6 @@ class PiliScheme {
|
|||||||
cid: cid,
|
cid: cid,
|
||||||
progress: progress == null ? null : int.parse(progress),
|
progress: progress == null ? null : int.parse(progress),
|
||||||
off: off,
|
off: off,
|
||||||
preventDuplicates: false,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -441,7 +441,6 @@ class PageUtils {
|
|||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: cover,
|
cover: cover,
|
||||||
preventDuplicates: false,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -484,7 +483,6 @@ class PageUtils {
|
|||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
cover: cover,
|
cover: cover,
|
||||||
preventDuplicates: false,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -718,7 +716,6 @@ class PageUtils {
|
|||||||
int? progress,
|
int? progress,
|
||||||
Map? extraArguments,
|
Map? extraArguments,
|
||||||
int? id,
|
int? id,
|
||||||
bool preventDuplicates = true,
|
|
||||||
bool off = false,
|
bool off = false,
|
||||||
}) {
|
}) {
|
||||||
if (PlPlayerController.instance?.isLive == true) {
|
if (PlPlayerController.instance?.isLive == true) {
|
||||||
@@ -813,32 +810,21 @@ class PageUtils {
|
|||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
PgcInfoModel data = result.data;
|
PgcInfoModel data = result.data;
|
||||||
final episodes = data.episodes;
|
final episodes = data.episodes;
|
||||||
|
final hasEpisode = episodes != null && episodes.isNotEmpty;
|
||||||
|
|
||||||
|
EpisodeItem? episode;
|
||||||
|
if (epId != null) {
|
||||||
|
epId = epId.toString();
|
||||||
|
if (hasEpisode) {
|
||||||
|
episode = episodes.firstWhereOrNull(
|
||||||
|
(item) => item.epId.toString() == epId,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (episodes != null && episodes.isNotEmpty) {
|
|
||||||
final EpisodeItem episode = findEpisode(
|
|
||||||
episodes,
|
|
||||||
epId: epId ?? data.userStatus?.progress?.lastEpId,
|
|
||||||
);
|
|
||||||
toVideoPage(
|
|
||||||
videoType: VideoType.pgc,
|
|
||||||
bvid: episode.bvid!,
|
|
||||||
cid: episode.cid!,
|
|
||||||
seasonId: data.seasonId,
|
|
||||||
epId: episode.epId,
|
|
||||||
pgcType: data.type,
|
|
||||||
cover: episode.cover,
|
|
||||||
progress: progress == null ? null : int.tryParse(progress),
|
|
||||||
extraArguments: {
|
|
||||||
'pgcItem': data,
|
|
||||||
},
|
|
||||||
preventDuplicates: false,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// find section
|
// find section
|
||||||
if (epId != null) {
|
if (episode == null) {
|
||||||
final sections = data.section;
|
final sections = data.section;
|
||||||
if (sections != null && sections.isNotEmpty) {
|
if (sections != null && sections.isNotEmpty) {
|
||||||
epId = epId.toString();
|
|
||||||
for (var section in sections) {
|
for (var section in sections) {
|
||||||
final episodes = section.episodes;
|
final episodes = section.episodes;
|
||||||
if (episodes != null && episodes.isNotEmpty) {
|
if (episodes != null && episodes.isNotEmpty) {
|
||||||
@@ -859,7 +845,6 @@ class PageUtils {
|
|||||||
'pgcApi': true,
|
'pgcApi': true,
|
||||||
'pgcItem': data,
|
'pgcItem': data,
|
||||||
},
|
},
|
||||||
preventDuplicates: false,
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -868,8 +853,30 @@ class PageUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SmartDialog.showToast('资源加载失败');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasEpisode) {
|
||||||
|
episode ??= findEpisode(
|
||||||
|
episodes,
|
||||||
|
epId: data.userStatus?.progress?.lastEpId,
|
||||||
|
);
|
||||||
|
toVideoPage(
|
||||||
|
videoType: VideoType.pgc,
|
||||||
|
bvid: episode.bvid!,
|
||||||
|
cid: episode.cid!,
|
||||||
|
seasonId: data.seasonId,
|
||||||
|
epId: episode.epId,
|
||||||
|
pgcType: data.type,
|
||||||
|
cover: episode.cover,
|
||||||
|
progress: progress == null ? null : int.tryParse(progress),
|
||||||
|
extraArguments: {
|
||||||
|
'pgcItem': data,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SmartDialog.showToast('资源加载失败');
|
||||||
} else {
|
} else {
|
||||||
result.toast();
|
result.toast();
|
||||||
}
|
}
|
||||||
@@ -912,7 +919,6 @@ class PageUtils {
|
|||||||
extraArguments: {
|
extraArguments: {
|
||||||
'pgcItem': data,
|
'pgcItem': data,
|
||||||
},
|
},
|
||||||
preventDuplicates: false,
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast('资源加载失败');
|
SmartDialog.showToast('资源加载失败');
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ class UrlUtils {
|
|||||||
aid: aid,
|
aid: aid,
|
||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
cid: cid,
|
cid: cid,
|
||||||
preventDuplicates: false,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user