fix: 旋转横屏仍有状态栏
This commit is contained in:
@ -281,18 +281,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
final double videoHeight = MediaQuery.sizeOf(context).width * 9 / 16;
|
||||
final double pinnedHeaderHeight =
|
||||
statusBarHeight + kToolbarHeight + videoHeight;
|
||||
if (MediaQuery.of(context).orientation == Orientation.landscape ||
|
||||
plPlayerController?.isFullScreen.value == true) {
|
||||
enterFullScreen();
|
||||
} else {
|
||||
exitFullScreen();
|
||||
}
|
||||
Widget childWhenDisabled = SafeArea(
|
||||
top: MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||
plPlayerController?.isFullScreen.value == true,
|
||||
bottom: MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||
plPlayerController?.isFullScreen.value == true,
|
||||
left: false,//plPlayerController?.isFullScreen.value != true,
|
||||
left: false, //plPlayerController?.isFullScreen.value != true,
|
||||
right: false, //plPlayerController?.isFullScreen.value != true,
|
||||
child: Stack(
|
||||
children: [
|
||||
@ -313,7 +307,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
(BuildContext context, bool innerBoxIsScrolled) {
|
||||
return <Widget>[
|
||||
Obx(
|
||||
() => SliverAppBar(
|
||||
() {
|
||||
if (MediaQuery.of(context).orientation ==
|
||||
Orientation.landscape ||
|
||||
plPlayerController?.isFullScreen.value == true) {
|
||||
enterFullScreen();
|
||||
} else {
|
||||
exitFullScreen();
|
||||
}
|
||||
return SliverAppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
// 假装使用一个非空变量,避免Obx检测不到而罢工
|
||||
pinned: videoDetailController.autoPlay.value ^
|
||||
@ -334,8 +336,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
backgroundColor: Colors.black,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: PopScope(
|
||||
canPop:
|
||||
plPlayerController?.isFullScreen.value != true,
|
||||
canPop: plPlayerController?.isFullScreen.value !=
|
||||
true,
|
||||
onPopInvoked: (bool didPop) {
|
||||
if (plPlayerController?.isFullScreen.value ==
|
||||
true) {
|
||||
@ -350,7 +352,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context,
|
||||
BoxConstraints boxConstraints) {
|
||||
final double maxWidth = boxConstraints.maxWidth;
|
||||
final double maxWidth =
|
||||
boxConstraints.maxWidth;
|
||||
final double maxHeight =
|
||||
boxConstraints.maxHeight;
|
||||
return Stack(
|
||||
@ -363,7 +366,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
if (snapshot.hasData &&
|
||||
snapshot.data['status']) {
|
||||
return Obx(
|
||||
() => !videoDetailController
|
||||
() =>
|
||||
!videoDetailController
|
||||
.autoPlay.value
|
||||
? nil
|
||||
: PLVideoPlayer(
|
||||
@ -374,13 +378,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
.headerControl,
|
||||
danmuWidget: Obx(
|
||||
() => PlDanmaku(
|
||||
key: Key(
|
||||
videoDetailController
|
||||
key: Key(videoDetailController
|
||||
.danmakuCid
|
||||
.value
|
||||
.toString()),
|
||||
cid:
|
||||
videoDetailController
|
||||
cid: videoDetailController
|
||||
.danmakuCid
|
||||
.value,
|
||||
playerController:
|
||||
@ -447,16 +449,17 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
onPressed: () async {
|
||||
var res = await UserHttp
|
||||
.toViewLater(
|
||||
bvid:
|
||||
videoDetailController
|
||||
bvid: videoDetailController
|
||||
.bvid);
|
||||
SmartDialog.showToast(
|
||||
SmartDialog
|
||||
.showToast(
|
||||
res['msg']);
|
||||
},
|
||||
icon: const Icon(Icons
|
||||
.history_outlined),
|
||||
),
|
||||
const SizedBox(width: 14)
|
||||
const SizedBox(
|
||||
width: 14)
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -476,10 +479,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
onPressed: () =>
|
||||
handlePlay(),
|
||||
icon: const Icon(
|
||||
Icons.play_circle_outline,
|
||||
Icons
|
||||
.play_circle_outline,
|
||||
size: 20,
|
||||
),
|
||||
label: const Text('轻触封面播放'),
|
||||
label:
|
||||
const Text('轻触封面播放'),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -491,7 +496,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
},
|
||||
)),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
];
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user