Merge pull request #325 from orz12/fix_portrait_fullscreen_bottom_cherry_pick

fix: 竖屏非全屏状态小白条适配
This commit is contained in:
guozhigq
2023-12-21 21:24:54 +08:00
committed by GitHub
3 changed files with 15 additions and 32 deletions

View File

@ -244,7 +244,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
} }
Widget childWhenDisabled = SafeArea( Widget childWhenDisabled = SafeArea(
top: MediaQuery.of(context).orientation == Orientation.portrait, top: MediaQuery.of(context).orientation == Orientation.portrait,
bottom: MediaQuery.of(context).orientation == Orientation.portrait, bottom: MediaQuery.of(context).orientation == Orientation.portrait
&& plPlayerController!.isFullScreen.value,
left: !plPlayerController!.isFullScreen.value, left: !plPlayerController!.isFullScreen.value,
right: !plPlayerController!.isFullScreen.value, right: !plPlayerController!.isFullScreen.value,
child: Stack( child: Stack(
@ -432,7 +433,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
// }, // },
/// 不收回 /// 不收回
pinnedHeaderSliverHeightBuilder: () { pinnedHeaderSliverHeightBuilder: () {
return pinnedHeaderHeight; return plPlayerController!.isFullScreen.value ?
MediaQuery.of(context).size.height: pinnedHeaderHeight;
}, },
onlyOneScrollInBody: true, onlyOneScrollInBody: true,
body: Container( body: Container(

View File

@ -937,32 +937,13 @@ class PlPlayerController {
if (!isFullScreen.value && status) { if (!isFullScreen.value && status) {
/// 按照视频宽高比决定全屏方向 /// 按照视频宽高比决定全屏方向
toggleFullScreen(true); toggleFullScreen(true);
switch (mode) { /// 进入全屏
case FullScreenMode.auto: await enterFullScreen();
if (direction.value == 'horizontal') { if(mode == FullScreenMode.vertical ||
/// 进入全屏 (mode == FullScreenMode.auto && direction.value == 'vertical')) {
await enterFullScreen(); await verticalScreen();
// 横屏 } else {
await landScape(); await landScape();
} else {
// 竖屏
await verticalScreen();
}
break;
case FullScreenMode.vertical:
/// 进入全屏
await enterFullScreen();
// 竖屏
await verticalScreen();
break;
case FullScreenMode.horizontal:
/// 进入全屏
await enterFullScreen();
// 横屏
await landScape();
break;
} }
// bool isValid = // bool isValid =

View File

@ -26,8 +26,8 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
return Container( return Container(
color: Colors.transparent, color: Colors.transparent,
height: 85, height: 90,
padding: const EdgeInsets.only(left: 14, right: 14), padding: const EdgeInsets.only(left: 18, right: 18),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
@ -50,8 +50,8 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
bufferedBarColor: colorTheme.withOpacity(0.4), bufferedBarColor: colorTheme.withOpacity(0.4),
timeLabelLocation: TimeLabelLocation.none, timeLabelLocation: TimeLabelLocation.none,
thumbColor: colorTheme, thumbColor: colorTheme,
barHeight: 3.0, barHeight: 3.5,
thumbRadius: 5.5, thumbRadius: 7,
onDragStart: (duration) { onDragStart: (duration) {
feedBack(); feedBack();
_.onChangedSliderStart(); _.onChangedSliderStart();