mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-05 02:00:13 +08:00
feat: custom horizontal season panel
Closes #50 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -23,7 +23,7 @@ class ListSheetContent extends StatefulWidget {
|
|||||||
this.aid,
|
this.aid,
|
||||||
required this.currentCid,
|
required this.currentCid,
|
||||||
required this.changeFucCall,
|
required this.changeFucCall,
|
||||||
required this.onClose,
|
this.onClose,
|
||||||
});
|
});
|
||||||
|
|
||||||
final dynamic index;
|
final dynamic index;
|
||||||
@@ -33,7 +33,7 @@ class ListSheetContent extends StatefulWidget {
|
|||||||
final int? aid;
|
final int? aid;
|
||||||
final int currentCid;
|
final int currentCid;
|
||||||
final Function changeFucCall;
|
final Function changeFucCall;
|
||||||
final VoidCallback onClose;
|
final VoidCallback? onClose;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ListSheetContent> createState() => _ListSheetContentState();
|
State<ListSheetContent> createState() => _ListSheetContentState();
|
||||||
@@ -42,7 +42,7 @@ class ListSheetContent extends StatefulWidget {
|
|||||||
class _ListSheetContentState extends State<ListSheetContent>
|
class _ListSheetContentState extends State<ListSheetContent>
|
||||||
with TickerProviderStateMixin {
|
with TickerProviderStateMixin {
|
||||||
late List<ItemScrollController> itemScrollController = [];
|
late List<ItemScrollController> itemScrollController = [];
|
||||||
late final int currentIndex =
|
late int currentIndex =
|
||||||
widget.episodes!.indexWhere((dynamic e) => e.cid == widget.currentCid) ??
|
widget.episodes!.indexWhere((dynamic e) => e.cid == widget.currentCid) ??
|
||||||
0;
|
0;
|
||||||
late List<bool> reverse;
|
late List<bool> reverse;
|
||||||
@@ -57,11 +57,19 @@ class _ListSheetContentState extends State<ListSheetContent>
|
|||||||
int? _seasonFav;
|
int? _seasonFav;
|
||||||
StreamController? _favStream;
|
StreamController? _favStream;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didUpdateWidget(ListSheetContent oldWidget) {
|
||||||
|
super.didUpdateWidget(oldWidget);
|
||||||
|
currentIndex = widget.episodes!
|
||||||
|
.indexWhere((dynamic e) => e.cid == widget.currentCid) ??
|
||||||
|
0;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (_isList) {
|
if (_isList) {
|
||||||
_indexStream = StreamController<int>();
|
_indexStream ??= StreamController<int>();
|
||||||
_ctr = TabController(
|
_ctr = TabController(
|
||||||
vsync: this,
|
vsync: this,
|
||||||
length: widget.season.sections.length,
|
length: widget.season.sections.length,
|
||||||
@@ -81,7 +89,7 @@ class _ListSheetContentState extends State<ListSheetContent>
|
|||||||
itemScrollController[_index].jumpTo(index: currentIndex);
|
itemScrollController[_index].jumpTo(index: currentIndex);
|
||||||
});
|
});
|
||||||
if (widget.bvid != null && widget.season != null) {
|
if (widget.bvid != null && widget.season != null) {
|
||||||
_favStream = StreamController<int>();
|
_favStream ??= StreamController<int>();
|
||||||
() async {
|
() async {
|
||||||
dynamic result = await VideoHttp.videoRelation(bvid: widget.bvid);
|
dynamic result = await VideoHttp.videoRelation(bvid: widget.bvid);
|
||||||
if (result['status']) {
|
if (result['status']) {
|
||||||
@@ -95,7 +103,9 @@ class _ListSheetContentState extends State<ListSheetContent>
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_favStream?.close();
|
_favStream?.close();
|
||||||
|
_favStream = null;
|
||||||
_indexStream?.close();
|
_indexStream?.close();
|
||||||
|
_indexStream = null;
|
||||||
_ctr?.removeListener(() {});
|
_ctr?.removeListener(() {});
|
||||||
_ctr?.dispose();
|
_ctr?.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
@@ -137,7 +147,7 @@ class _ListSheetContentState extends State<ListSheetContent>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SmartDialog.showToast('切换到:$title');
|
SmartDialog.showToast('切换到:$title');
|
||||||
widget.onClose();
|
widget.onClose?.call();
|
||||||
widget.changeFucCall(
|
widget.changeFucCall(
|
||||||
episode is bangumi.EpisodeItem ? episode.epId : null,
|
episode is bangumi.EpisodeItem ? episode.epId : null,
|
||||||
episode.runtimeType.toString() == "EpisodeItem"
|
episode.runtimeType.toString() == "EpisodeItem"
|
||||||
@@ -234,7 +244,7 @@ class _ListSheetContentState extends State<ListSheetContent>
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'合集(${_isList ? widget.season.epCount : widget.episodes!.length})',
|
'合集(${_isList ? widget.season.epCount : widget.episodes?.length ?? ''})',
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
StreamBuilder(
|
StreamBuilder(
|
||||||
@@ -324,11 +334,12 @@ class _ListSheetContentState extends State<ListSheetContent>
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_mediumButton(
|
if (widget.onClose != null)
|
||||||
tooltip: '关闭',
|
_mediumButton(
|
||||||
icon: Icons.close,
|
tooltip: '关闭',
|
||||||
onPressed: widget.onClose,
|
icon: Icons.close,
|
||||||
),
|
onPressed: widget.onClose,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -253,6 +253,12 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
setKey: SettingBoxKey.exapndIntroPanelH,
|
setKey: SettingBoxKey.exapndIntroPanelH,
|
||||||
defaultVal: false,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
|
SetSwitchItem(
|
||||||
|
title: '横屏分P/合集列表显示在Tab栏',
|
||||||
|
leading: Icon(Icons.format_list_numbered_rtl_sharp),
|
||||||
|
setKey: SettingBoxKey.horizontalSeasonPanel,
|
||||||
|
defaultVal: false,
|
||||||
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => ListTile(
|
() => ListTile(
|
||||||
enableFeedback: true,
|
enableFeedback: true,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import 'package:PiliPalaX/http/init.dart';
|
|||||||
import 'package:PiliPalaX/http/user.dart';
|
import 'package:PiliPalaX/http/user.dart';
|
||||||
import 'package:PiliPalaX/models/video/later.dart';
|
import 'package:PiliPalaX/models/video/later.dart';
|
||||||
import 'package:PiliPalaX/models/video/play/subtitle.dart';
|
import 'package:PiliPalaX/models/video/play/subtitle.dart';
|
||||||
|
import 'package:PiliPalaX/models/video_detail_res.dart';
|
||||||
import 'package:PiliPalaX/pages/video/detail/introduction/controller.dart';
|
import 'package:PiliPalaX/pages/video/detail/introduction/controller.dart';
|
||||||
import 'package:PiliPalaX/pages/video/detail/related/controller.dart';
|
import 'package:PiliPalaX/pages/video/detail/related/controller.dart';
|
||||||
import 'package:PiliPalaX/pages/video/detail/reply/controller.dart';
|
import 'package:PiliPalaX/pages/video/detail/reply/controller.dart';
|
||||||
@@ -223,6 +224,11 @@ class VideoDetailController extends GetxController
|
|||||||
bool get showReply =>
|
bool get showReply =>
|
||||||
videoType == SearchType.video ? _showVideoReply : _showBangumiReply;
|
videoType == SearchType.video ? _showVideoReply : _showBangumiReply;
|
||||||
|
|
||||||
|
late final horizontalSeasonPanel = GStorage.horizontalSeasonPanel;
|
||||||
|
late int seasonCid = 0;
|
||||||
|
late RxInt seasonIndex = 0.obs;
|
||||||
|
late RxList<EpisodeItem> episodes = <EpisodeItem>[].obs;
|
||||||
|
|
||||||
late final bool enableSponsorBlock;
|
late final bool enableSponsorBlock;
|
||||||
PlayerStatus? playerStatus;
|
PlayerStatus? playerStatus;
|
||||||
StreamSubscription<Duration>? positionSubscription;
|
StreamSubscription<Duration>? positionSubscription;
|
||||||
|
|||||||
@@ -691,13 +691,6 @@ class VideoIntroController extends GetxController
|
|||||||
episodes.indexWhere((e) => e.cid == lastPlayCid.value);
|
episodes.indexWhere((e) => e.cid == lastPlayCid.value);
|
||||||
int nextIndex = currentIndex + 1;
|
int nextIndex = currentIndex + 1;
|
||||||
|
|
||||||
int cid = episodes[nextIndex].cid!;
|
|
||||||
while (cid == -1) {
|
|
||||||
nextIndex++;
|
|
||||||
SmartDialog.showToast('当前视频暂不支持播放,自动跳过');
|
|
||||||
cid = episodes[nextIndex].cid!;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 列表循环
|
// 列表循环
|
||||||
if (nextIndex >= episodes.length) {
|
if (nextIndex >= episodes.length) {
|
||||||
if (platRepeat == PlayRepeat.listCycle) {
|
if (platRepeat == PlayRepeat.listCycle) {
|
||||||
@@ -709,6 +702,18 @@ class VideoIntroController extends GetxController
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cid = episodes[nextIndex].cid!;
|
||||||
|
|
||||||
|
while (cid == -1) {
|
||||||
|
SmartDialog.showToast('当前视频暂不支持播放,自动跳过');
|
||||||
|
nextIndex++;
|
||||||
|
if (nextIndex >= episodes.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
cid = episodes[nextIndex].cid!;
|
||||||
|
}
|
||||||
|
|
||||||
final String rBvid = isPages ? bvid : episodes[nextIndex].bvid;
|
final String rBvid = isPages ? bvid : episodes[nextIndex].bvid;
|
||||||
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[nextIndex].aid!;
|
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[nextIndex].aid!;
|
||||||
changeSeasonOrbangu(null, rBvid, cid, rAid, null);
|
changeSeasonOrbangu(null, rBvid, cid, rAid, null);
|
||||||
|
|||||||
@@ -627,7 +627,11 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
// 点赞收藏转发 布局样式2
|
// 点赞收藏转发 布局样式2
|
||||||
if (!isHorizontal) actionGrid(context, videoIntroController),
|
if (!isHorizontal) actionGrid(context, videoIntroController),
|
||||||
// 合集
|
// 合集
|
||||||
if (!loadingStatus && widget.videoDetail?.ugcSeason != null) ...[
|
if (!loadingStatus &&
|
||||||
|
widget.videoDetail?.ugcSeason != null &&
|
||||||
|
(context.orientation != Orientation.landscape ||
|
||||||
|
(context.orientation == Orientation.landscape &&
|
||||||
|
videoDetailCtr.horizontalSeasonPanel.not)))
|
||||||
Obx(
|
Obx(
|
||||||
() => SeasonPanel(
|
() => SeasonPanel(
|
||||||
heroTag: heroTag,
|
heroTag: heroTag,
|
||||||
@@ -641,11 +645,13 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
showEpisodes: widget.showEpisodes,
|
showEpisodes: widget.showEpisodes,
|
||||||
pages: widget.videoDetail!.pages,
|
pages: widget.videoDetail!.pages,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
|
||||||
if (!loadingStatus &&
|
if (!loadingStatus &&
|
||||||
widget.videoDetail?.pages != null &&
|
widget.videoDetail?.pages != null &&
|
||||||
widget.videoDetail!.pages!.length > 1) ...[
|
widget.videoDetail!.pages!.length > 1 &&
|
||||||
|
(context.orientation != Orientation.landscape ||
|
||||||
|
(context.orientation == Orientation.landscape &&
|
||||||
|
videoDetailCtr.horizontalSeasonPanel.not))) ...[
|
||||||
Obx(
|
Obx(
|
||||||
() => PagesPanel(
|
() => PagesPanel(
|
||||||
heroTag: heroTag,
|
heroTag: heroTag,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class PagesPanel extends StatefulWidget {
|
|||||||
|
|
||||||
class _PagesPanelState extends State<PagesPanel> {
|
class _PagesPanelState extends State<PagesPanel> {
|
||||||
late int cid;
|
late int cid;
|
||||||
late int currentIndex;
|
late int pageIndex;
|
||||||
// final String heroTag = Get.arguments['heroTag'];
|
// final String heroTag = Get.arguments['heroTag'];
|
||||||
late final String heroTag;
|
late final String heroTag;
|
||||||
late VideoDetailController _videoDetailController;
|
late VideoDetailController _videoDetailController;
|
||||||
@@ -42,14 +42,13 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
cid = widget.cid;
|
cid = widget.cid;
|
||||||
heroTag = widget.heroTag;
|
heroTag = widget.heroTag;
|
||||||
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
_videoDetailController = Get.find<VideoDetailController>(tag: heroTag);
|
||||||
currentIndex = widget.pages.indexWhere((Part e) => e.cid == cid);
|
pageIndex = widget.pages.indexWhere((Part e) => e.cid == cid);
|
||||||
_videoDetailController.cid.listen((int p0) {
|
_videoDetailController.cid.listen((int p0) {
|
||||||
cid = p0;
|
cid = p0;
|
||||||
currentIndex = max(0, widget.pages.indexWhere((Part e) => e.cid == cid));
|
pageIndex = 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((pageIndex * itemWidth) - (itemWidth / 2),
|
||||||
(currentIndex * itemWidth) - (itemWidth / 2),
|
|
||||||
_scrollController.position.maxScrollExtent);
|
_scrollController.position.maxScrollExtent);
|
||||||
// 滑动至目标位置
|
// 滑动至目标位置
|
||||||
_scrollController.animateTo(
|
_scrollController.animateTo(
|
||||||
@@ -78,7 +77,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
const Text('视频选集 '),
|
const Text('视频选集 '),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
' 正在播放:${widget.pages[currentIndex].pagePart}',
|
' 正在播放:${widget.pages[pageIndex].pagePart}',
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@@ -119,7 +118,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
itemCount: widget.pages.length,
|
itemCount: widget.pages.length,
|
||||||
itemExtent: 150,
|
itemExtent: 150,
|
||||||
itemBuilder: (BuildContext context, int i) {
|
itemBuilder: (BuildContext context, int i) {
|
||||||
bool isCurrentIndex = currentIndex == i;
|
bool isCurrentIndex = pageIndex == i;
|
||||||
return Container(
|
return Container(
|
||||||
width: 150,
|
width: 150,
|
||||||
margin: EdgeInsets.only(
|
margin: EdgeInsets.only(
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:PiliPalaX/models/video_detail_res.dart';
|
import 'package:PiliPalaX/models/video_detail_res.dart';
|
||||||
@@ -12,6 +14,7 @@ class SeasonPanel extends StatefulWidget {
|
|||||||
required this.heroTag,
|
required this.heroTag,
|
||||||
required this.showEpisodes,
|
required this.showEpisodes,
|
||||||
required this.pages,
|
required this.pages,
|
||||||
|
this.onTap,
|
||||||
});
|
});
|
||||||
final UgcSeason ugcSeason;
|
final UgcSeason ugcSeason;
|
||||||
final int? cid;
|
final int? cid;
|
||||||
@@ -19,48 +22,55 @@ class SeasonPanel extends StatefulWidget {
|
|||||||
final String heroTag;
|
final String heroTag;
|
||||||
final Function showEpisodes;
|
final Function showEpisodes;
|
||||||
final List<Part>? pages;
|
final List<Part>? pages;
|
||||||
|
final bool? onTap;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SeasonPanel> createState() => _SeasonPanelState();
|
State<SeasonPanel> createState() => _SeasonPanelState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SeasonPanelState extends State<SeasonPanel> {
|
class _SeasonPanelState extends State<SeasonPanel> {
|
||||||
List<EpisodeItem>? episodes;
|
|
||||||
late int cid;
|
|
||||||
int? _index;
|
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
late VideoDetailController _videoDetailController;
|
late VideoDetailController _videoDetailController;
|
||||||
|
StreamSubscription? _listener;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
cid = widget.cid!;
|
|
||||||
_videoDetailController =
|
_videoDetailController =
|
||||||
Get.find<VideoDetailController>(tag: widget.heroTag);
|
Get.find<VideoDetailController>(tag: widget.heroTag)
|
||||||
|
..seasonCid = widget.cid!;
|
||||||
|
|
||||||
/// 根据 cid 找到对应集,找到对应 episodes
|
/// 根据 cid 找到对应集,找到对应 episodes
|
||||||
/// 有多个episodes时,只显示其中一个
|
/// 有多个episodes时,只显示其中一个
|
||||||
_findEpisode();
|
_findEpisode();
|
||||||
if (episodes == null) {
|
if (_videoDetailController.episodes.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 取对应 season_id 的 episodes
|
/// 取对应 season_id 的 episodes
|
||||||
// episodes = widget.ugcSeason.sections!
|
// episodes = widget.ugcSeason.sections!
|
||||||
// .firstWhere((e) => e.seasonId == widget.ugcSeason.id)
|
// .firstWhere((e) => e.seasonId == widget.ugcSeason.id)
|
||||||
// .episodes!;
|
// .episodes;
|
||||||
currentIndex = episodes!.indexWhere((EpisodeItem e) => e.cid == cid);
|
currentIndex = _videoDetailController.episodes.indexWhere(
|
||||||
_videoDetailController.cid.listen((int p0) {
|
(EpisodeItem e) => e.cid == _videoDetailController.seasonCid);
|
||||||
|
_listener = _videoDetailController.cid.listen((int p0) {
|
||||||
bool isPart = widget.pages?.indexWhere((item) => item.cid == p0) != -1;
|
bool isPart = widget.pages?.indexWhere((item) => item.cid == p0) != -1;
|
||||||
if (isPart) return;
|
if (isPart) return;
|
||||||
cid = p0;
|
_videoDetailController.seasonCid = p0;
|
||||||
_findEpisode();
|
_findEpisode();
|
||||||
currentIndex = episodes!.indexWhere((EpisodeItem e) => e.cid == cid);
|
currentIndex = _videoDetailController.episodes.indexWhere(
|
||||||
|
(EpisodeItem e) => e.cid == _videoDetailController.seasonCid);
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_listener?.cancel();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
// void changeFucCall(item, int i) async {
|
// void changeFucCall(item, int i) async {
|
||||||
// await widget.changeFuc!(
|
// await widget.changeFuc!(
|
||||||
// IdUtils.av2bv(item.aid),
|
// IdUtils.av2bv(item.aid),
|
||||||
@@ -74,7 +84,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (episodes == null) {
|
if (_videoDetailController.episodes.isEmpty) {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
return Builder(builder: (BuildContext context) {
|
return Builder(builder: (BuildContext context) {
|
||||||
@@ -90,14 +100,16 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => widget.showEpisodes(
|
onTap: widget.onTap == false
|
||||||
_index,
|
? null
|
||||||
widget.ugcSeason,
|
: () => widget.showEpisodes(
|
||||||
episodes,
|
_videoDetailController.seasonIndex.value,
|
||||||
_videoDetailController.bvid,
|
widget.ugcSeason,
|
||||||
null,
|
_videoDetailController.episodes,
|
||||||
cid,
|
_videoDetailController.bvid,
|
||||||
),
|
null,
|
||||||
|
_videoDetailController.seasonCid,
|
||||||
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(8, 12, 8, 12),
|
padding: const EdgeInsets.fromLTRB(8, 12, 8, 12),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -118,10 +130,10 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(
|
Text(
|
||||||
'${currentIndex + 1}/${episodes!.length}',
|
'${currentIndex + 1}/${_videoDetailController.episodes.length}',
|
||||||
style: Theme.of(context).textTheme.labelMedium,
|
style: Theme.of(context).textTheme.labelMedium,
|
||||||
semanticsLabel:
|
semanticsLabel:
|
||||||
'第${currentIndex + 1}集,共${episodes!.length}集',
|
'第${currentIndex + 1}集,共${_videoDetailController.episodes.length}集',
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
const Icon(
|
const Icon(
|
||||||
@@ -143,9 +155,9 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
for (int i = 0; i < sections.length; i++) {
|
for (int i = 0; i < sections.length; i++) {
|
||||||
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
final List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||||
for (int j = 0; j < episodesList.length; j++) {
|
for (int j = 0; j < episodesList.length; j++) {
|
||||||
if (episodesList[j].cid == cid) {
|
if (episodesList[j].cid == _videoDetailController.seasonCid) {
|
||||||
_index = i;
|
_videoDetailController.seasonIndex.value = i;
|
||||||
episodes = episodesList;
|
_videoDetailController.episodes.value = episodesList;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import 'package:PiliPalaX/pages/bangumi/introduction/widgets/intro_detail.dart'
|
|||||||
as bangumi;
|
as bangumi;
|
||||||
import 'package:PiliPalaX/pages/video/detail/introduction/widgets/intro_detail.dart'
|
import 'package:PiliPalaX/pages/video/detail/introduction/widgets/intro_detail.dart'
|
||||||
as video;
|
as video;
|
||||||
|
import 'package:PiliPalaX/pages/video/detail/introduction/widgets/page.dart';
|
||||||
|
import 'package:PiliPalaX/pages/video/detail/introduction/widgets/season.dart';
|
||||||
import 'package:PiliPalaX/pages/video/detail/reply_reply/view.dart';
|
import 'package:PiliPalaX/pages/video/detail/reply_reply/view.dart';
|
||||||
import 'package:PiliPalaX/pages/video/detail/widgets/ai_detail.dart';
|
import 'package:PiliPalaX/pages/video/detail/widgets/ai_detail.dart';
|
||||||
import 'package:PiliPalaX/utils/extension.dart';
|
import 'package:PiliPalaX/utils/extension.dart';
|
||||||
@@ -90,6 +92,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
// StreamSubscription<Duration>? _bufferedListener;
|
// StreamSubscription<Duration>? _bufferedListener;
|
||||||
bool get isFullScreen => plPlayerController?.isFullScreen.value ?? false;
|
bool get isFullScreen => plPlayerController?.isFullScreen.value ?? false;
|
||||||
|
|
||||||
|
bool get _shouldShowSeasonPanel =>
|
||||||
|
(videoIntroController.videoDetail.value.ugcSeason != null ||
|
||||||
|
((videoIntroController.videoDetail.value.pages?.length ?? 0) > 1)) &&
|
||||||
|
context.orientation == Orientation.landscape &&
|
||||||
|
videoDetailController.horizontalSeasonPanel;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -578,6 +586,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
videoIntro(),
|
videoIntro(),
|
||||||
if (videoDetailController.showReply)
|
if (videoDetailController.showReply)
|
||||||
videoReplyPanel,
|
videoReplyPanel,
|
||||||
|
if (_shouldShowSeasonPanel) seasonPanel,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -628,6 +637,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
videoIntro(),
|
videoIntro(),
|
||||||
if (videoDetailController.showReply)
|
if (videoDetailController.showReply)
|
||||||
videoReplyPanel,
|
videoReplyPanel,
|
||||||
|
if (_shouldShowSeasonPanel) seasonPanel,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -672,7 +682,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
Expanded(child: videoIntro()),
|
Expanded(child: videoIntro()),
|
||||||
if (videoDetailController.showReply)
|
if (videoDetailController.showReply)
|
||||||
Expanded(child: videoReplyPanel)
|
Expanded(child: videoReplyPanel),
|
||||||
|
if (_shouldShowSeasonPanel)
|
||||||
|
Expanded(child: seasonPanel),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@@ -715,8 +727,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
showIntro: false,
|
showIntro: false,
|
||||||
showReply: videoDetailController.showReply,
|
showReply: videoDetailController.showReply,
|
||||||
),
|
),
|
||||||
if (videoDetailController.showReply)
|
Expanded(
|
||||||
Expanded(child: videoReplyPanel),
|
child: TabBarView(
|
||||||
|
controller: videoDetailController.tabCtr,
|
||||||
|
children: [
|
||||||
|
if (videoDetailController.showReply)
|
||||||
|
videoReplyPanel,
|
||||||
|
if (_shouldShowSeasonPanel) seasonPanel,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -726,10 +746,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
// child: TabBarView(
|
// child: TabBarView(
|
||||||
// physics: const ClampingScrollPhysics(),
|
// physics: const ClampingScrollPhysics(),
|
||||||
// controller: videoDetailController.tabCtr,
|
// controller: videoDetailController.tabCtr,
|
||||||
// children: <Widget>[
|
// children: [
|
||||||
// CustomScrollView(
|
// CustomScrollView(
|
||||||
// key: const PageStorageKey<String>('简介'),
|
// key: const PageStorageKey<String>('简介'),
|
||||||
// slivers: <Widget>[
|
// slivers: [
|
||||||
// if (videoDetailController.videoType ==
|
// if (videoDetailController.videoType ==
|
||||||
// SearchType.video) ...[
|
// SearchType.video) ...[
|
||||||
// const VideoIntroPanel(),
|
// const VideoIntroPanel(),
|
||||||
@@ -817,7 +837,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
physics: const ClampingScrollPhysics(),
|
physics: const ClampingScrollPhysics(),
|
||||||
controller: videoDetailController.tabCtr,
|
controller: videoDetailController.tabCtr,
|
||||||
children: <Widget>[
|
children: [
|
||||||
if (videoDetailController.videoType ==
|
if (videoDetailController.videoType ==
|
||||||
SearchType.video &&
|
SearchType.video &&
|
||||||
videoDetailController.showRelatedVideo)
|
videoDetailController.showRelatedVideo)
|
||||||
@@ -829,9 +849,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
),
|
),
|
||||||
if (videoDetailController.showReply)
|
if (videoDetailController.showReply)
|
||||||
videoReplyPanel,
|
videoReplyPanel,
|
||||||
|
if (_shouldShowSeasonPanel) seasonPanel,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -1155,7 +1176,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
bool showIntro = true,
|
bool showIntro = true,
|
||||||
bool showReply = true,
|
bool showReply = true,
|
||||||
}) {
|
}) {
|
||||||
int length = (showIntro ? 1 : 0) + (showReply ? 1 : 0);
|
int length = (showIntro ? 1 : 0) +
|
||||||
|
(showReply ? 1 : 0) +
|
||||||
|
(_shouldShowSeasonPanel ? 1 : 0);
|
||||||
if (videoDetailController.tabCtr.length != length) {
|
if (videoDetailController.tabCtr.length != length) {
|
||||||
videoDetailController.tabCtr = TabController(length: length, vsync: this);
|
videoDetailController.tabCtr = TabController(length: length, vsync: this);
|
||||||
}
|
}
|
||||||
@@ -1198,6 +1221,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
text:
|
text:
|
||||||
'评论${_videoReplyController.count.value == -1 ? '' : ' ${_videoReplyController.count.value}'}',
|
'评论${_videoReplyController.count.value == -1 ? '' : ' ${_videoReplyController.count.value}'}',
|
||||||
),
|
),
|
||||||
|
if (_shouldShowSeasonPanel) Tab(text: '播放列表'),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1422,6 +1446,67 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget get seasonPanel => Column(
|
||||||
|
children: [
|
||||||
|
if ((videoIntroController.videoDetail.value.pages?.length ?? 0) > 1)
|
||||||
|
Obx(
|
||||||
|
() => Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||||
|
child: PagesPanel(
|
||||||
|
heroTag: heroTag,
|
||||||
|
pages: videoIntroController.videoDetail.value.pages!,
|
||||||
|
cid: videoIntroController.lastPlayCid.value,
|
||||||
|
bvid: videoIntroController.bvid,
|
||||||
|
changeFuc: videoIntroController.changeSeasonOrbangu,
|
||||||
|
showEpisodes: showEpisodes,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (videoIntroController.videoDetail.value.ugcSeason != null) ...[
|
||||||
|
if ((videoIntroController.videoDetail.value.pages?.length ?? 0) > 1)
|
||||||
|
Divider(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).colorScheme.outline.withOpacity(0.1),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
child: SeasonPanel(
|
||||||
|
heroTag: heroTag,
|
||||||
|
onTap: false,
|
||||||
|
ugcSeason: videoIntroController.videoDetail.value.ugcSeason!,
|
||||||
|
cid: videoIntroController.lastPlayCid.value != 0
|
||||||
|
? (videoIntroController
|
||||||
|
.videoDetail.value.pages?.isNotEmpty ==
|
||||||
|
true
|
||||||
|
? videoIntroController
|
||||||
|
.videoDetail.value.pages!.first.cid
|
||||||
|
: videoIntroController.lastPlayCid.value)
|
||||||
|
: videoIntroController.videoDetail.value.pages!.first.cid,
|
||||||
|
changeFuc: videoIntroController.changeSeasonOrbangu,
|
||||||
|
showEpisodes: showEpisodes,
|
||||||
|
pages: videoIntroController.videoDetail.value.pages,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Obx(
|
||||||
|
() => ListSheetContent(
|
||||||
|
index: videoDetailController.seasonIndex.value,
|
||||||
|
season: videoIntroController.videoDetail.value.ugcSeason!,
|
||||||
|
episodes: videoDetailController.episodes,
|
||||||
|
bvid: videoDetailController.bvid,
|
||||||
|
aid: IdUtils.bv2av(videoDetailController.bvid),
|
||||||
|
currentCid: videoDetailController.seasonCid,
|
||||||
|
changeFucCall: videoDetailController.videoType ==
|
||||||
|
SearchType.media_bangumi
|
||||||
|
? bangumiIntroController.changeSeasonOrbangu
|
||||||
|
: videoIntroController.changeSeasonOrbangu,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
Widget get videoReplyPanel => Obx(
|
Widget get videoReplyPanel => Obx(
|
||||||
() => VideoReplyPanel(
|
() => VideoReplyPanel(
|
||||||
bvid: videoDetailController.bvid,
|
bvid: videoDetailController.bvid,
|
||||||
|
|||||||
@@ -130,6 +130,9 @@ class GStorage {
|
|||||||
static bool get exapndIntroPanelH =>
|
static bool get exapndIntroPanelH =>
|
||||||
setting.get(SettingBoxKey.exapndIntroPanelH, defaultValue: false);
|
setting.get(SettingBoxKey.exapndIntroPanelH, defaultValue: false);
|
||||||
|
|
||||||
|
static bool get horizontalSeasonPanel =>
|
||||||
|
setting.get(SettingBoxKey.horizontalSeasonPanel, defaultValue: false);
|
||||||
|
|
||||||
static List<double> get dynamicDetailRatio =>
|
static List<double> get dynamicDetailRatio =>
|
||||||
setting.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]);
|
setting.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]);
|
||||||
|
|
||||||
@@ -328,6 +331,7 @@ class SettingBoxKey {
|
|||||||
showBangumiReply = 'showBangumiReply',
|
showBangumiReply = 'showBangumiReply',
|
||||||
alwaysExapndIntroPanel = 'alwaysExapndIntroPanel',
|
alwaysExapndIntroPanel = 'alwaysExapndIntroPanel',
|
||||||
exapndIntroPanelH = 'exapndIntroPanelH',
|
exapndIntroPanelH = 'exapndIntroPanelH',
|
||||||
|
horizontalSeasonPanel = 'horizontalSeasonPanel',
|
||||||
|
|
||||||
// Sponsor Block
|
// Sponsor Block
|
||||||
enableSponsorBlock = 'enableSponsorBlock',
|
enableSponsorBlock = 'enableSponsorBlock',
|
||||||
|
|||||||
Reference in New Issue
Block a user