fix: reverse play

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-12-31 17:02:12 +08:00
parent 273e5649c3
commit df41729d74
12 changed files with 142 additions and 125 deletions

View File

@@ -28,6 +28,7 @@ class ListSheetContent extends StatefulWidget {
this.onReverse, this.onReverse,
this.showTitle, this.showTitle,
this.isSupportReverse, this.isSupportReverse,
this.isReversed,
}); });
final dynamic index; final dynamic index;
@@ -41,6 +42,7 @@ class ListSheetContent extends StatefulWidget {
final VoidCallback? onReverse; final VoidCallback? onReverse;
final bool? showTitle; final bool? showTitle;
final bool? isSupportReverse; final bool? isSupportReverse;
final bool? isReversed;
@override @override
State<ListSheetContent> createState() => _ListSheetContentState(); State<ListSheetContent> createState() => _ListSheetContentState();
@@ -381,10 +383,10 @@ class _ListSheetContentState extends State<ListSheetContent>
stream: _indexStream?.stream, stream: _indexStream?.stream,
initialData: _index, initialData: _index,
builder: (context, snapshot) => _mediumButton( builder: (context, snapshot) => _mediumButton(
tooltip: reverse[snapshot.data] ? '' : '', tooltip: reverse[snapshot.data] ? '' : '',
icon: !reverse[snapshot.data] icon: !reverse[snapshot.data]
? MdiIcons.sortAscending ? MdiIcons.sortNumericAscending
: MdiIcons.sortDescending, : MdiIcons.sortNumericDescending,
onPressed: () { onPressed: () {
setState(() { setState(() {
reverse[_ctr?.index ?? 0] = !reverse[_ctr?.index ?? 0]; reverse[_ctr?.index ?? 0] = !reverse[_ctr?.index ?? 0];
@@ -436,8 +438,10 @@ class _ListSheetContentState extends State<ListSheetContent>
} }
Widget get _reverseButton => _mediumButton( Widget get _reverseButton => _mediumButton(
tooltip: '倒序播放', tooltip: widget.isReversed == true ? '正序播放' : '倒序播放',
icon: Icons.u_turn_right, icon: widget.isReversed == true
? MdiIcons.sortDescending
: MdiIcons.sortAscending,
onPressed: () async { onPressed: () async {
if (widget.showTitle == false) { if (widget.showTitle == false) {
// jump to current // jump to current
@@ -479,7 +483,7 @@ class _ListSheetContentState extends State<ListSheetContent>
Widget _buildBody(i, episodes) => Material( Widget _buildBody(i, episodes) => Material(
child: ScrollablePositionedList.separated( child: ScrollablePositionedList.separated(
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom + 20, bottom: MediaQuery.of(context).padding.bottom + 80,
), ),
reverse: reverse[i ?? 0], reverse: reverse[i ?? 0],
itemCount: episodes.length, itemCount: episodes.length,

View File

@@ -31,6 +31,7 @@ class MediaVideoItemModel {
this.forbidFav, this.forbidFav,
this.moreType, this.moreType,
this.businessOid, this.businessOid,
this.isReversed = false,
}); });
int? id; int? id;
@@ -64,6 +65,7 @@ class MediaVideoItemModel {
bool? forbidFav; bool? forbidFav;
int? moreType; int? moreType;
int? businessOid; int? businessOid;
bool isReversed;
factory MediaVideoItemModel.fromJson(Map<String, dynamic> json) => factory MediaVideoItemModel.fromJson(Map<String, dynamic> json) =>
MediaVideoItemModel( MediaVideoItemModel(
@@ -101,6 +103,7 @@ class MediaVideoItemModel {
forbidFav: json["forbid_fav"], forbidFav: json["forbid_fav"],
moreType: json["more_type"], moreType: json["more_type"],
businessOid: json["business_oid"], businessOid: json["business_oid"],
isReversed: false,
); );
} }

View File

@@ -69,6 +69,8 @@ class VideoDetailData {
bool? needJumpBv; bool? needJumpBv;
String? epId; String? epId;
List<Staff>? staff; List<Staff>? staff;
late bool isPageReversed;
late bool isSeasonReversed;
VideoDetailData({ VideoDetailData({
this.bvid, this.bvid,
@@ -107,6 +109,8 @@ class VideoDetailData {
this.needJumpBv, this.needJumpBv,
this.epId, this.epId,
this.staff, this.staff,
this.isPageReversed = false,
this.isSeasonReversed = false,
}); });
VideoDetailData.fromJson(Map<String, dynamic> json) { VideoDetailData.fromJson(Map<String, dynamic> json) {
@@ -163,6 +167,8 @@ class VideoDetailData {
if (json['redirect_url'] != null) { if (json['redirect_url'] != null) {
epId = resolveEpId(json['redirect_url']); epId = resolveEpId(json['redirect_url']);
} }
isPageReversed = false;
isSeasonReversed = false;
} }
String resolveEpId(url) { String resolveEpId(url) {

View File

@@ -66,7 +66,7 @@ class _FollowListState extends State<FollowList> {
if (index == list.length) { if (index == list.length) {
return Container( return Container(
height: height:
MediaQuery.of(context).padding.bottom + 60, MediaQuery.of(context).padding.bottom + 80,
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: bottom:
MediaQuery.of(context).padding.bottom), MediaQuery.of(context).padding.bottom),

View File

@@ -404,7 +404,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
SetSwitchItem( SetSwitchItem(
title: '分P/合集:倒序播放从首集开始播放', title: '分P/合集:倒序播放从首集开始播放',
subTitle: '开启则自动切换为倒序首集,否则保持当前集', subTitle: '开启则自动切换为倒序首集,否则保持当前集',
leading: const Icon(Icons.u_turn_right), leading: Icon(MdiIcons.sort),
setKey: SettingBoxKey.reverseFromFirst, setKey: SettingBoxKey.reverseFromFirst,
defaultVal: true, defaultVal: true,
), ),

View File

@@ -228,20 +228,27 @@ class _SubDetailPageState extends State<SubDetailPage> {
return Obx( return Obx(
() => subList.isEmpty () => subList.isEmpty
? const SliverToBoxAdapter(child: SizedBox()) ? const SliverToBoxAdapter(child: SizedBox())
: SliverGrid( : SliverPadding(
gridDelegate: padding: EdgeInsets.only(
SliverGridDelegateWithExtentAndRatio( bottom:
mainAxisSpacing: 2, MediaQuery.paddingOf(context).bottom + 80,
maxCrossAxisExtent: Grid.maxRowWidth * 2,
childAspectRatio: StyleString.aspectRatio * 2.2,
), ),
delegate: SliverChildBuilderDelegate( sliver: SliverGrid(
childCount: subList.length, gridDelegate:
(BuildContext context, int index) { SliverGridDelegateWithExtentAndRatio(
return SubVideoCardH( mainAxisSpacing: 2,
videoItem: subList[index], maxCrossAxisExtent: Grid.maxRowWidth * 2,
); childAspectRatio:
}, StyleString.aspectRatio * 2.2,
),
delegate: SliverChildBuilderDelegate(
childCount: subList.length,
(BuildContext context, int index) {
return SubVideoCardH(
videoItem: subList[index],
);
},
),
), ),
), ),
); );
@@ -271,25 +278,6 @@ class _SubDetailPageState extends State<SubDetailPage> {
} }
}, },
), ),
SliverToBoxAdapter(
child: Container(
height: MediaQuery.of(context).padding.bottom + 60,
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom,
),
child: Center(
child: Obx(
() => Text(
_subDetailController.loadingText.value,
style: TextStyle(
color: Theme.of(context).colorScheme.outline,
fontSize: 13,
),
),
),
),
),
)
], ],
), ),
); );

View File

@@ -222,7 +222,7 @@ class VideoDetailController extends GetxController
videoType == SearchType.video ? _showVideoReply : _showBangumiReply; videoType == SearchType.video ? _showVideoReply : _showBangumiReply;
late final horizontalSeasonPanel = GStorage.horizontalSeasonPanel; late final horizontalSeasonPanel = GStorage.horizontalSeasonPanel;
late int seasonCid = 0; int? seasonCid;
late RxInt seasonIndex = 0.obs; late RxInt seasonIndex = 0.obs;
late final reverseFromFirst = GStorage.reverseFromFirst; late final reverseFromFirst = GStorage.reverseFromFirst;

View File

@@ -133,10 +133,12 @@ class VideoIntroController extends GetxController
if (videoDetail.value.ugcSeason?.id == result['data']?.ugcSeason?.id) { if (videoDetail.value.ugcSeason?.id == result['data']?.ugcSeason?.id) {
// keep reversed season // keep reversed season
result['data']?.ugcSeason = videoDetail.value.ugcSeason; result['data']?.ugcSeason = videoDetail.value.ugcSeason;
result['data']?.isSeasonReversed = videoDetail.value.isSeasonReversed;
} }
if (videoDetail.value.cid == result['data']?.cid) { if (videoDetail.value.cid == result['data']?.cid) {
// keep reversed pages // keep reversed pages
result['data']?.pages = videoDetail.value.pages; result['data']?.pages = videoDetail.value.pages;
result['data']?.isPageReversed = videoDetail.value.isPageReversed;
} }
videoDetail.value = result['data']; videoDetail.value = result['data'];
videoItem!['staff'] = result['data'].staff; videoItem!['staff'] = result['data'].staff;

View File

@@ -82,6 +82,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
onShowMemberPage: widget.onShowMemberPage, onShowMemberPage: widget.onShowMemberPage,
) )
: VideoInfo( : VideoInfo(
key: ValueKey(widget.heroTag),
loadingStatus: false, loadingStatus: false,
videoIntroController: videoIntroController, videoIntroController: videoIntroController,
heroTag: widget.heroTag, heroTag: widget.heroTag,
@@ -109,12 +110,12 @@ class VideoInfo extends StatefulWidget {
const VideoInfo({ const VideoInfo({
super.key, super.key,
this.loadingStatus = false, this.loadingStatus = false,
required this.videoIntroController,
required this.heroTag, required this.heroTag,
required this.showAiBottomSheet, required this.showAiBottomSheet,
required this.showIntroDetail, required this.showIntroDetail,
required this.showEpisodes, required this.showEpisodes,
required this.onShowMemberPage, required this.onShowMemberPage,
required this.videoIntroController,
}); });
@override @override
@@ -642,10 +643,9 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
), ),
), ),
), ),
const SizedBox(height: 8),
Obx( Obx(
() => videoIntroController.queryVideoIntroData.value["status"] () => videoIntroController.queryVideoIntroData.value["status"]
? const SizedBox() ? const SizedBox.shrink()
: Center( : Center(
child: TextButton.icon( child: TextButton.icon(
icon: const Icon(Icons.refresh), icon: const Icon(Icons.refresh),
@@ -676,19 +676,13 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
(context.orientation != Orientation.landscape || (context.orientation != Orientation.landscape ||
(context.orientation == Orientation.landscape && (context.orientation == Orientation.landscape &&
videoDetailCtr.horizontalSeasonPanel.not))) videoDetailCtr.horizontalSeasonPanel.not)))
Obx( SeasonPanel(
() => SeasonPanel( heroTag: widget.heroTag,
heroTag: widget.heroTag, ugcSeason: videoDetail.ugcSeason!,
ugcSeason: videoDetail.ugcSeason!, changeFuc: videoIntroController.changeSeasonOrbangu,
cid: videoIntroController.lastPlayCid.value != 0 showEpisodes: widget.showEpisodes,
? (videoDetail.pages?.isNotEmpty == true pages: videoDetail.pages,
? videoDetail.pages!.first.cid videoIntroController: videoIntroController,
: videoIntroController.lastPlayCid.value)
: videoDetail.pages!.first.cid,
changeFuc: videoIntroController.changeSeasonOrbangu,
showEpisodes: widget.showEpisodes,
pages: videoDetail.pages,
),
), ),
if (!widget.loadingStatus && if (!widget.loadingStatus &&
videoDetail.pages != null && videoDetail.pages != null &&
@@ -696,15 +690,12 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
(context.orientation != Orientation.landscape || (context.orientation != Orientation.landscape ||
(context.orientation == Orientation.landscape && (context.orientation == Orientation.landscape &&
videoDetailCtr.horizontalSeasonPanel.not))) ...[ videoDetailCtr.horizontalSeasonPanel.not))) ...[
Obx( PagesPanel(
() => PagesPanel( heroTag: widget.heroTag,
heroTag: widget.heroTag, videoIntroController: videoIntroController,
videoDetailData: videoIntroController.videoDetail.value, bvid: videoIntroController.bvid,
cid: videoIntroController.lastPlayCid.value, changeFuc: videoIntroController.changeSeasonOrbangu,
bvid: videoIntroController.bvid, showEpisodes: widget.showEpisodes,
changeFuc: videoIntroController.changeSeasonOrbangu,
showEpisodes: widget.showEpisodes,
),
), ),
], ],
], ],

View File

@@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:math'; import 'dart:math';
import 'package:PiliPalaX/pages/video/detail/introduction/controller.dart';
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';
@@ -11,19 +12,17 @@ import '../../../../../utils/id_utils.dart';
class PagesPanel extends StatefulWidget { class PagesPanel extends StatefulWidget {
const PagesPanel({ const PagesPanel({
super.key, super.key,
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,
required this.videoDetailData, required this.videoIntroController,
}); });
final int cid;
final String bvid; final String bvid;
final Function changeFuc; final Function changeFuc;
final String heroTag; final String heroTag;
final Function showEpisodes; final Function showEpisodes;
final VideoDetailData videoDetailData; final VideoIntroController videoIntroController;
@override @override
State<PagesPanel> createState() => _PagesPanelState(); State<PagesPanel> createState() => _PagesPanelState();
@@ -36,19 +35,20 @@ class _PagesPanelState extends State<PagesPanel> {
final ScrollController _scrollController = ScrollController(); final ScrollController _scrollController = ScrollController();
StreamSubscription? _listener; StreamSubscription? _listener;
List<Part> get pages => widget.videoIntroController.videoDetail.value.pages!;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
cid = widget.cid; cid = widget.videoIntroController.lastPlayCid.value;
_videoDetailController = _videoDetailController =
Get.find<VideoDetailController>(tag: widget.heroTag); Get.find<VideoDetailController>(tag: widget.heroTag);
pageIndex = pageIndex = pages.indexWhere((Part e) => e.cid == cid);
widget.videoDetailData.pages!.indexWhere((Part e) => e.cid == cid);
_listener = _videoDetailController.cid.listen((int cid) { _listener = _videoDetailController.cid.listen((int cid) {
this.cid = cid; this.cid = cid;
pageIndex = max(0, pageIndex = max(0, pages.indexWhere((Part e) => e.cid == cid));
widget.videoDetailData.pages!.indexWhere((Part e) => e.cid == cid));
if (!mounted) return; if (!mounted) return;
setState(() {});
const double itemWidth = 150; // 每个列表项的宽度 const double itemWidth = 150; // 每个列表项的宽度
final double targetOffset = min((pageIndex * itemWidth) - (itemWidth / 2), final double targetOffset = min((pageIndex * itemWidth) - (itemWidth / 2),
_scrollController.position.maxScrollExtent); _scrollController.position.maxScrollExtent);
@@ -73,14 +73,14 @@ class _PagesPanelState extends State<PagesPanel> {
return Column( return Column(
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: const EdgeInsets.only(top: 10, bottom: 2), padding: const EdgeInsets.only(top: 8, bottom: 2),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const Text('视频选集 '), const Text('视频选集 '),
Expanded( Expanded(
child: Text( child: Text(
' 正在播放:${widget.videoDetailData.pages![pageIndex].pagePart}', ' 正在播放:${pages[pageIndex].pagePart}',
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
@@ -98,13 +98,13 @@ class _PagesPanelState extends State<PagesPanel> {
onPressed: () => widget.showEpisodes( onPressed: () => widget.showEpisodes(
null, null,
null, null,
widget.videoDetailData.pages!, pages,
widget.bvid, widget.bvid,
IdUtils.bv2av(widget.bvid), IdUtils.bv2av(widget.bvid),
cid, cid,
), ),
child: Text( child: Text(
'${widget.videoDetailData.pages!.length}', '${pages.length}',
style: const TextStyle(fontSize: 13), style: const TextStyle(fontSize: 13),
), ),
), ),
@@ -112,20 +112,19 @@ class _PagesPanelState extends State<PagesPanel> {
], ],
), ),
), ),
Container( SizedBox(
height: 35, height: 35,
margin: const EdgeInsets.only(bottom: 8),
child: ListView.builder( child: ListView.builder(
controller: _scrollController, controller: _scrollController,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: widget.videoDetailData.pages!.length, itemCount: pages.length,
itemExtent: 150, itemExtent: 150,
itemBuilder: (BuildContext context, int i) { itemBuilder: (BuildContext context, int i) {
bool isCurrentIndex = pageIndex == i; bool isCurrentIndex = pageIndex == i;
return Container( return Container(
width: 150, width: 150,
margin: EdgeInsets.only( margin: EdgeInsets.only(
right: i != widget.videoDetailData.pages!.length - 1 ? 10 : 0, right: i != pages.length - 1 ? 10 : 0,
), ),
child: Material( child: Material(
color: Theme.of(context).colorScheme.onInverseSurface, color: Theme.of(context).colorScheme.onInverseSurface,
@@ -136,7 +135,7 @@ class _PagesPanelState extends State<PagesPanel> {
widget.changeFuc( widget.changeFuc(
null, null,
widget.bvid, widget.bvid,
widget.videoDetailData.pages![i].cid, pages[i].cid,
IdUtils.bv2av(widget.bvid), IdUtils.bv2av(widget.bvid),
null, null,
) )
@@ -157,7 +156,7 @@ class _PagesPanelState extends State<PagesPanel> {
], ],
Expanded( Expanded(
child: Text( child: Text(
widget.videoDetailData.pages![i].pagePart!, pages[i].pagePart!,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,

View File

@@ -1,5 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:PiliPalaX/pages/video/detail/introduction/controller.dart';
import 'package:PiliPalaX/utils/extension.dart';
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';
@@ -9,20 +11,20 @@ class SeasonPanel extends StatefulWidget {
const SeasonPanel({ const SeasonPanel({
super.key, super.key,
required this.ugcSeason, required this.ugcSeason,
this.cid,
required this.changeFuc, required this.changeFuc,
required this.heroTag, required this.heroTag,
required this.showEpisodes, required this.showEpisodes,
required this.pages, required this.pages,
this.onTap, this.onTap,
required this.videoIntroController,
}); });
final UgcSeason ugcSeason; final UgcSeason ugcSeason;
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; final List<Part>? pages;
final bool? onTap; final bool? onTap;
final VideoIntroController videoIntroController;
@override @override
State<SeasonPanel> createState() => _SeasonPanelState(); State<SeasonPanel> createState() => _SeasonPanelState();
@@ -34,12 +36,26 @@ class _SeasonPanelState extends State<SeasonPanel> {
StreamSubscription? _listener; StreamSubscription? _listener;
List<EpisodeItem> episodes = <EpisodeItem>[]; List<EpisodeItem> episodes = <EpisodeItem>[];
VideoIntroController get videoIntroController => widget.videoIntroController;
VideoDetailData get videoDetail =>
widget.videoIntroController.videoDetail.value;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_videoDetailController = _videoDetailController =
Get.find<VideoDetailController>(tag: widget.heroTag) Get.find<VideoDetailController>(tag: widget.heroTag);
..seasonCid = widget.cid!;
_videoDetailController.seasonCid =
videoIntroController.lastPlayCid.value != 0
? (videoDetail.pages?.isNotEmpty == true
? videoDetail.isPageReversed
? videoDetail.pages!.last.cid
: videoDetail.pages!.first.cid
: videoIntroController.lastPlayCid.value)
: videoDetail.isPageReversed
? videoDetail.pages!.last.cid
: videoDetail.pages!.first.cid;
/// 根据 cid 找到对应集,找到对应 episodes /// 根据 cid 找到对应集,找到对应 episodes
/// 有多个episodes时只显示其中一个 /// 有多个episodes时只显示其中一个
@@ -55,16 +71,12 @@ class _SeasonPanelState extends State<SeasonPanel> {
currentIndex.value = episodes.indexWhere( currentIndex.value = episodes.indexWhere(
(EpisodeItem e) => e.cid == _videoDetailController.seasonCid); (EpisodeItem e) => e.cid == _videoDetailController.seasonCid);
_listener = _videoDetailController.cid.listen((int cid) { _listener = _videoDetailController.cid.listen((int cid) {
if (_videoDetailController.seasonCid == cid) { if (_videoDetailController.seasonCid != cid) {
//refresh bool isPart = widget.pages?.indexWhere((item) => item.cid == cid) != -1;
_findEpisode(); if (isPart.not) {
currentIndex.value = episodes.indexWhere( _videoDetailController.seasonCid = cid;
(EpisodeItem e) => e.cid == _videoDetailController.seasonCid); }
return;
} }
bool isPart = widget.pages?.indexWhere((item) => item.cid == cid) != -1;
if (isPart) return;
_videoDetailController.seasonCid = cid;
_findEpisode(); _findEpisode();
currentIndex.value = episodes.indexWhere( currentIndex.value = episodes.indexWhere(
(EpisodeItem e) => e.cid == _videoDetailController.seasonCid); (EpisodeItem e) => e.cid == _videoDetailController.seasonCid);
@@ -99,7 +111,6 @@ class _SeasonPanelState extends State<SeasonPanel> {
top: 8, top: 8,
left: 2, left: 2,
right: 2, right: 2,
bottom: 2,
), ),
child: Material( child: Material(
color: Theme.of(context).colorScheme.onInverseSurface, color: Theme.of(context).colorScheme.onInverseSurface,

View File

@@ -1375,9 +1375,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
if (needRelated && videoDetailController.showRelatedVideo) ...[ if (needRelated && videoDetailController.showRelatedVideo) ...[
SliverToBoxAdapter( SliverToBoxAdapter(
child: Padding( child: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(top: StyleString.safeSpace),
top: StyleString.safeSpace,
),
child: Divider( child: Divider(
height: 1, height: 1,
indent: 12, indent: 12,
@@ -1387,7 +1385,13 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
), ),
RelatedVideoPanel(heroTag: heroTag), RelatedVideoPanel(heroTag: heroTag),
], ] else
SliverToBoxAdapter(
child: SizedBox(
height: MediaQuery.paddingOf(context).bottom +
StyleString.safeSpace,
),
),
] else if (videoDetailController.videoType == ] else if (videoDetailController.videoType ==
SearchType.media_bangumi) SearchType.media_bangumi)
Obx( Obx(
@@ -1465,42 +1469,35 @@ class _VideoDetailPageState extends State<VideoDetailPage>
Widget get seasonPanel => Column( Widget get seasonPanel => Column(
children: [ children: [
if ((videoIntroController.videoDetail.value.pages?.length ?? 0) > 1) if ((videoIntroController.videoDetail.value.pages?.length ?? 0) > 1)
Obx( Padding(
() => Padding( padding: const EdgeInsets.symmetric(horizontal: 14),
padding: const EdgeInsets.symmetric(horizontal: 14), child: PagesPanel(
child: PagesPanel( heroTag: heroTag,
heroTag: heroTag, videoIntroController: videoIntroController,
videoDetailData: videoIntroController.videoDetail.value, bvid: videoIntroController.bvid,
cid: videoIntroController.lastPlayCid.value, changeFuc: videoIntroController.changeSeasonOrbangu,
bvid: videoIntroController.bvid, showEpisodes: showEpisodes,
changeFuc: videoIntroController.changeSeasonOrbangu,
showEpisodes: showEpisodes,
),
), ),
), ),
if (videoIntroController.videoDetail.value.ugcSeason != null) ...[ if (videoIntroController.videoDetail.value.ugcSeason != null) ...[
if ((videoIntroController.videoDetail.value.pages?.length ?? 0) > 1) if ((videoIntroController.videoDetail.value.pages?.length ?? 0) >
1) ...[
const SizedBox(height: 8),
Divider( Divider(
height: 1, height: 1,
color: Theme.of(context).colorScheme.outline.withOpacity(0.1), color: Theme.of(context).colorScheme.outline.withOpacity(0.1),
), ),
],
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
child: SeasonPanel( child: SeasonPanel(
heroTag: heroTag, heroTag: heroTag,
onTap: false, onTap: false,
ugcSeason: videoIntroController.videoDetail.value.ugcSeason!, 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, changeFuc: videoIntroController.changeSeasonOrbangu,
showEpisodes: showEpisodes, showEpisodes: showEpisodes,
pages: videoIntroController.videoDetail.value.pages, pages: videoIntroController.videoDetail.value.pages,
videoIntroController: videoIntroController,
), ),
), ),
Expanded( Expanded(
@@ -1510,7 +1507,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
season: videoIntroController.videoDetail.value.ugcSeason, season: videoIntroController.videoDetail.value.ugcSeason,
bvid: videoDetailController.bvid, bvid: videoDetailController.bvid,
aid: IdUtils.bv2av(videoDetailController.bvid), aid: IdUtils.bv2av(videoDetailController.bvid),
currentCid: videoDetailController.seasonCid, currentCid: videoDetailController.seasonCid ?? 0,
isReversed:
videoIntroController.videoDetail.value.isSeasonReversed,
changeFucCall: videoDetailController.videoType == changeFucCall: videoDetailController.videoType ==
SearchType.media_bangumi SearchType.media_bangumi
? bangumiIntroController.changeSeasonOrbangu ? bangumiIntroController.changeSeasonOrbangu
@@ -1595,6 +1594,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
aid: aid, aid: aid,
currentCid: cid, currentCid: cid,
episodes: episodes, episodes: episodes,
isReversed:
videoDetailController.videoType == SearchType.media_bangumi
? null
: season != null
? videoIntroController.videoDetail.value.isSeasonReversed
: videoIntroController.videoDetail.value.isPageReversed,
isSupportReverse: isSupportReverse:
videoDetailController.videoType != SearchType.media_bangumi, videoDetailController.videoType != SearchType.media_bangumi,
changeFucCall: changeFucCall:
@@ -1651,6 +1656,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
if (isSeason) { if (isSeason) {
// reverse season // reverse season
videoIntroController.videoDetail.value.isSeasonReversed =
!videoIntroController.videoDetail.value.isSeasonReversed;
videoIntroController.videoDetail.value.ugcSeason! videoIntroController.videoDetail.value.ugcSeason!
.sections![videoDetailController.seasonIndex.value].episodes = .sections![videoDetailController.seasonIndex.value].episodes =
videoIntroController videoIntroController
@@ -1672,13 +1679,17 @@ class _VideoDetailPageState extends State<VideoDetailPage>
.sections![videoDetailController.seasonIndex.value].episodes!.first; .sections![videoDetailController.seasonIndex.value].episodes!.first;
if (episode.cid != videoDetailController.cid.value) { if (episode.cid != videoDetailController.cid.value) {
changeEpisode(episode); changeEpisode(episode);
} else {
videoDetailController.seasonIndex.refresh();
videoDetailController.cid.refresh();
} }
} }
} else { } else {
// reverse part // reverse part
videoIntroController.videoDetail.value.isPageReversed =
!videoIntroController.videoDetail.value.isPageReversed;
videoIntroController.videoDetail.value.pages = videoIntroController.videoDetail.value.pages =
videoIntroController.videoDetail.value.pages!.reversed.toList(); videoIntroController.videoDetail.value.pages!.reversed.toList();
videoIntroController.lastPlayCid.refresh();
if (videoDetailController.reverseFromFirst.not) { if (videoDetailController.reverseFromFirst.not) {
// keep current episode // keep current episode
videoDetailController.cid.refresh(); videoDetailController.cid.refresh();
@@ -1687,6 +1698,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
dynamic episode = videoIntroController.videoDetail.value.pages!.first; dynamic episode = videoIntroController.videoDetail.value.pages!.first;
if (episode.cid != videoDetailController.cid.value) { if (episode.cid != videoDetailController.cid.value) {
changeEpisode(episode); changeEpisode(episode);
} else {
videoDetailController.cid.refresh();
} }
} }
} }