修复直播全屏异常

This commit is contained in:
orz12
2023-12-29 20:08:51 +08:00
committed by GitHub
parent 3039503726
commit 258d356a00

View File

@ -54,62 +54,83 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget childWhenDisabled = Scaffold( Widget childWhenDisabled = Scaffold(
primary: true, primary: true,
appBar: AppBar( appBar: PreferredSize(
centerTitle: false, preferredSize: Size.fromHeight(
titleSpacing: 0, MediaQuery.of(context).orientation == Orientation.portrait ? 56 : 0,
title: _liveRoomController.liveItem != null ),
? Row( child: AppBar(
children: [ centerTitle: false,
NetworkImgLayer( titleSpacing: 0,
width: 34, title: _liveRoomController.liveItem != null
height: 34, ? Row(
type: 'avatar', children: [
src: _liveRoomController.liveItem.face, NetworkImgLayer(
), width: 34,
const SizedBox(width: 10), height: 34,
Column( type: 'avatar',
crossAxisAlignment: CrossAxisAlignment.start, src: _liveRoomController.liveItem.face,
children: [ ),
Text( const SizedBox(width: 10),
_liveRoomController.liveItem.uname, Column(
style: const TextStyle(fontSize: 14), crossAxisAlignment: CrossAxisAlignment.start,
), children: [
const SizedBox(height: 1),
if (_liveRoomController.liveItem.watchedShow != null)
Text( Text(
_liveRoomController _liveRoomController.liveItem.uname,
.liveItem.watchedShow['text_large'] ?? style: const TextStyle(fontSize: 14),
'', ),
style: const TextStyle(fontSize: 12)), const SizedBox(height: 1),
], if (_liveRoomController.liveItem.watchedShow != null)
), Text(
], _liveRoomController
) .liveItem.watchedShow['text_large'] ??
: const SizedBox(), '',
// actions: [ style: const TextStyle(fontSize: 12)),
// SizedBox( ],
// height: 34, ),
// child: ElevatedButton(onPressed: () {}, child: const Text('关注')), ],
// ), )
// const SizedBox(width: 12), : const SizedBox(),
// ], // actions: [
// SizedBox(
// height: 34,
// child: ElevatedButton(onPressed: () {}, child: const Text('关注')),
// ),
// const SizedBox(width: 12),
// ],
),
), ),
body: Column( body: Column(
children: [ children: [
Stack( Stack(
children: [ children: [
AspectRatio( PopScope(
aspectRatio: 16 / 9, canPop: plPlayerController?.isFullScreen.value != true,
child: plPlayerController!.videoPlayerController != null onPopInvoked: (bool didPop) {
? PLVideoPlayer( if (plPlayerController?.isFullScreen.value == true) {
controller: plPlayerController!, plPlayerController!.triggerFullScreen(status: false);
bottomControl: BottomControl( }
controller: plPlayerController, if (MediaQuery.of(context).orientation ==
liveRoomCtr: _liveRoomController, Orientation.landscape) {
floating: floating, verticalScreen();
), }
) },
: const SizedBox(), child: SizedBox(
width: Get.size.width,
height: MediaQuery.of(context).orientation ==
Orientation.landscape
? Get.size.height
: Get.size.width * 9 / 16,
child: plPlayerController!.videoPlayerController != null
? PLVideoPlayer(
controller: plPlayerController!,
bottomControl: BottomControl(
controller: plPlayerController,
liveRoomCtr: _liveRoomController,
floating: floating,
),
)
: const SizedBox(),
),
), ),
// if (_liveRoomController.liveItem != null && // if (_liveRoomController.liveItem != null &&
// _liveRoomController.liveItem.cover != null) // _liveRoomController.liveItem.cover != null)