Merge pull request #395 from orz12/opt-danmu-and-autoplay

opt: 封面点击播放
This commit is contained in:
guozhigq
2024-01-08 08:28:40 +08:00
committed by GitHub
2 changed files with 25 additions and 11 deletions

View File

@ -395,6 +395,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
top: 0, top: 0,
left: 0, left: 0,
right: 0, right: 0,
child: GestureDetector(
onTap: () {
handlePlay();
},
child: NetworkImgLayer( child: NetworkImgLayer(
type: 'emote', type: 'emote',
src: videoDetailController src: videoDetailController
@ -405,6 +409,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
), ),
), ),
), ),
),
/// 关闭自动播放时 手动播放 /// 关闭自动播放时 手动播放
Obx( Obx(
@ -452,13 +457,24 @@ 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 Theme.of(context)
.colorScheme .colorScheme
.primaryContainer; .background
.withOpacity(0.6);
}), }),
), ),
onPressed: () => handlePlay(), onPressed: () => handlePlay(),
@ -466,7 +482,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
Icons.play_circle_outline, Icons.play_circle_outline,
size: 20, size: 20,
), ),
label: const Text('Play'), label: const Text('轻触封面播放'),
), ),
), ),
], ],

View File

@ -792,10 +792,8 @@ class _HeaderControlState extends State<HeaderControl> {
danmakuDurationVal; danmakuDurationVal;
setState(() {}); setState(() {});
try { try {
final DanmakuOption currentOption =
danmakuController.option;
final DanmakuOption updatedOption = final DanmakuOption updatedOption =
currentOption.copyWith( danmakuController.option.copyWith(
duration: duration:
val / widget.controller!.playbackSpeed); val / widget.controller!.playbackSpeed);
danmakuController.updateOption(updatedOption); danmakuController.updateOption(updatedOption);