mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
opt video page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -487,13 +487,16 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}
|
||||
}
|
||||
|
||||
Widget get childWhenDisabled => SafeArea(
|
||||
top: !removeSafeArea &&
|
||||
MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||
isFullScreen,
|
||||
bottom: !removeSafeArea &&
|
||||
MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||
isFullScreen,
|
||||
Widget get childWhenDisabled {
|
||||
final isPortrait =
|
||||
MediaQuery.orientationOf(context) == Orientation.portrait;
|
||||
final useSafeArea = !removeSafeArea && isPortrait && isFullScreen;
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
final double width = size.width;
|
||||
final double height = size.height;
|
||||
return SafeArea(
|
||||
top: useSafeArea,
|
||||
bottom: useSafeArea,
|
||||
left: false,
|
||||
right: false,
|
||||
child: Scaffold(
|
||||
@@ -508,7 +511,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
bool shouldShow =
|
||||
videoDetailController.scrollRatio.value != 0 &&
|
||||
videoDetailController.scrollCtr.offset != 0 &&
|
||||
context.orientation == Orientation.portrait;
|
||||
isPortrait;
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
@@ -519,8 +522,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
? shouldShow
|
||||
? null
|
||||
: SystemUiOverlayStyle(
|
||||
statusBarIconBrightness:
|
||||
Brightness.light,
|
||||
statusBarIconBrightness: Brightness.light,
|
||||
systemNavigationBarIconBrightness:
|
||||
themeData.brightness.reverse,
|
||||
)
|
||||
@@ -555,9 +557,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
controller: videoDetailController.scrollCtr,
|
||||
onlyOneScrollInBody: true,
|
||||
pinnedHeaderSliverHeightBuilder: () {
|
||||
double height = isFullScreen ||
|
||||
context.orientation == Orientation.landscape
|
||||
? MediaQuery.sizeOf(context).height
|
||||
double pinnedHeight = isFullScreen || !isPortrait
|
||||
? height
|
||||
: videoDetailController.isExpanding ||
|
||||
videoDetailController.isCollapsing
|
||||
? animHeight
|
||||
@@ -580,10 +581,9 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
refreshPage();
|
||||
});
|
||||
}
|
||||
return height;
|
||||
return pinnedHeight;
|
||||
},
|
||||
headerSliverBuilder:
|
||||
(BuildContext context, bool innerBoxIsScrolled) {
|
||||
headerSliverBuilder: (context, innerBoxIsScrolled) {
|
||||
return [
|
||||
SliverAppBar(
|
||||
elevation: 0,
|
||||
@@ -591,9 +591,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
primary: false,
|
||||
automaticallyImplyLeading: false,
|
||||
pinned: true,
|
||||
expandedHeight: isFullScreen ||
|
||||
context.orientation == Orientation.landscape
|
||||
? MediaQuery.sizeOf(context).height
|
||||
expandedHeight: isFullScreen || !isPortrait
|
||||
? height
|
||||
: videoDetailController.isExpanding ||
|
||||
videoDetailController.isCollapsing
|
||||
? animHeight
|
||||
@@ -603,17 +602,14 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
children: [
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final double videoWidth = context.width;
|
||||
if (MediaQuery.of(context).orientation ==
|
||||
Orientation.landscape &&
|
||||
if (!isPortrait &&
|
||||
!videoDetailController.horizontalScreen &&
|
||||
!isFullScreen &&
|
||||
isShowing &&
|
||||
mounted) {
|
||||
hideStatusBar();
|
||||
}
|
||||
if (MediaQuery.of(context).orientation ==
|
||||
Orientation.portrait &&
|
||||
if (isPortrait &&
|
||||
!isFullScreen &&
|
||||
isShowing &&
|
||||
mounted) {
|
||||
@@ -623,27 +619,20 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}
|
||||
}
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).orientation ==
|
||||
Orientation.landscape ||
|
||||
isFullScreen
|
||||
? MediaQuery.sizeOf(context).height -
|
||||
(MediaQuery.of(context).orientation ==
|
||||
Orientation.landscape ||
|
||||
removeSafeArea
|
||||
height: !isPortrait || isFullScreen
|
||||
? height -
|
||||
(!isPortrait || removeSafeArea
|
||||
? 0
|
||||
: MediaQuery.of(this.context)
|
||||
.padding
|
||||
.top)
|
||||
: MediaQuery.of(this.context).padding.top)
|
||||
: videoDetailController.isExpanding ||
|
||||
videoDetailController.isCollapsing
|
||||
? animHeight
|
||||
: videoDetailController.videoHeight,
|
||||
width: context.width,
|
||||
width: width,
|
||||
child: videoPlayer(
|
||||
videoWidth,
|
||||
context.orientation == Orientation.landscape ||
|
||||
isFullScreen
|
||||
? context.height
|
||||
width,
|
||||
!isPortrait || isFullScreen
|
||||
? height
|
||||
: videoDetailController.isExpanding ||
|
||||
videoDetailController.isCollapsing
|
||||
? animHeight
|
||||
@@ -655,8 +644,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
Obx(
|
||||
() {
|
||||
Widget toolbar() => Opacity(
|
||||
opacity:
|
||||
videoDetailController.scrollRatio.value,
|
||||
opacity: videoDetailController.scrollRatio.value,
|
||||
child: Container(
|
||||
color: themeData.colorScheme.surface,
|
||||
alignment: Alignment.topCenter,
|
||||
@@ -699,8 +687,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
videoDetailController
|
||||
.plPlayerController
|
||||
.backToHome = true;
|
||||
Get.until((route) =>
|
||||
route.isFirst);
|
||||
Get.until(
|
||||
(route) => route.isFirst);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -713,8 +701,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
children: [
|
||||
Icon(
|
||||
Icons.play_arrow_rounded,
|
||||
color: themeData
|
||||
.colorScheme.primary,
|
||||
color:
|
||||
themeData.colorScheme.primary,
|
||||
),
|
||||
Text(
|
||||
'${videoDetailController.playedTime == null ? '立即' : plPlayerController!.playerStatus.status.value == PlayerStatus.completed ? '重新' : '继续'}播放',
|
||||
@@ -762,13 +750,11 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
context);
|
||||
break;
|
||||
case 'savePic':
|
||||
DownloadUtils
|
||||
.downloadImg(
|
||||
DownloadUtils.downloadImg(
|
||||
context,
|
||||
[
|
||||
videoDetailController
|
||||
.videoItem[
|
||||
'pic']
|
||||
.videoItem['pic']
|
||||
],
|
||||
);
|
||||
break;
|
||||
@@ -784,16 +770,14 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
if (videoDetailController
|
||||
.epId ==
|
||||
null)
|
||||
const PopupMenuItem<
|
||||
String>(
|
||||
const PopupMenuItem<String>(
|
||||
value: 'note',
|
||||
child: Text('查看笔记'),
|
||||
),
|
||||
if (videoDetailController
|
||||
.videoItem['pic'] !=
|
||||
null)
|
||||
const PopupMenuItem<
|
||||
String>(
|
||||
const PopupMenuItem<String>(
|
||||
value: 'savePic',
|
||||
child: Text('保存封面'),
|
||||
),
|
||||
@@ -810,9 +794,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
tooltip: "更多设置",
|
||||
style: ButtonStyle(
|
||||
padding:
|
||||
WidgetStateProperty
|
||||
.all(EdgeInsets
|
||||
.zero),
|
||||
WidgetStateProperty.all(
|
||||
EdgeInsets.zero),
|
||||
),
|
||||
onPressed: () =>
|
||||
videoDetailController
|
||||
@@ -823,8 +806,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
Icons.more_vert_outlined,
|
||||
size: 19,
|
||||
color: themeData
|
||||
.colorScheme
|
||||
.onSurface,
|
||||
.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -836,7 +818,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
);
|
||||
return videoDetailController.scrollRatio.value == 0 ||
|
||||
videoDetailController.scrollCtr.offset == 0 ||
|
||||
context.orientation != Orientation.portrait
|
||||
!isPortrait
|
||||
? const SizedBox.shrink()
|
||||
: Positioned.fill(
|
||||
bottom: -2,
|
||||
@@ -859,8 +841,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
videoDetailController.queryVideoUrl();
|
||||
return;
|
||||
}
|
||||
videoDetailController.scrollRatio.value =
|
||||
0;
|
||||
videoDetailController.scrollRatio.value = 0;
|
||||
if (plPlayerController == null ||
|
||||
videoDetailController.playedTime ==
|
||||
null) {
|
||||
@@ -921,22 +902,25 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget get childWhenDisabledAlmostSquareInner => Obx(
|
||||
() {
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
final double width = size.width;
|
||||
final double height = size.height;
|
||||
final padding = MediaQuery.paddingOf(context);
|
||||
if (enableVerticalExpand &&
|
||||
videoDetailController.direction.value == 'vertical') {
|
||||
final double videoHeight = context.height -
|
||||
(removeSafeArea
|
||||
? 0
|
||||
: (MediaQuery.of(context).padding.top +
|
||||
MediaQuery.of(context).padding.bottom));
|
||||
final double videoHeight =
|
||||
height - (removeSafeArea ? 0 : padding.vertical);
|
||||
final double videoWidth = videoHeight * 9 / 16;
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: videoHeight,
|
||||
width: isFullScreen ? context.width : videoWidth,
|
||||
width: isFullScreen ? width : videoWidth,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
Expanded(
|
||||
@@ -965,20 +949,15 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
],
|
||||
);
|
||||
}
|
||||
final double videoHeight = context.height / 2.5;
|
||||
final double videoWidth = context.width;
|
||||
final double videoHeight = height / 2.5;
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: videoWidth,
|
||||
width: width,
|
||||
height: isFullScreen
|
||||
? context.height -
|
||||
(removeSafeArea
|
||||
? 0
|
||||
: (MediaQuery.of(context).padding.top +
|
||||
MediaQuery.of(context).padding.bottom))
|
||||
? height - (removeSafeArea ? 0 : padding.vertical)
|
||||
: videoHeight,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
child: videoPlayer(width, videoHeight),
|
||||
),
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
@@ -1013,10 +992,14 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
|
||||
Widget get childWhenDisabledLandscapeInner => Obx(
|
||||
() {
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
final double width = size.width;
|
||||
final double height = size.height;
|
||||
final padding = MediaQuery.paddingOf(context);
|
||||
if (enableVerticalExpand &&
|
||||
videoDetailController.direction.value == 'vertical') {
|
||||
final double videoHeight = context.height -
|
||||
(removeSafeArea ? 0 : MediaQuery.of(context).padding.top);
|
||||
final double videoHeight =
|
||||
height - (removeSafeArea ? 0 : padding.top);
|
||||
final double videoWidth = videoHeight * 9 / 16;
|
||||
return Row(
|
||||
children: [
|
||||
@@ -1025,7 +1008,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
isFullScreen ? const SizedBox.shrink() : videoIntro()),
|
||||
SizedBox(
|
||||
height: videoHeight,
|
||||
width: isFullScreen ? context.width : videoWidth,
|
||||
width: isFullScreen ? width : videoWidth,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
Expanded(
|
||||
@@ -1059,10 +1042,9 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
);
|
||||
}
|
||||
double videoWidth =
|
||||
clampDouble(context.height / context.width * 1.08, 0.5, 0.7) *
|
||||
context.width;
|
||||
if (context.width >= 560) {
|
||||
videoWidth = min(videoWidth, context.width - 280);
|
||||
clampDouble(height / width * 1.08, 0.5, 0.7) * width;
|
||||
if (width >= 560) {
|
||||
videoWidth = min(videoWidth, width - 280);
|
||||
}
|
||||
final double videoHeight = videoWidth * 9 / 16;
|
||||
return Row(
|
||||
@@ -1070,19 +1052,17 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: isFullScreen ? context.width : videoWidth,
|
||||
height: isFullScreen ? context.height : videoHeight,
|
||||
width: isFullScreen ? width : videoWidth,
|
||||
height: isFullScreen ? height : videoHeight,
|
||||
child: videoPlayer(videoWidth, videoHeight),
|
||||
),
|
||||
Offstage(
|
||||
offstage: isFullScreen,
|
||||
child: SizedBox(
|
||||
width: videoWidth,
|
||||
height: context.height -
|
||||
height: height -
|
||||
videoHeight -
|
||||
(removeSafeArea
|
||||
? 0
|
||||
: MediaQuery.of(context).padding.top),
|
||||
(removeSafeArea ? 0 : padding.top),
|
||||
child: videoIntro(false, false),
|
||||
),
|
||||
),
|
||||
@@ -1091,14 +1071,10 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
Offstage(
|
||||
offstage: isFullScreen,
|
||||
child: SizedBox(
|
||||
width: (context.width -
|
||||
width: width -
|
||||
videoWidth -
|
||||
(removeSafeArea
|
||||
? 0
|
||||
: (MediaQuery.of(context).padding.left +
|
||||
MediaQuery.of(context).padding.right))),
|
||||
height: context.height -
|
||||
(removeSafeArea ? 0 : MediaQuery.of(context).padding.top),
|
||||
(removeSafeArea ? 0 : padding.horizontal),
|
||||
height: height - (removeSafeArea ? 0 : padding.top),
|
||||
child: Scaffold(
|
||||
key: videoDetailController.childKey,
|
||||
resizeToAvoidBottomInset: false,
|
||||
@@ -1591,7 +1567,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
return PopScope(
|
||||
canPop: !isFullScreen &&
|
||||
(videoDetailController.horizontalScreen ||
|
||||
MediaQuery.of(context).orientation == Orientation.portrait),
|
||||
MediaQuery.orientationOf(context) == Orientation.portrait),
|
||||
onPopInvokedWithResult: _onPopInvokedWithResult,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
@@ -1753,6 +1729,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
}
|
||||
|
||||
Widget videoIntro([bool needRelated = true, bool needCtr = true]) {
|
||||
final bottom = MediaQuery.paddingOf(context).bottom;
|
||||
Widget introPanel() => Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
@@ -1793,8 +1770,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
] else
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: MediaQuery.paddingOf(context).bottom +
|
||||
StyleString.safeSpace,
|
||||
height: bottom + StyleString.safeSpace,
|
||||
),
|
||||
),
|
||||
] else if (videoDetailController.videoType ==
|
||||
@@ -1810,7 +1786,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: MediaQuery.paddingOf(context).bottom +
|
||||
height: bottom +
|
||||
(videoDetailController.isPlayAll &&
|
||||
MediaQuery.orientationOf(context) ==
|
||||
Orientation.landscape
|
||||
@@ -1829,7 +1805,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
Positioned(
|
||||
left: 12,
|
||||
right: 12,
|
||||
bottom: MediaQuery.of(context).padding.bottom + 12,
|
||||
bottom: bottom + 12,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
@@ -2233,7 +2209,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
if (isFullScreen) {
|
||||
plPlayerController!.triggerFullScreen(status: false);
|
||||
}
|
||||
if (MediaQuery.of(context).orientation == Orientation.landscape &&
|
||||
if (MediaQuery.orientationOf(context) == Orientation.landscape &&
|
||||
!videoDetailController.horizontalScreen) {
|
||||
verticalScreenForTwoSeconds();
|
||||
}
|
||||
|
||||
@@ -1801,15 +1801,12 @@ Widget buildSeekPreviewWidget(PlPlayerController plPlayerController) {
|
||||
if (plPlayerController.videoShot == null) {
|
||||
plPlayerController.getVideoShot();
|
||||
}
|
||||
return SizedBox.shrink(
|
||||
key: ValueKey(plPlayerController.previewDx.value),
|
||||
);
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
VideoShotData data = plPlayerController.videoShot!['data'];
|
||||
|
||||
return LayoutBuilder(
|
||||
key: ValueKey(plPlayerController.previewDx.value),
|
||||
builder: (context, constraints) {
|
||||
try {
|
||||
double scale = plPlayerController.isFullScreen.value &&
|
||||
|
||||
Reference in New Issue
Block a user