fix: 视频全屏时的安全区域

This commit is contained in:
guozhigq
2023-09-18 07:39:56 +08:00
parent f543be562a
commit 8f97431665
2 changed files with 31 additions and 25 deletions

View File

@ -817,6 +817,10 @@ class PlPlayerController {
} }
toggleFullScreen(true); toggleFullScreen(true);
bool isValid =
direction.value == 'vertical' || mode == FullScreenMode.vertical
? true
: false;
var result = await showDialog( var result = await showDialog(
context: Get.context!, context: Get.context!,
useSafeArea: false, useSafeArea: false,
@ -824,12 +828,10 @@ class PlPlayerController {
backgroundColor: Colors.black, backgroundColor: Colors.black,
child: SafeArea( child: SafeArea(
// 忽略手机安全区域 // 忽略手机安全区域
top: isValid,
left: false, left: false,
right: false, right: false,
bottom: bottom: isValid,
direction.value == 'vertical' || mode == FullScreenMode.vertical
? true
: false,
child: PLVideoPlayer( child: PLVideoPlayer(
controller: this, controller: this,
headerControl: headerControl, headerControl: headerControl,

View File

@ -547,34 +547,38 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
), ),
// 头部、底部控制条 // 头部、底部控制条
Obx( SafeArea(
() => Column( top: false,
children: [ bottom: false,
if (widget.headerControl != null || _.headerControl != null) child: Obx(
() => Column(
children: [
if (widget.headerControl != null || _.headerControl != null)
ClipRect(
clipBehavior: Clip.hardEdge,
child: AppBarAni(
controller: animationController,
visible: !_.controlsLock.value && _.showControls.value,
position: 'top',
child: widget.headerControl ?? _.headerControl!,
),
),
const Spacer(),
ClipRect( ClipRect(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: AppBarAni( child: AppBarAni(
controller: animationController, controller: animationController,
visible: !_.controlsLock.value && _.showControls.value, visible: !_.controlsLock.value && _.showControls.value,
position: 'top', position: 'bottom',
child: widget.headerControl ?? _.headerControl!, child: widget.bottomControl ??
BottomControl(
controller: widget.controller,
triggerFullScreen:
widget.controller.triggerFullScreen),
), ),
), ),
const Spacer(), ],
ClipRect( ),
clipBehavior: Clip.hardEdge,
child: AppBarAni(
controller: animationController,
visible: !_.controlsLock.value && _.showControls.value,
position: 'bottom',
child: widget.bottomControl ??
BottomControl(
controller: widget.controller,
triggerFullScreen:
widget.controller.triggerFullScreen),
),
),
],
), ),
), ),