opt: switch btn

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-23 23:18:41 +08:00
parent d2c34d64c3
commit 8ddf42fff1
7 changed files with 143 additions and 152 deletions

View File

@@ -142,7 +142,7 @@ class _ListSheetContentState extends CommonSlidePageState<ListSheetContent>
}();
}
WidgetsBinding.instance.addPostFrameCallback((_) {
if (enableSlide && GStorage.collapsibleVideoPage) {
if (GStorage.collapsibleVideoPage) {
if (mounted) {
setState(() {
_isInit = false;
@@ -295,7 +295,7 @@ class _ListSheetContentState extends CommonSlidePageState<ListSheetContent>
@override
Widget build(BuildContext context) {
if (enableSlide && GStorage.collapsibleVideoPage && _isInit) {
if (GStorage.collapsibleVideoPage && _isInit) {
return CustomScrollView(
physics: const NeverScrollableScrollPhysics(),
);

View File

@@ -13,7 +13,7 @@ abstract class CommonCollapseSlidePageState<T extends CommonCollapseSlidePage>
@override
void initState() {
super.initState();
if (enableSlide && GStorage.collapsibleVideoPage) {
if (GStorage.collapsibleVideoPage) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
setState(() {
@@ -26,7 +26,7 @@ abstract class CommonCollapseSlidePageState<T extends CommonCollapseSlidePage>
@override
Widget build(BuildContext context) {
if (enableSlide && GStorage.collapsibleVideoPage && _isInit) {
if (GStorage.collapsibleVideoPage && _isInit) {
return CustomScrollView(
physics: const NeverScrollableScrollPhysics(),
);

View File

@@ -20,8 +20,6 @@ import 'package:PiliPlus/pages/search/widgets/search_text.dart';
import 'package:PiliPlus/pages/video/detail/introduction/controller.dart';
import 'package:PiliPlus/pages/video/detail/note/note_list_page.dart';
import 'package:PiliPlus/pages/video/detail/post_panel/post_panel.dart';
import 'package:PiliPlus/pages/video/detail/related/controller.dart';
import 'package:PiliPlus/pages/video/detail/reply/controller.dart';
import 'package:PiliPlus/pages/video/detail/widgets/send_danmaku_panel.dart';
import 'package:PiliPlus/pages/video/detail/widgets/media_list_panel.dart';
import 'package:PiliPlus/utils/extension.dart';
@@ -388,92 +386,77 @@ class VideoDetailController extends GetxController
// 稍后再看面板展开
showMediaListPanel(context) {
if (mediaList.isNotEmpty) {
childKey.currentState?.showBottomSheet(
backgroundColor: Colors.transparent,
(context) => MediaListPanel(
mediaList: mediaList,
changeMediaList: (bvid, cid, aid, cover) {
try {
Get.find<VideoIntroController>(tag: heroTag)
.changeSeasonOrbangu(null, bvid, cid, aid, cover);
} catch (_) {}
},
panelTitle: watchLaterTitle,
getBvId: () => bvid,
count: Get.arguments['count'],
loadMoreMedia: getMediaList,
desc: _mediaDesc,
onReverse: () {
_mediaDesc = !_mediaDesc;
getMediaList(isReverse: true);
},
loadPrevious: Get.arguments['isContinuePlaying'] == true
? () {
getMediaList(isLoadPrevious: true);
}
: null,
onDelete: sourceType == 'watchLater' ||
(sourceType == 'fav' && Get.arguments?['isOwner'] == true)
? (index) async {
if (sourceType == 'watchLater') {
var res = await UserHttp.toViewDel(
aids: [mediaList[index].aid],
);
if (res['status']) {
mediaList.removeAt(index);
}
SmartDialog.showToast(res['msg']);
} else {
final item = mediaList[index];
var res = await VideoHttp.delFav(
ids: ['${item.aid}:${item.type}'],
delIds: '${Get.arguments?['mediaId']}',
);
if (res['status']) {
mediaList.removeAt(index);
SmartDialog.showToast('取消收藏');
} else {
Widget panel() => MediaListPanel(
mediaList: mediaList,
changeMediaList: (bvid, cid, aid, cover) {
try {
Get.find<VideoIntroController>(tag: heroTag)
.changeSeasonOrbangu(null, bvid, cid, aid, cover);
} catch (_) {}
},
panelTitle: watchLaterTitle,
getBvId: () => bvid,
count: Get.arguments['count'],
loadMoreMedia: getMediaList,
desc: _mediaDesc,
onReverse: () {
_mediaDesc = !_mediaDesc;
getMediaList(isReverse: true);
},
loadPrevious: Get.arguments['isContinuePlaying'] == true
? () {
getMediaList(isLoadPrevious: true);
}
: null,
onDelete: sourceType == 'watchLater' ||
(sourceType == 'fav' && Get.arguments?['isOwner'] == true)
? (index) async {
if (sourceType == 'watchLater') {
var res = await UserHttp.toViewDel(
aids: [mediaList[index].aid],
);
if (res['status']) {
mediaList.removeAt(index);
}
SmartDialog.showToast(res['msg']);
} else {
final item = mediaList[index];
var res = await VideoHttp.delFav(
ids: ['${item.aid}:${item.type}'],
delIds: '${Get.arguments?['mediaId']}',
);
if (res['status']) {
mediaList.removeAt(index);
SmartDialog.showToast('取消收藏');
} else {
SmartDialog.showToast(res['msg']);
}
}
}
}
: null,
),
);
: null,
);
if (plPlayerController.isFullScreen.value) {
Utils.showFSSheet(
context,
child: plPlayerController.darkVideoPage && MyApp.darkThemeData != null
? Theme(
data: MyApp.darkThemeData!,
child: panel(),
)
: panel(),
isFullScreen: () => plPlayerController.isFullScreen.value,
);
} else {
childKey.currentState?.showBottomSheet(
backgroundColor: Colors.transparent,
(context) => panel(),
);
}
} else {
getMediaList();
}
}
// 切换稍后再看
Future changeMediaList(bvid, cid, aid, cover) async {
try {
this.bvid = bvid;
oid.value = aid ?? IdUtils.bv2av(bvid);
this.cid.value = cid;
danmakuCid.value = cid;
videoItem['pic'] = cover;
queryVideoUrl();
if (showReply) {
Get.find<VideoReplyController>(tag: heroTag)
..aid = aid
..onRefresh();
}
Get.find<VideoIntroController>(tag: heroTag)
..lastPlayCid.value = cid
..bvid = bvid
..queryVideoIntro();
if (showRelatedVideo) {
Get.find<RelatedController>(tag: heroTag)
..bvid = bvid
..onRefresh();
}
} catch (_) {}
}
int? _lastPos;
double? _blockLimit;
List<Pair<SegmentType, SkipType>>? _blockSettings;

View File

@@ -1782,7 +1782,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
);
}
showEpisodes(index, season, episodes, bvid, aid, cid) {
showEpisodes([index, season, episodes, bvid, aid, cid]) {
if (bvid == null) {
videoDetailController.showMediaListPanel(context);
return;
}
Widget listSheetContent([bool? enableSlide]) => ListSheetContent(
enableSlide: enableSlide,
index: index,

View File

@@ -2185,7 +2185,11 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
);
}
showEpisodes(index, season, episodes, bvid, aid, cid) {
showEpisodes([index, season, episodes, bvid, aid, cid]) {
if (bvid == null) {
videoDetailController.showMediaListPanel(context);
return;
}
Widget listSheetContent([bool? enableSlide]) => ListSheetContent(
enableSlide: enableSlide,
index: index,

View File

@@ -262,10 +262,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
bool isPage = videoIntroController?.videoDetail.value.pages != null &&
videoIntroController!.videoDetail.value.pages!.length > 1;
bool isBangumi = bangumiIntroController?.loadingState.value is Success;
bool anySeason = isSeason ||
isPage ||
isBangumi ||
widget.videoDetailController?.isPlayAll == true;
bool anySeason = isSeason || isPage || isBangumi;
double widgetWidth =
isFullScreen && context.orientation == Orientation.landscape ? 42 : 35;
Map<BottomControlType, Widget> videoProgressWidgets = {
@@ -478,16 +475,18 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
color: Colors.white,
),
onTap: () {
if (anySeason.not) {
widget.showEpisodes?.call();
return;
}
int? index;
int currentCid = plPlayerController.cid;
String bvid = plPlayerController.bvid;
List episodes = [];
// late Function changeFucCall;
if (isPage) {
final List<Part> pages =
videoIntroController!.videoDetail.value.pages!;
episodes = pages;
// changeFucCall = videoIntroController!.changeSeasonOrbangu;
} else if (isSeason) {
final List<SectionItem> sections =
videoIntroController!.videoDetail.value.ugcSeason!.sections!;
@@ -501,12 +500,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
}
}
}
// changeFucCall = videoIntroController!.changeSeasonOrbangu;
} else if (isBangumi) {
episodes = (bangumiIntroController!.loadingState.value as Success)
.response
.episodes!;
// changeFucCall = bangumiIntroController!.changeSeasonOrbangu;
}
widget.showEpisodes?.call(
index,
@@ -651,15 +648,18 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
List<BottomControlType> userSpecifyItemLeft = [
BottomControlType.playOrPause,
BottomControlType.time,
if (anySeason) BottomControlType.pre,
if (anySeason) BottomControlType.next,
if (anySeason || widget.videoDetailController?.isPlayAll == true) ...[
BottomControlType.pre,
BottomControlType.next,
],
];
List<BottomControlType> userSpecifyItemRight = [
BottomControlType.dmChart,
BottomControlType.superResolution,
BottomControlType.viewPoints,
if (anySeason) BottomControlType.episode,
if (anySeason || widget.videoDetailController?.isPlayAll == true)
BottomControlType.episode,
if (isFullScreen) BottomControlType.fit,
BottomControlType.subtitle,
BottomControlType.speed,

View File

@@ -41,7 +41,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:get/get_navigation/src/dialog/dialog_route.dart';
import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:html/dom.dart' as dom;
@@ -277,62 +276,63 @@ class Utils {
required Function isFullScreen,
double? padding,
}) {
Navigator.of(context).push(
GetDialogRoute(
pageBuilder: (buildContext, animation, secondaryAnimation) {
return MediaQuery.orientationOf(Get.context!) == Orientation.portrait
? SafeArea(
child: Column(
children: [
const Spacer(flex: 3),
Expanded(
flex: 7,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
removeBottom: true,
removeLeft: true,
removeRight: true,
child: child,
),
Get.generalDialog(
barrierLabel: '',
barrierDismissible: true,
pageBuilder: (buildContext, animation, secondaryAnimation) {
return MediaQuery.orientationOf(Get.context!) == Orientation.portrait
? SafeArea(
child: Column(
children: [
const Spacer(flex: 3),
Expanded(
flex: 7,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
removeBottom: true,
removeLeft: true,
removeRight: true,
child: child,
),
if (isFullScreen() && padding != null)
SizedBox(height: padding),
],
),
)
: SafeArea(
child: Row(
children: [
const Spacer(),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: true,
removeBottom: true,
removeLeft: true,
removeRight: true,
child: child,
),
),
if (isFullScreen() && padding != null)
SizedBox(height: padding),
],
),
)
: SafeArea(
child: Row(
children: [
const Spacer(),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: true,
removeBottom: true,
removeLeft: true,
removeRight: true,
child: child,
),
],
),
);
},
transitionDuration: const Duration(milliseconds: 350),
transitionBuilder: (context, animation, secondaryAnimation, child) {
Offset begin =
MediaQuery.orientationOf(Get.context!) == Orientation.portrait
? Offset(0.0, 1.0)
: Offset(1.0, 0.0);
var tween = Tween(begin: begin, end: Offset.zero)
.chain(CurveTween(curve: Curves.easeInOut));
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
),
),
],
),
);
},
transitionDuration: const Duration(milliseconds: 350),
transitionBuilder: (context, animation, secondaryAnimation, child) {
Offset begin =
MediaQuery.orientationOf(Get.context!) == Orientation.portrait
? Offset(0.0, 1.0)
: Offset(1.0, 0.0);
var tween = Tween(begin: begin, end: Offset.zero)
.chain(CurveTween(curve: Curves.easeInOut));
return SlideTransition(
position: animation.drive(tween),
child: child,
);
},
routeSettings: RouteSettings(arguments: Get.arguments),
);
}