diff --git a/lib/pages/liveRoom/view.dart b/lib/pages/liveRoom/view.dart index 125460b9..5ac382e6 100644 --- a/lib/pages/liveRoom/view.dart +++ b/lib/pages/liveRoom/view.dart @@ -54,62 +54,83 @@ class _LiveRoomPageState extends State { Widget build(BuildContext context) { Widget childWhenDisabled = Scaffold( primary: true, - appBar: AppBar( - centerTitle: false, - titleSpacing: 0, - title: _liveRoomController.liveItem != null - ? Row( - children: [ - NetworkImgLayer( - width: 34, - height: 34, - type: 'avatar', - src: _liveRoomController.liveItem.face, - ), - const SizedBox(width: 10), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _liveRoomController.liveItem.uname, - style: const TextStyle(fontSize: 14), - ), - const SizedBox(height: 1), - if (_liveRoomController.liveItem.watchedShow != null) + appBar: PreferredSize( + preferredSize: Size.fromHeight( + MediaQuery.of(context).orientation == Orientation.portrait ? 56 : 0, + ), + child: AppBar( + centerTitle: false, + titleSpacing: 0, + title: _liveRoomController.liveItem != null + ? Row( + children: [ + NetworkImgLayer( + width: 34, + height: 34, + type: 'avatar', + src: _liveRoomController.liveItem.face, + ), + const SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ Text( - _liveRoomController - .liveItem.watchedShow['text_large'] ?? - '', - style: const TextStyle(fontSize: 12)), - ], - ), - ], - ) - : const SizedBox(), - // actions: [ - // SizedBox( - // height: 34, - // child: ElevatedButton(onPressed: () {}, child: const Text('关注')), - // ), - // const SizedBox(width: 12), - // ], + _liveRoomController.liveItem.uname, + style: const TextStyle(fontSize: 14), + ), + const SizedBox(height: 1), + if (_liveRoomController.liveItem.watchedShow != null) + Text( + _liveRoomController + .liveItem.watchedShow['text_large'] ?? + '', + style: const TextStyle(fontSize: 12)), + ], + ), + ], + ) + : const SizedBox(), + // actions: [ + // SizedBox( + // height: 34, + // child: ElevatedButton(onPressed: () {}, child: const Text('关注')), + // ), + // const SizedBox(width: 12), + // ], + ), ), body: Column( children: [ Stack( children: [ - AspectRatio( - aspectRatio: 16 / 9, - child: plPlayerController!.videoPlayerController != null - ? PLVideoPlayer( - controller: plPlayerController!, - bottomControl: BottomControl( - controller: plPlayerController, - liveRoomCtr: _liveRoomController, - floating: floating, - ), - ) - : const SizedBox(), + 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: 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 && // _liveRoomController.liveItem.cover != null) diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index de35ddaf..b3c7e2a0 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -243,7 +243,8 @@ class _VideoDetailPageState extends State exitFullScreen(); } Widget childWhenDisabled = SafeArea( - top: MediaQuery.of(context).orientation == Orientation.portrait, + top: MediaQuery.of(context).orientation == Orientation.portrait && + plPlayerController?.isFullScreen.value == true, bottom: MediaQuery.of(context).orientation == Orientation.portrait && plPlayerController?.isFullScreen.value == true, left: plPlayerController?.isFullScreen.value != true, @@ -254,10 +255,17 @@ class _VideoDetailPageState extends State resizeToAvoidBottomInset: false, key: videoDetailController.scaffoldKey, backgroundColor: Colors.black, + appBar: PreferredSize( + preferredSize: const Size.fromHeight(0), + child: AppBar( + backgroundColor: Theme.of(context).colorScheme.background, + elevation: 0, + ), + ), body: ExtendedNestedScrollView( controller: _extendNestCtr, headerSliverBuilder: - (BuildContext context, bool innerBoxIsScrolled) { + (BuildContext _context, bool innerBoxIsScrolled) { return [ Obx(() => SliverAppBar( automaticallyImplyLeading: false, @@ -272,7 +280,7 @@ class _VideoDetailPageState extends State (MediaQuery.of(context).orientation == Orientation.landscape ? 0 - : statusBarHeight) + : MediaQuery.of(context).padding.top) : videoHeight, backgroundColor: Colors.black, flexibleSpace: FlexibleSpaceBar(