Merge branch 'design'

This commit is contained in:
guozhigq
2024-12-06 23:55:09 +08:00
3 changed files with 42 additions and 37 deletions

View File

@ -37,6 +37,7 @@ class MemberSearchController extends GetxController {
} else { } else {
Get.back(); Get.back();
} }
loadingStatus.value = 'init';
} }
void onChange(value) { void onChange(value) {
@ -76,7 +77,7 @@ class MemberSearchController extends GetxController {
archivePn += 1; archivePn += 1;
hasRequest = true; hasRequest = true;
} }
// loadingStatus.value = 'finish'; loadingStatus.value = 'finish';
return res; return res;
} }

View File

@ -502,7 +502,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final sizeContext = MediaQuery.sizeOf(context); final sizeContext = MediaQuery.sizeOf(context);
final _context = MediaQuery.of(context); final orientation = MediaQuery.orientationOf(context);
late final double verticalHeight = sizeContext.width * 22 / 16; late final double verticalHeight = sizeContext.width * 22 / 16;
late double defaultVideoHeight = vdCtr.videoDirection.value == 'vertical' late double defaultVideoHeight = vdCtr.videoDirection.value == 'vertical'
? verticalHeight ? verticalHeight
@ -517,12 +517,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
}); });
// 竖屏 // 竖屏
final bool isPortrait = _context.orientation == Orientation.portrait; final bool isPortrait = orientation == Orientation.portrait;
// 横屏 // 横屏
final bool isLandscape = _context.orientation == Orientation.landscape; final bool isLandscape = orientation == Orientation.landscape;
final Rx<bool> isFullScreen = plPlayerController?.isFullScreen ?? false.obs; final Rx<bool> isFullScreen = plPlayerController?.isFullScreen ?? false.obs;
// 全屏时高度撑满 // 全屏时高度撑满
if (isLandscape || isFullScreen.value == true) { if (isLandscape || isFullScreen.value) {
videoHeight.value = Get.size.height; videoHeight.value = Get.size.height;
enterFullScreen(); enterFullScreen();
} else { } else {
@ -634,10 +634,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
} }
Widget childWhenDisabled = SafeArea( Widget childWhenDisabled = SafeArea(
top: MediaQuery.of(context).orientation == Orientation.portrait && top: isPortrait && isFullScreen.value,
plPlayerController?.isFullScreen.value == true, bottom: isPortrait && isFullScreen.value,
bottom: MediaQuery.of(context).orientation == Orientation.portrait &&
plPlayerController?.isFullScreen.value == true,
left: false, left: false,
right: false, right: false,
child: Stack( child: Stack(
@ -660,22 +658,25 @@ class _VideoDetailPageState extends State<VideoDetailPage>
return <Widget>[ return <Widget>[
Obx( Obx(
() { () {
final Orientation orientation = final bool isLandscape =
MediaQuery.of(context).orientation; MediaQuery.orientationOf(context) ==
Orientation.landscape;
final bool isFullScreen = final bool isFullScreen =
plPlayerController?.isFullScreen.value == true; plPlayerController?.isFullScreen.value ?? false;
final double expandedHeight =
orientation == Orientation.landscape || isFullScreen late double expandedHeight;
? (MediaQuery.sizeOf(context).height - if (isLandscape || isFullScreen) {
(orientation == Orientation.landscape
? 0
: MediaQuery.of(context).padding.top))
: videoHeight.value;
if (orientation == Orientation.landscape ||
isFullScreen) {
enterFullScreen(); enterFullScreen();
expandedHeight = (MediaQuery.sizeOf(context).height -
(isLandscape
? 0
: MediaQuery.paddingOf(context).top));
} else { } else {
exitFullScreen(); exitFullScreen();
if (vdCtr.videoDirection.value == 'vertical') {
videoHeight.value = verticalHeight;
}
expandedHeight = videoHeight.value;
} }
return SliverAppBar( return SliverAppBar(
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
@ -687,21 +688,24 @@ class _VideoDetailPageState extends State<VideoDetailPage>
backgroundColor: Colors.black, backgroundColor: Colors.black,
flexibleSpace: SizedBox.expand( flexibleSpace: SizedBox.expand(
child: PopScope( child: PopScope(
canPop: canPop: !isFullScreen,
plPlayerController?.isFullScreen.value != true,
onPopInvoked: (bool didPop) { onPopInvoked: (bool didPop) {
if (plPlayerController?.controlsLock.value == if (plPlayerController != null) {
true) { if (plPlayerController!.controlsLock.value) {
plPlayerController?.onLockControl(false); plPlayerController!.onLockControl(false);
return; return;
}
if (isFullScreen) {
plPlayerController!
.triggerFullScreen(status: false);
if (vdCtr.videoDirection.value ==
'vertical') {
videoHeight.value = verticalHeight;
}
}
} }
if (plPlayerController?.isFullScreen.value ==
true) { if (isLandscape) {
plPlayerController!
.triggerFullScreen(status: false);
}
if (MediaQuery.of(context).orientation ==
Orientation.landscape) {
verticalScreen(); verticalScreen();
} }
}, },
@ -746,9 +750,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
/// 不收回 /// 不收回
pinnedHeaderSliverHeightBuilder: () { pinnedHeaderSliverHeightBuilder: () {
return MediaQuery.of(context).orientation == return isLandscape || isFullScreen.value
Orientation.landscape ||
plPlayerController?.isFullScreen.value == true
? MediaQuery.sizeOf(context).height ? MediaQuery.sizeOf(context).height
: playerStatus.value != PlayerStatus.playing : playerStatus.value != PlayerStatus.playing
? kToolbarHeight ? kToolbarHeight

View File

@ -732,6 +732,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
lastFullScreenToggleTime = DateTime.now(); lastFullScreenToggleTime = DateTime.now();
// 下滑退出全屏 // 下滑退出全屏
await widget.controller.triggerFullScreen(status: flag); await widget.controller.triggerFullScreen(status: flag);
widget.fullScreenCb?.call(flag);
} }
_distance.value = 0.0; _distance.value = 0.0;
} else if (dy < _distance.value && } else if (dy < _distance.value &&
@ -741,6 +742,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
lastFullScreenToggleTime = DateTime.now(); lastFullScreenToggleTime = DateTime.now();
// 上滑进入全屏 // 上滑进入全屏
await widget.controller.triggerFullScreen(status: !flag); await widget.controller.triggerFullScreen(status: !flag);
widget.fullScreenCb?.call(!flag);
} }
_distance.value = 0.0; _distance.value = 0.0;
} }