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(), const Spacer(),
AnimatedOpacity( Obx(() => AnimatedOpacity(
opacity: loadingStatus ? 0 : 1, opacity: loadingStatus ||
duration: const Duration(milliseconds: 150), videoIntroController
.followStatus.isEmpty
? 0
: 1,
duration: const Duration(milliseconds: 50),
child: SizedBox( child: SizedBox(
height: 32, height: 32,
child: Obx( child: Obx(
() => () => videoIntroController
videoIntroController.followStatus.isNotEmpty .followStatus.isNotEmpty
? TextButton( ? TextButton(
onPressed: videoIntroController onPressed: videoIntroController
.actionRelationMod, .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( Obx(
() => Visibility( () => Visibility(
visible: videoDetailController visible: videoDetailController
@ -412,15 +415,12 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
), ),
/// 关闭自动播放时 手动播放
Obx( Obx(
() => Visibility( () => Visibility(
visible: videoDetailController visible: videoDetailController
.isShowCover.value && .isShowCover.value &&
videoDetailController videoDetailController
.isEffective.value && .isEffective.value,
!videoDetailController
.autoPlay.value,
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
@ -429,7 +429,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
right: 0, right: 0,
child: AppBar( child: AppBar(
primary: false, primary: false,
foregroundColor: Colors.white, foregroundColor:
Colors.white,
elevation: 0, elevation: 0,
scrolledUnderElevation: 0, scrolledUnderElevation: 0,
backgroundColor: backgroundColor:
@ -458,27 +459,16 @@ class _VideoDetailPageState extends State<VideoDetailPage>
bottom: 10, bottom: 10,
child: TextButton.icon( child: TextButton.icon(
style: ButtonStyle( style: ButtonStyle(
side: MaterialStateProperty
.resolveWith(
(states) {
return BorderSide(
color: Theme.of(context)
.colorScheme
.primary
.withOpacity(0.5),
width: 1);
}),
backgroundColor: backgroundColor:
MaterialStateProperty MaterialStateProperty
.resolveWith( .resolveWith(
(states) { (states) {
return Theme.of(context) return Colors.white
.colorScheme .withOpacity(0.8);
.background
.withOpacity(0.6);
}), }),
), ),
onPressed: () => handlePlay(), onPressed: () =>
handlePlay(),
icon: const Icon( icon: const Icon(
Icons.play_circle_outline, Icons.play_circle_outline,
size: 20, size: 20,
@ -489,6 +479,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
], ],
)), )),
), ),
]
], ],
); );
}, },