fix: 补充更多的heroTag,直接传入避免问题

This commit is contained in:
orz12
2024-06-02 13:27:39 +08:00
parent 3dd4fef45a
commit 03b97c5f43
7 changed files with 50 additions and 24 deletions

View File

@@ -15,11 +15,13 @@ class PagesPanel extends StatefulWidget {
this.cid,
required this.bvid,
required this.changeFuc,
required this.heroTag,
});
final List<Part> pages;
final int? cid;
final String bvid;
final Function changeFuc;
final String heroTag;
@override
State<PagesPanel> createState() => _PagesPanelState();
@@ -29,7 +31,8 @@ class _PagesPanelState extends State<PagesPanel> {
late List<Part> episodes;
late int cid;
late int currentIndex;
final String heroTag = Get.arguments['heroTag'];
// final String heroTag = Get.arguments['heroTag'];
late final String heroTag;
late VideoDetailController _videoDetailController;
final ScrollController _scrollController2 = ScrollController();
@@ -38,6 +41,7 @@ class _PagesPanelState extends State<PagesPanel> {
super.initState();
cid = widget.cid!;
episodes = widget.pages;
heroTag = widget.heroTag;
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
currentIndex = episodes.indexWhere((Part e) => e.cid == cid);
_videoDetailController.cid.listen((int p0) {

View File

@@ -10,10 +10,12 @@ class SeasonPanel extends StatefulWidget {
required this.ugcSeason,
this.cid,
required this.changeFuc,
required this.heroTag,
});
final UgcSeason ugcSeason;
final int? cid;
final Function changeFuc;
final String heroTag;
@override
State<SeasonPanel> createState() => _SeasonPanelState();
@@ -23,7 +25,8 @@ class _SeasonPanelState extends State<SeasonPanel> {
List<EpisodeItem>? episodes;
late int cid;
int currentIndex = 0;
final String heroTag = Get.arguments['heroTag'];
// final String heroTag = Get.arguments['heroTag'];
late final String heroTag;
late VideoDetailController _videoDetailController;
final ScrollController _scrollController = ScrollController();
@@ -31,6 +34,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
void initState() {
super.initState();
cid = widget.cid!;
heroTag = widget.heroTag;
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
/// 根据 cid 找到对应集,找到对应 episodes