fix: 修正非自动播放下空检查问题

This commit is contained in:
orz12
2023-12-22 14:18:21 +08:00
parent e32ddeaec0
commit eb8feb5773

View File

@ -237,17 +237,17 @@ class _VideoDetailPageState extends State<VideoDetailPage>
final double pinnedHeaderHeight =
statusBarHeight + kToolbarHeight + videoHeight;
if (MediaQuery.of(context).orientation == Orientation.landscape ||
plPlayerController!.isFullScreen.value) {
plPlayerController?.isFullScreen.value == true) {
enterFullScreen();
} else {
exitFullScreen();
}
Widget childWhenDisabled = SafeArea(
top: MediaQuery.of(context).orientation == Orientation.portrait,
bottom: MediaQuery.of(context).orientation == Orientation.portrait
&& plPlayerController!.isFullScreen.value,
left: !plPlayerController!.isFullScreen.value,
right: !plPlayerController!.isFullScreen.value,
bottom: MediaQuery.of(context).orientation == Orientation.portrait &&
plPlayerController?.isFullScreen.value == true,
left: plPlayerController?.isFullScreen.value != true,
right: plPlayerController?.isFullScreen.value != true,
child: Stack(
children: [
Scaffold(
@ -259,26 +259,14 @@ class _VideoDetailPageState extends State<VideoDetailPage>
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
Obx(() => PopScope(
canPop: !plPlayerController!.isFullScreen.value,
onPopInvoked: (bool didPop) {
if (plPlayerController!.isFullScreen.value) {
plPlayerController!
.triggerFullScreen(status: false);
}
if (MediaQuery.of(context).orientation ==
Orientation.landscape) {
verticalScreen();
}
},
child: SliverAppBar(
SliverAppBar(
automaticallyImplyLeading: false,
pinned: false,
elevation: 0,
scrolledUnderElevation: 0,
forceElevated: innerBoxIsScrolled,
expandedHeight:
plPlayerController!.isFullScreen.value ||
plPlayerController?.isFullScreen.value == true ||
MediaQuery.of(context).orientation ==
Orientation.landscape
? MediaQuery.of(context).size.height -
@ -289,7 +277,21 @@ class _VideoDetailPageState extends State<VideoDetailPage>
: videoHeight,
backgroundColor: Colors.black,
flexibleSpace: FlexibleSpaceBar(
background: LayoutBuilder(
background: PopScope(
canPop:
plPlayerController?.isFullScreen.value != true,
onPopInvoked: (bool didPop) {
if (plPlayerController?.isFullScreen.value ==
true) {
plPlayerController!
.triggerFullScreen(status: false);
}
if (MediaQuery.of(context).orientation ==
Orientation.landscape) {
verticalScreen();
}
},
child: LayoutBuilder(
builder: (context, boxConstraints) {
double maxWidth = boxConstraints.maxWidth;
double maxHeight = boxConstraints.maxHeight;
@ -369,8 +371,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
right: 0,
child: AppBar(
primary: false,
foregroundColor:
Colors.white,
foregroundColor: Colors.white,
backgroundColor:
Colors.transparent,
actions: [
@ -406,8 +407,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
.primaryContainer;
}),
),
onPressed: () =>
handlePlay(),
onPressed: () => handlePlay(),
icon: const Icon(
Icons.play_circle_outline,
size: 20,
@ -421,7 +421,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
],
);
},
),
)),
)),
];
@ -433,8 +432,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
// },
/// 不收回
pinnedHeaderSliverHeightBuilder: () {
return plPlayerController!.isFullScreen.value ?
MediaQuery.of(context).size.height: pinnedHeaderHeight;
return plPlayerController?.isFullScreen.value == true
? MediaQuery.of(context).size.height
: pinnedHeaderHeight;
},
onlyOneScrollInBody: true,
body: Container(