opt: 【关注】按钮与自动播放界面跳变

获得数据后再淡入显示,避免关注按钮跳变(如已关注状态下,会先经历默认的高亮未关注状态,再跳变为暗色已关注)
自动播放开启时取消显示封面(与官方一致),避免黑屏-亮屏(加载出封面)-黑屏(缓冲视频流)-亮屏(显示视频)的闪烁过程
This commit is contained in:
orz12
2024-01-15 20:27:51 +08:00
parent db6662c980
commit 02bdb46625
2 changed files with 99 additions and 104 deletions

View File

@ -414,14 +414,18 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
),
),
const Spacer(),
AnimatedOpacity(
opacity: loadingStatus ? 0 : 1,
duration: const Duration(milliseconds: 150),
Obx(() => AnimatedOpacity(
opacity: loadingStatus ||
videoIntroController
.followStatus.isEmpty
? 0
: 1,
duration: const Duration(milliseconds: 50),
child: SizedBox(
height: 32,
child: Obx(
() =>
videoIntroController.followStatus.isNotEmpty
() => videoIntroController
.followStatus.isNotEmpty
? TextButton(
onPressed: videoIntroController
.actionRelationMod,
@ -455,7 +459,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
),
),
),
),
)),
],
),
),

View File

@ -388,6 +388,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
},
),
/// 关闭自动播放时 手动播放
if (!videoDetailController
.autoPlay.value) ...<Widget>[
Obx(
() => Visibility(
visible: videoDetailController
@ -412,15 +415,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
),
),
/// 关闭自动播放时 手动播放
Obx(
() => Visibility(
visible: videoDetailController
.isShowCover.value &&
videoDetailController
.isEffective.value &&
!videoDetailController
.autoPlay.value,
.isEffective.value,
child: Stack(
children: [
Positioned(
@ -429,7 +429,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
right: 0,
child: AppBar(
primary: false,
foregroundColor: Colors.white,
foregroundColor:
Colors.white,
elevation: 0,
scrolledUnderElevation: 0,
backgroundColor:
@ -458,27 +459,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
bottom: 10,
child: TextButton.icon(
style: ButtonStyle(
side: MaterialStateProperty
.resolveWith(
(states) {
return BorderSide(
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.5),
width: 1);
}),
backgroundColor:
MaterialStateProperty
.resolveWith(
(states) {
return Theme.of(context)
.colorScheme
.background
.withOpacity(0.6);
return Colors.white
.withOpacity(0.8);
}),
),
onPressed: () => handlePlay(),
onPressed: () =>
handlePlay(),
icon: const Icon(
Icons.play_circle_outline,
size: 20,
@ -489,6 +479,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
],
)),
),
]
],
);
},