fix: 屏幕阅读器点击按钮无声

This commit is contained in:
orz12
2024-08-25 23:52:10 +08:00
parent a7bfd4b156
commit d2b8c01ac4
4 changed files with 31 additions and 39 deletions

View File

@@ -102,9 +102,7 @@ class _BottomControlState extends State<BottomControl> {
canUsePiP = false;
}
if (canUsePiP) {
await widget.floating!.enable(
const EnableManual()
);
await widget.floating!.enable(const EnableManual());
} else {}
},
icon: const Icon(
@@ -117,9 +115,9 @@ class _BottomControlState extends State<BottomControl> {
const SizedBox(width: 4),
],
ComBtn(
tooltip: '全屏切换',
icon: const Icon(
Icons.fullscreen,
semanticLabel: '全屏切换',
size: 20,
color: Colors.white,
),

View File

@@ -231,6 +231,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: ComBtn(
icon: const Icon(
Icons.skip_previous,
semanticLabel: '上一集',
size: 22,
color: Colors.white,
),
@@ -246,7 +247,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
SmartDialog.showToast('已经是第一集了');
}
},
tooltip: '上一集',
),
),
@@ -263,6 +263,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: ComBtn(
icon: const Icon(
Icons.skip_next,
semanticLabel: '下一集',
size: 22,
color: Colors.white,
),
@@ -278,7 +279,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
SmartDialog.showToast('已经是最后一集了');
}
},
tooltip: '下一集',
),
),
@@ -327,10 +327,10 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: ComBtn(
icon: const Icon(
Icons.list,
semanticLabel: '选集',
size: 22,
color: Colors.white,
),
tooltip: '选集',
fuc: () {
int currentCid = widget.controller.cid;
String bvid = widget.controller.bvid;
@@ -466,9 +466,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
width: 42,
height: 30,
child: Obx(() => ComBtn(
tooltip: _.isFullScreen.value ? '退出全屏' : '全屏',
icon: Icon(
_.isFullScreen.value ? Icons.fullscreen_exit : Icons.fullscreen,
semanticLabel: _.isFullScreen.value ? '退出全屏' : '全屏',
size: 24,
color: Colors.white,
),
@@ -607,10 +607,12 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
void fullScreenTrigger(bool status) {
EasyThrottle.throttle(
'fullScreen', const Duration(milliseconds: 800), () async {
'fullScreen', const Duration(milliseconds: 800),
() async {
await _.triggerFullScreen(status: status);
});
}
if (cumulativeDy > threshold) {
_gestureType = 'center_down';
if (_.isFullScreen.value ^ fullScreenGestureReverse) {
@@ -1052,11 +1054,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
visible: _.showControls.value &&
(_.isFullScreen.value || _.controlsLock.value),
child: ComBtn(
tooltip: _.controlsLock.value ? '解锁' : '锁定',
icon: Icon(
_.controlsLock.value
? FontAwesomeIcons.lock
: FontAwesomeIcons.lockOpen,
semanticLabel: _.controlsLock.value ? '解锁' : '锁定',
size: 15,
color: Colors.white,
),
@@ -1077,9 +1079,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
child: Visibility(
visible: _.showControls.value && _.isFullScreen.value,
child: ComBtn(
tooltip: '截图',
icon: const Icon(
Icons.photo_camera,
semanticLabel: '截图',
size: 20,
color: Colors.white,
),
@@ -1224,7 +1226,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
Duration.zero,
player.state.duration,
);
player.seek(result);
widget.controller.seekTo(result, type: 'slider');
widget.controller.play();
},
),
@@ -1269,7 +1271,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
Duration.zero,
player.state.duration,
);
player.seek(result);
widget.controller.seekTo(result, type: 'slider');
widget.controller.play();
},
),

View File

@@ -3,12 +3,10 @@ import 'package:flutter/material.dart';
class ComBtn extends StatelessWidget {
final Widget? icon;
final Function? fuc;
final String tooltip;
const ComBtn({
this.icon,
this.fuc,
required this.tooltip,
super.key,
});
@@ -17,15 +15,11 @@ class ComBtn extends StatelessWidget {
return SizedBox(
width: 34,
height: 34,
child: IconButton(
tooltip: tooltip,
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () {
child: InkWell(
onTap: () {
fuc!();
},
icon: icon!,
child: icon!,
),
);
}

View File

@@ -66,19 +66,16 @@ class PlayOrPauseButtonState extends State<PlayOrPauseButton>
return SizedBox(
width: 42,
height: 34,
child: IconButton(
tooltip: widget.controller!.videoPlayerController!.state.playing
? '暂停'
: '播放',
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: player.playOrPause,
color: Colors.white,
iconSize: 25,
child: InkWell(
onTap: player.playOrPause,
// iconSize: widget.iconSize ?? _theme(context).buttonBarButtonSize,
// color: widget.iconColor ?? _theme(context).buttonBarButtonColor,
icon: AnimatedIcon(
child: Center(
child: AnimatedIcon(
semanticLabel:
widget.controller!.videoPlayerController!.state.playing
? '暂停'
: '播放',
progress: animation,
icon: AnimatedIcons.play_pause,
color: Colors.white,
@@ -87,6 +84,7 @@ class PlayOrPauseButtonState extends State<PlayOrPauseButton>
// color: widget.iconColor ?? _theme(context).buttonBarButtonColor,
),
),
),
);
}
}