opt: 视频详情页Hero动画

This commit is contained in:
guozhigq
2024-05-26 15:48:28 +08:00
parent 1cefdb68b7
commit d6e24096e0

View File

@ -525,11 +525,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
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,
),
),
@ -559,8 +558,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
}
return SliverAppBar(
automaticallyImplyLeading: false,
// 假装使用一个非空变量避免Obx检测不到而罢工
pinned: vdCtr.autoPlay.value,
pinned: true,
elevation: 0,
scrolledUnderElevation: 0,
forceElevated: innerBoxIsScrolled,
@ -568,8 +566,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) {
@ -581,16 +579,11 @@ class _VideoDetailPageState extends State<VideoDetailPage>
verticalScreen();
}
},
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints boxConstraints) {
return Stack(
child: Hero(
tag: heroTag,
child: Stack(
children: <Widget>[
if (isShowing)
Padding(
padding: EdgeInsets.only(top: 0),
child: videoPlayerPanel,
),
if (isShowing) videoPlayerPanel,
/// 关闭自动播放时 手动播放
Obx(
@ -606,9 +599,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
),
),
],
);
},
)),
),
),
),
),
);
},
@ -627,10 +620,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
: pinnedHeaderHeight;
},
onlyOneScrollInBody: true,
body: ColoredBox(
key: Key(heroTag),
color: Theme.of(context).colorScheme.background,
child: Column(
body: Column(
children: [
tabbarBuild(),
Expanded(
@ -646,8 +636,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
VideoIntroPanel(bvid: vdCtr.bvid),
] else if (vdCtr.videoType ==
SearchType.media_bangumi) ...[
Obx(() => BangumiIntroPanel(
cid: vdCtr.cid.value)),
Obx(() =>
BangumiIntroPanel(cid: vdCtr.cid.value)),
],
SliverToBoxAdapter(
child: Divider(
@ -678,7 +668,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
),
),
),
),
/// 重新进入会刷新
// 播放完成/暂停播放