diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index b419c4e5..2dc586b6 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -534,11 +534,10 @@ class _VideoDetailPageState extends State Scaffold( resizeToAvoidBottomInset: false, key: vdCtr.scaffoldKey, - backgroundColor: Colors.black, appBar: PreferredSize( preferredSize: const Size.fromHeight(0), child: AppBar( - backgroundColor: Colors.transparent, + backgroundColor: Colors.black, elevation: 0, ), ), @@ -568,8 +567,7 @@ class _VideoDetailPageState extends State } return SliverAppBar( automaticallyImplyLeading: false, - // 假装使用一个非空变量,避免Obx检测不到而罢工 - pinned: vdCtr.autoPlay.value, + pinned: true, elevation: 0, scrolledUnderElevation: 0, forceElevated: innerBoxIsScrolled, @@ -577,47 +575,42 @@ class _VideoDetailPageState extends State backgroundColor: Colors.black, flexibleSpace: FlexibleSpaceBar( 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: (BuildContext context, - BoxConstraints boxConstraints) { - return Stack( - children: [ - if (isShowing) - Padding( - padding: EdgeInsets.only(top: 0), - child: videoPlayerPanel, - ), + 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: Hero( + tag: heroTag, + child: Stack( + children: [ + if (isShowing) videoPlayerPanel, - /// 关闭自动播放时 手动播放 - Obx( - () => Visibility( - visible: !vdCtr.autoPlay.value && - vdCtr.isShowCover.value, - child: Positioned( - top: 0, - left: 0, - right: 0, - child: handlePlayPanel(), - ), - ), + /// 关闭自动播放时 手动播放 + Obx( + () => Visibility( + visible: !vdCtr.autoPlay.value && + vdCtr.isShowCover.value, + child: Positioned( + top: 0, + left: 0, + right: 0, + child: handlePlayPanel(), ), - ], - ); - }, - )), + ), + ), + ], + ), + ), + ), ), ); }, @@ -636,55 +629,51 @@ class _VideoDetailPageState extends State : pinnedHeaderHeight; }, onlyOneScrollInBody: true, - body: ColoredBox( - key: Key(heroTag), - color: Theme.of(context).colorScheme.background, - child: Column( - children: [ - tabbarBuild(), - Expanded( - child: TabBarView( - controller: vdCtr.tabCtr, - children: [ - Builder( - builder: (BuildContext context) { - return CustomScrollView( - key: const PageStorageKey('简介'), - slivers: [ - if (vdCtr.videoType == SearchType.video) ...[ - VideoIntroPanel(bvid: vdCtr.bvid), - ] else if (vdCtr.videoType == - SearchType.media_bangumi) ...[ - Obx(() => BangumiIntroPanel( - cid: vdCtr.cid.value)), - ], - SliverToBoxAdapter( - child: Divider( - indent: 12, - endIndent: 12, - color: Theme.of(context) - .dividerColor - .withOpacity(0.06), - ), - ), - if (vdCtr.videoType == SearchType.video && - vdCtr.enableRelatedVideo) - const RelatedVideoPanel(), + body: Column( + children: [ + tabbarBuild(), + Expanded( + child: TabBarView( + controller: vdCtr.tabCtr, + children: [ + Builder( + builder: (BuildContext context) { + return CustomScrollView( + key: const PageStorageKey('简介'), + slivers: [ + if (vdCtr.videoType == SearchType.video) ...[ + VideoIntroPanel(bvid: vdCtr.bvid), + ] else if (vdCtr.videoType == + SearchType.media_bangumi) ...[ + Obx(() => + BangumiIntroPanel(cid: vdCtr.cid.value)), ], - ); - }, + SliverToBoxAdapter( + child: Divider( + indent: 12, + endIndent: 12, + color: Theme.of(context) + .dividerColor + .withOpacity(0.06), + ), + ), + if (vdCtr.videoType == SearchType.video && + vdCtr.enableRelatedVideo) + const RelatedVideoPanel(), + ], + ); + }, + ), + Obx( + () => VideoReplyPanel( + bvid: vdCtr.bvid, + oid: vdCtr.oid.value, ), - Obx( - () => VideoReplyPanel( - bvid: vdCtr.bvid, - oid: vdCtr.oid.value, - ), - ) - ], - ), + ) + ], ), - ], - ), + ), + ], ), ), ),