mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: episodes showing
This commit is contained in:
@@ -467,13 +467,16 @@ class VideoIntroController extends GetxController {
|
||||
}
|
||||
|
||||
// 修改分P或番剧分集
|
||||
Future changeSeasonOrbangu(bvid, cid, aid) async {
|
||||
Future changeSeasonOrbangu(bvid, cid, aid, cover) async {
|
||||
// 重新获取视频资源
|
||||
final VideoDetailController videoDetailCtr =
|
||||
Get.find<VideoDetailController>(tag: heroTag);
|
||||
videoDetailCtr.bvid = bvid;
|
||||
videoDetailCtr.oid.value = aid ?? IdUtils.bv2av(bvid);
|
||||
videoDetailCtr.cid.value = cid;
|
||||
if (cover is String && cover.isNotEmpty) {
|
||||
videoItem!['pic'] = cover;
|
||||
}
|
||||
videoDetailCtr.danmakuCid.value = cid;
|
||||
videoDetailCtr.queryVideoUrl();
|
||||
// 重新请求相关视频
|
||||
@@ -559,7 +562,7 @@ class VideoIntroController extends GetxController {
|
||||
final int cid = episodes[prevIndex].cid!;
|
||||
final String rBvid = isPages ? bvid : episodes[prevIndex].bvid;
|
||||
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[prevIndex].aid!;
|
||||
changeSeasonOrbangu(rBvid, cid, rAid);
|
||||
changeSeasonOrbangu(rBvid, cid, rAid, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -607,7 +610,7 @@ class VideoIntroController extends GetxController {
|
||||
final int cid = episodes[nextIndex].cid!;
|
||||
final String rBvid = isPages ? bvid : episodes[nextIndex].bvid;
|
||||
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[nextIndex].aid!;
|
||||
changeSeasonOrbangu(rBvid, cid, rAid);
|
||||
changeSeasonOrbangu(rBvid, cid, rAid, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
|
||||
import 'widgets/action_item.dart';
|
||||
import 'widgets/action_row_item.dart';
|
||||
import 'widgets/fav_panel.dart';
|
||||
import 'widgets/intro_detail.dart';
|
||||
import 'widgets/page.dart';
|
||||
import 'widgets/season.dart';
|
||||
|
||||
@@ -30,10 +29,12 @@ class VideoIntroPanel extends StatefulWidget {
|
||||
required this.heroTag,
|
||||
required this.showAiBottomSheet,
|
||||
required this.showIntroDetail,
|
||||
required this.showEpisodes,
|
||||
});
|
||||
final String heroTag;
|
||||
final Function showAiBottomSheet;
|
||||
final Function showIntroDetail;
|
||||
final Function showEpisodes;
|
||||
|
||||
@override
|
||||
State<VideoIntroPanel> createState() => _VideoIntroPanelState();
|
||||
@@ -82,6 +83,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
heroTag: heroTag,
|
||||
showAiBottomSheet: widget.showAiBottomSheet,
|
||||
showIntroDetail: widget.showIntroDetail,
|
||||
showEpisodes: widget.showEpisodes,
|
||||
)
|
||||
: VideoInfo(
|
||||
//key:herotag
|
||||
@@ -91,6 +93,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
heroTag: heroTag,
|
||||
showAiBottomSheet: widget.showAiBottomSheet,
|
||||
showIntroDetail: widget.showIntroDetail,
|
||||
showEpisodes: widget.showEpisodes,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -101,6 +104,7 @@ class VideoInfo extends StatefulWidget {
|
||||
final String? heroTag;
|
||||
final Function showAiBottomSheet;
|
||||
final Function showIntroDetail;
|
||||
final Function showEpisodes;
|
||||
|
||||
const VideoInfo({
|
||||
Key? key,
|
||||
@@ -109,6 +113,7 @@ class VideoInfo extends StatefulWidget {
|
||||
this.heroTag,
|
||||
required this.showAiBottomSheet,
|
||||
required this.showIntroDetail,
|
||||
required this.showEpisodes,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -433,6 +438,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
? videoIntroController.lastPlayCid.value
|
||||
: widget.videoDetail!.pages!.first.cid,
|
||||
changeFuc: videoIntroController.changeSeasonOrbangu,
|
||||
showEpisodes: widget.showEpisodes,
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -445,6 +451,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
cid: videoIntroController.lastPlayCid.value,
|
||||
bvid: videoIntroController.bvid,
|
||||
changeFuc: videoIntroController.changeSeasonOrbangu,
|
||||
showEpisodes: widget.showEpisodes,
|
||||
))
|
||||
],
|
||||
],
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPalaX/common/widgets/list_sheet.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/models/video_detail_res.dart';
|
||||
@@ -16,12 +15,14 @@ class PagesPanel extends StatefulWidget {
|
||||
required this.bvid,
|
||||
required this.changeFuc,
|
||||
required this.heroTag,
|
||||
required this.showEpisodes,
|
||||
});
|
||||
final List<Part> pages;
|
||||
final int? cid;
|
||||
final String bvid;
|
||||
final Function changeFuc;
|
||||
final String heroTag;
|
||||
final Function showEpisodes;
|
||||
|
||||
@override
|
||||
State<PagesPanel> createState() => _PagesPanelState();
|
||||
@@ -94,16 +95,8 @@ class _PagesPanelState extends State<PagesPanel> {
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStateProperty.all(EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () {
|
||||
ListSheet(
|
||||
episodes: episodes,
|
||||
bvid: widget.bvid,
|
||||
aid: IdUtils.bv2av(widget.bvid),
|
||||
currentCid: cid,
|
||||
changeFucCall: widget.changeFuc,
|
||||
context: context,
|
||||
).buildShowBottomSheet();
|
||||
},
|
||||
onPressed: () => widget.showEpisodes(
|
||||
episodes, widget.bvid, IdUtils.bv2av(widget.bvid), cid),
|
||||
child: Text(
|
||||
'共${widget.pages.length}集',
|
||||
style: const TextStyle(fontSize: 13),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:PiliPalaX/common/widgets/list_sheet.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:PiliPalaX/models/video_detail_res.dart';
|
||||
@@ -11,11 +10,13 @@ class SeasonPanel extends StatefulWidget {
|
||||
this.cid,
|
||||
required this.changeFuc,
|
||||
required this.heroTag,
|
||||
required this.showEpisodes,
|
||||
});
|
||||
final UgcSeason ugcSeason;
|
||||
final int? cid;
|
||||
final Function changeFuc;
|
||||
final String heroTag;
|
||||
final Function showEpisodes;
|
||||
|
||||
@override
|
||||
State<SeasonPanel> createState() => _SeasonPanelState();
|
||||
@@ -102,16 +103,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
ListSheet(
|
||||
episodes: episodes,
|
||||
// bvid: IdUtils.av2bv(episodes!.first.aid!),
|
||||
// aid: episodes!.first.aid!,
|
||||
currentCid: cid,
|
||||
changeFucCall: widget.changeFuc,
|
||||
context: context)
|
||||
.buildShowBottomSheet();
|
||||
},
|
||||
onTap: () => widget.showEpisodes(episodes, null, null, cid),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 12, 8, 12),
|
||||
child: Row(
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPalaX/common/constants.dart';
|
||||
import 'package:PiliPalaX/common/widgets/list_sheet.dart';
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/models/common/reply_type.dart';
|
||||
import 'package:PiliPalaX/pages/video/detail/introduction/widgets/intro_detail.dart';
|
||||
@@ -420,6 +421,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
Widget tabbarBuild([
|
||||
bool needIndicator = true,
|
||||
String introText = '简介',
|
||||
bool isSingle = false,
|
||||
]) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
@@ -439,6 +441,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
flex: 1,
|
||||
child: Obx(
|
||||
() => TabBar(
|
||||
labelColor: needIndicator
|
||||
? null
|
||||
: Theme.of(context).colorScheme.onSurface,
|
||||
indicatorColor: needIndicator ? null : Colors.transparent,
|
||||
padding: EdgeInsets.zero,
|
||||
controller: videoDetailController.tabCtr,
|
||||
@@ -447,7 +452,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
horizontal: 10.0), // 设置每个标签的宽度
|
||||
dividerColor: Colors.transparent,
|
||||
onTap: (value) {
|
||||
if (!needIndicator ||
|
||||
if (isSingle) {
|
||||
_videoReplyController.animateToTop();
|
||||
} else if (!needIndicator ||
|
||||
!videoDetailController.tabCtr.indexIsChanging) {
|
||||
if (value == 0) {
|
||||
_introController.animToTop();
|
||||
@@ -457,7 +464,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
}
|
||||
},
|
||||
tabs: [
|
||||
Tab(text: introText),
|
||||
if (!isSingle) Tab(text: introText),
|
||||
Tab(
|
||||
text:
|
||||
'评论${_videoReplyController.count.value == -1 ? '' : ' ${_videoReplyController.count.value}'}',
|
||||
@@ -718,14 +725,17 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
heroTag: heroTag,
|
||||
showAiBottomSheet: showAiBottomSheet,
|
||||
showIntroDetail: showIntroDetail,
|
||||
showEpisodes: showEpisodes,
|
||||
),
|
||||
] else if (videoDetailController
|
||||
.videoType ==
|
||||
SearchType.media_bangumi) ...[
|
||||
Obx(() => BangumiIntroPanel(
|
||||
heroTag: heroTag,
|
||||
cid:
|
||||
videoDetailController.cid.value)),
|
||||
heroTag: heroTag,
|
||||
cid:
|
||||
videoDetailController.cid.value,
|
||||
showEpisodes: showEpisodes,
|
||||
)),
|
||||
],
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
@@ -837,12 +847,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
heroTag: heroTag,
|
||||
showAiBottomSheet: showAiBottomSheet,
|
||||
showIntroDetail: showIntroDetail,
|
||||
showEpisodes: showEpisodes,
|
||||
),
|
||||
] else if (videoDetailController.videoType ==
|
||||
SearchType.media_bangumi) ...[
|
||||
Obx(() => BangumiIntroPanel(
|
||||
heroTag: heroTag,
|
||||
cid: videoDetailController.cid.value)),
|
||||
heroTag: heroTag,
|
||||
cid: videoDetailController.cid.value,
|
||||
showEpisodes: showEpisodes,
|
||||
)),
|
||||
],
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
@@ -948,13 +961,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
heroTag: heroTag,
|
||||
showAiBottomSheet: showAiBottomSheet,
|
||||
showIntroDetail: showIntroDetail,
|
||||
showEpisodes: showEpisodes,
|
||||
),
|
||||
RelatedVideoPanel(heroTag: heroTag),
|
||||
] else if (videoDetailController.videoType ==
|
||||
SearchType.media_bangumi) ...[
|
||||
Obx(() => BangumiIntroPanel(
|
||||
heroTag: heroTag,
|
||||
cid: videoDetailController.cid.value)),
|
||||
heroTag: heroTag,
|
||||
cid: videoDetailController.cid.value,
|
||||
showEpisodes: showEpisodes,
|
||||
)),
|
||||
]
|
||||
],
|
||||
)),
|
||||
@@ -988,12 +1004,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
heroTag: heroTag,
|
||||
showAiBottomSheet: showAiBottomSheet,
|
||||
showIntroDetail: showIntroDetail,
|
||||
showEpisodes: showEpisodes,
|
||||
),
|
||||
RelatedVideoPanel(heroTag: heroTag),
|
||||
] else if (videoDetailController.videoType ==
|
||||
SearchType.media_bangumi) ...[
|
||||
Obx(() => BangumiIntroPanel(
|
||||
heroTag: heroTag, cid: videoDetailController.cid.value)),
|
||||
heroTag: heroTag,
|
||||
cid: videoDetailController.cid.value,
|
||||
showEpisodes: showEpisodes,
|
||||
)),
|
||||
]
|
||||
],
|
||||
)),
|
||||
@@ -1046,9 +1066,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
key: scaffoldKey,
|
||||
body: videoReplyPanel,
|
||||
child: Expanded(
|
||||
child: Scaffold(
|
||||
key: scaffoldKey,
|
||||
body: Column(
|
||||
children: [
|
||||
tabbarBuild(false, '', true),
|
||||
Expanded(child: videoReplyPanel),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Expanded(
|
||||
@@ -1164,13 +1191,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
heroTag: heroTag,
|
||||
showAiBottomSheet: showAiBottomSheet,
|
||||
showIntroDetail: showIntroDetail,
|
||||
showEpisodes: showEpisodes,
|
||||
),
|
||||
// RelatedVideoPanel(heroTag: heroTag),
|
||||
] else if (videoDetailController.videoType ==
|
||||
SearchType.media_bangumi) ...[
|
||||
Obx(() => BangumiIntroPanel(
|
||||
heroTag: heroTag,
|
||||
cid: videoDetailController.cid.value)),
|
||||
heroTag: heroTag,
|
||||
cid: videoDetailController.cid.value,
|
||||
showEpisodes: showEpisodes,
|
||||
)),
|
||||
]
|
||||
],
|
||||
),
|
||||
@@ -1193,7 +1223,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
key: scaffoldKey,
|
||||
body: Column(
|
||||
children: [
|
||||
tabbarBuild(true, '相关视频'),
|
||||
tabbarBuild(
|
||||
videoDetailController.videoType !=
|
||||
SearchType.media_bangumi,
|
||||
'相关视频',
|
||||
videoDetailController.videoType ==
|
||||
SearchType.media_bangumi,
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
@@ -1408,4 +1444,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
scaffoldKey.currentState?.showBottomSheet(
|
||||
enableDrag: true, (context) => IntroDetail(videoDetail: videoDetail));
|
||||
}
|
||||
|
||||
showEpisodes(episodes, bvid, aid, cid) {
|
||||
ListSheet(
|
||||
episodes: episodes,
|
||||
bvid: bvid,
|
||||
aid: aid,
|
||||
currentCid: cid,
|
||||
changeFucCall: videoIntroController.changeSeasonOrbangu,
|
||||
context: context,
|
||||
scaffoldState: scaffoldKey.currentState,
|
||||
).buildShowBottomSheet();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user