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

View File

@@ -13,7 +13,7 @@ abstract class CommonCollapseSlidePageState<T extends CommonCollapseSlidePage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (enableSlide && GStorage.collapsibleVideoPage) { if (GStorage.collapsibleVideoPage) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) { if (mounted) {
setState(() { setState(() {
@@ -26,7 +26,7 @@ abstract class CommonCollapseSlidePageState<T extends CommonCollapseSlidePage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (enableSlide && GStorage.collapsibleVideoPage && _isInit) { if (GStorage.collapsibleVideoPage && _isInit) {
return CustomScrollView( return CustomScrollView(
physics: const NeverScrollableScrollPhysics(), 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/introduction/controller.dart';
import 'package:PiliPlus/pages/video/detail/note/note_list_page.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/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/send_danmaku_panel.dart';
import 'package:PiliPlus/pages/video/detail/widgets/media_list_panel.dart'; import 'package:PiliPlus/pages/video/detail/widgets/media_list_panel.dart';
import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/extension.dart';
@@ -388,92 +386,77 @@ class VideoDetailController extends GetxController
// 稍后再看面板展开 // 稍后再看面板展开
showMediaListPanel(context) { showMediaListPanel(context) {
if (mediaList.isNotEmpty) { if (mediaList.isNotEmpty) {
childKey.currentState?.showBottomSheet( Widget panel() => MediaListPanel(
backgroundColor: Colors.transparent, mediaList: mediaList,
(context) => MediaListPanel( changeMediaList: (bvid, cid, aid, cover) {
mediaList: mediaList, try {
changeMediaList: (bvid, cid, aid, cover) { Get.find<VideoIntroController>(tag: heroTag)
try { .changeSeasonOrbangu(null, bvid, cid, aid, cover);
Get.find<VideoIntroController>(tag: heroTag) } catch (_) {}
.changeSeasonOrbangu(null, bvid, cid, aid, cover); },
} catch (_) {} panelTitle: watchLaterTitle,
}, getBvId: () => bvid,
panelTitle: watchLaterTitle, count: Get.arguments['count'],
getBvId: () => bvid, loadMoreMedia: getMediaList,
count: Get.arguments['count'], desc: _mediaDesc,
loadMoreMedia: getMediaList, onReverse: () {
desc: _mediaDesc, _mediaDesc = !_mediaDesc;
onReverse: () { getMediaList(isReverse: true);
_mediaDesc = !_mediaDesc; },
getMediaList(isReverse: true); loadPrevious: Get.arguments['isContinuePlaying'] == true
}, ? () {
loadPrevious: Get.arguments['isContinuePlaying'] == true getMediaList(isLoadPrevious: true);
? () { }
getMediaList(isLoadPrevious: true); : null,
} onDelete: sourceType == 'watchLater' ||
: null, (sourceType == 'fav' && Get.arguments?['isOwner'] == true)
onDelete: sourceType == 'watchLater' || ? (index) async {
(sourceType == 'fav' && Get.arguments?['isOwner'] == true) if (sourceType == 'watchLater') {
? (index) async { var res = await UserHttp.toViewDel(
if (sourceType == 'watchLater') { aids: [mediaList[index].aid],
var res = await UserHttp.toViewDel( );
aids: [mediaList[index].aid], if (res['status']) {
); mediaList.removeAt(index);
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']); 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 { } else {
getMediaList(); 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; int? _lastPos;
double? _blockLimit; double? _blockLimit;
List<Pair<SegmentType, SkipType>>? _blockSettings; 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( Widget listSheetContent([bool? enableSlide]) => ListSheetContent(
enableSlide: enableSlide, enableSlide: enableSlide,
index: index, 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( Widget listSheetContent([bool? enableSlide]) => ListSheetContent(
enableSlide: enableSlide, enableSlide: enableSlide,
index: index, index: index,

View File

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

View File

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