Merge branch 'opt-videoPlayerControl'

This commit is contained in:
guozhigq
2024-12-08 18:19:19 +08:00
3 changed files with 437 additions and 443 deletions

View File

@ -1068,13 +1068,10 @@ class _HeaderControlState extends State<HeaderControl> {
);
final bool isLandscape =
MediaQuery.of(context).orientation == Orientation.landscape;
return AppBar(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
primary: false,
automaticallyImplyLeading: false,
titleSpacing: 14,
title: Column(
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 14),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (isFullScreen.value && isLandscape) ...[
Row(

View File

@ -443,7 +443,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
color: Colors.white,
fontSize: 12,
);
return Stack(
return ClipRect(
child: Stack(
fit: StackFit.passthrough,
children: <Widget>[
Obx(
@ -719,7 +720,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
_brightnessValue.value - delta / level;
final double result = brightness.clamp(0.0, 1.0);
setBrightness(result);
} else if (isUsingFullScreenGestures(tapPosition, sectionWidth)) {
} else if (isUsingFullScreenGestures(
tapPosition, sectionWidth)) {
// 全屏
final double dy = details.delta.dy;
const double threshold = 7.0; // 滑动阈值
@ -732,7 +734,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
lastFullScreenToggleTime = DateTime.now();
// 下滑退出全屏
await widget.controller.triggerFullScreen(status: flag);
widget.fullScreenCb?.call(flag);
}
_distance.value = 0.0;
} else if (dy < _distance.value &&
@ -742,7 +743,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
lastFullScreenToggleTime = DateTime.now();
// 上滑进入全屏
await widget.controller.triggerFullScreen(status: !flag);
widget.fullScreenCb?.call(!flag);
}
_distance.value = 0.0;
}
@ -770,9 +770,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
() => Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (widget.headerControl != null || _.headerControl != null) ...[
if (widget.headerControl != null ||
_.headerControl != null) ...[
Flexible(
child: ClipRect(
child: AppBarAni(
controller: animationController,
visible: !_.controlsLock.value && _.showControls.value,
@ -780,13 +780,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: widget.headerControl ?? _.headerControl!,
),
),
),
] else ...[
const SizedBox.shrink()
],
Flexible(
flex: _.videoType == 'live' ? 0 : 1,
child: ClipRect(
child: AppBarAni(
controller: animationController,
visible: !_.controlsLock.value && _.showControls.value,
@ -799,7 +797,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
),
),
),
),
],
),
),
@ -934,6 +931,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
onSubmittedcb: _handleSubmittedCallback,
),
],
),
);
}
}

View File

@ -18,19 +18,18 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.transparent,
height: 90,
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(7, 0, 7, 6),
padding: const EdgeInsets.fromLTRB(7, 0, 7, 4),
child: ProgressBarWidget(controller: controller!),
),
Row(children: buildBottomControl!),
const SizedBox(height: 10),
const SizedBox(height: 6),
],
),
);