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