opt: 【关注】按钮与自动播放界面跳变
获得数据后再淡入显示,避免关注按钮跳变(如已关注状态下,会先经历默认的高亮未关注状态,再跳变为暗色已关注) 自动播放开启时取消显示封面(与官方一致),避免黑屏-亮屏(加载出封面)-黑屏(缓冲视频流)-亮屏(显示视频)的闪烁过程
This commit is contained in:
@ -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
|
||||||
child: SizedBox(
|
.followStatus.isEmpty
|
||||||
height: 32,
|
? 0
|
||||||
child: Obx(
|
: 1,
|
||||||
() =>
|
duration: const Duration(milliseconds: 50),
|
||||||
videoIntroController.followStatus.isNotEmpty
|
child: SizedBox(
|
||||||
|
height: 32,
|
||||||
|
child: Obx(
|
||||||
|
() => videoIntroController
|
||||||
|
.followStatus.isNotEmpty
|
||||||
? TextButton(
|
? TextButton(
|
||||||
onPressed: videoIntroController
|
onPressed: videoIntroController
|
||||||
.actionRelationMod,
|
.actionRelationMod,
|
||||||
@ -453,9 +457,9 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
.actionRelationMod,
|
.actionRelationMod,
|
||||||
child: const Text('关注'),
|
child: const Text('关注'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -388,107 +388,98 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
Obx(
|
/// 关闭自动播放时 手动播放
|
||||||
() => Visibility(
|
if (!videoDetailController
|
||||||
visible: videoDetailController
|
.autoPlay.value) ...<Widget>[
|
||||||
.isShowCover.value,
|
Obx(
|
||||||
child: Positioned(
|
() => Visibility(
|
||||||
top: 0,
|
visible: videoDetailController
|
||||||
left: 0,
|
.isShowCover.value,
|
||||||
right: 0,
|
child: Positioned(
|
||||||
child: GestureDetector(
|
top: 0,
|
||||||
onTap: () {
|
left: 0,
|
||||||
handlePlay();
|
right: 0,
|
||||||
},
|
child: GestureDetector(
|
||||||
child: NetworkImgLayer(
|
onTap: () {
|
||||||
type: 'emote',
|
handlePlay();
|
||||||
src: videoDetailController
|
},
|
||||||
.videoItem['pic'],
|
child: NetworkImgLayer(
|
||||||
width: maxWidth,
|
type: 'emote',
|
||||||
height: maxHeight,
|
src: videoDetailController
|
||||||
|
.videoItem['pic'],
|
||||||
|
width: maxWidth,
|
||||||
|
height: maxHeight,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
/// 关闭自动播放时 手动播放
|
Obx(
|
||||||
Obx(
|
() => Visibility(
|
||||||
() => Visibility(
|
visible: videoDetailController
|
||||||
visible: videoDetailController
|
.isShowCover.value &&
|
||||||
.isShowCover.value &&
|
videoDetailController
|
||||||
videoDetailController
|
.isEffective.value,
|
||||||
.isEffective.value &&
|
child: Stack(
|
||||||
!videoDetailController
|
children: [
|
||||||
.autoPlay.value,
|
Positioned(
|
||||||
child: Stack(
|
top: 0,
|
||||||
children: [
|
left: 0,
|
||||||
Positioned(
|
right: 0,
|
||||||
top: 0,
|
child: AppBar(
|
||||||
left: 0,
|
primary: false,
|
||||||
right: 0,
|
foregroundColor:
|
||||||
child: AppBar(
|
Colors.white,
|
||||||
primary: false,
|
elevation: 0,
|
||||||
foregroundColor: Colors.white,
|
scrolledUnderElevation: 0,
|
||||||
elevation: 0,
|
|
||||||
scrolledUnderElevation: 0,
|
|
||||||
backgroundColor:
|
|
||||||
Colors.transparent,
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
tooltip: '稍后再看',
|
|
||||||
onPressed: () async {
|
|
||||||
var res = await UserHttp
|
|
||||||
.toViewLater(
|
|
||||||
bvid:
|
|
||||||
videoDetailController
|
|
||||||
.bvid);
|
|
||||||
SmartDialog.showToast(
|
|
||||||
res['msg']);
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons
|
|
||||||
.history_outlined),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 14)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
right: 12,
|
|
||||||
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:
|
backgroundColor:
|
||||||
MaterialStateProperty
|
Colors.transparent,
|
||||||
.resolveWith(
|
actions: [
|
||||||
(states) {
|
IconButton(
|
||||||
return Theme.of(context)
|
tooltip: '稍后再看',
|
||||||
.colorScheme
|
onPressed: () async {
|
||||||
.background
|
var res = await UserHttp
|
||||||
.withOpacity(0.6);
|
.toViewLater(
|
||||||
}),
|
bvid:
|
||||||
|
videoDetailController
|
||||||
|
.bvid);
|
||||||
|
SmartDialog.showToast(
|
||||||
|
res['msg']);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons
|
||||||
|
.history_outlined),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 14)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
onPressed: () => handlePlay(),
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.play_circle_outline,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
label: const Text('轻触封面播放'),
|
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
],
|
right: 12,
|
||||||
)),
|
bottom: 10,
|
||||||
),
|
child: TextButton.icon(
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor:
|
||||||
|
MaterialStateProperty
|
||||||
|
.resolveWith(
|
||||||
|
(states) {
|
||||||
|
return Colors.white
|
||||||
|
.withOpacity(0.8);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
onPressed: () =>
|
||||||
|
handlePlay(),
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.play_circle_outline,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
label: const Text('轻触封面播放'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
]
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user