From d2b8c01ac4ac7bc07f55988a4be94260a23c8400 Mon Sep 17 00:00:00 2001 From: orz12 Date: Sun, 25 Aug 2024 23:52:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B1=8F=E5=B9=95=E9=98=85=E8=AF=BB?= =?UTF-8?q?=E5=99=A8=E7=82=B9=E5=87=BB=E6=8C=89=E9=92=AE=E6=97=A0=E5=A3=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live_room/widgets/bottom_control.dart | 6 ++-- lib/plugin/pl_player/view.dart | 20 ++++++------ lib/plugin/pl_player/widgets/common_btn.dart | 12 ++----- .../pl_player/widgets/play_pause_btn.dart | 32 +++++++++---------- 4 files changed, 31 insertions(+), 39 deletions(-) diff --git a/lib/pages/live_room/widgets/bottom_control.dart b/lib/pages/live_room/widgets/bottom_control.dart index b91cde18..50459ec4 100644 --- a/lib/pages/live_room/widgets/bottom_control.dart +++ b/lib/pages/live_room/widgets/bottom_control.dart @@ -102,9 +102,7 @@ class _BottomControlState extends State { 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 { const SizedBox(width: 4), ], ComBtn( - tooltip: '全屏切换', icon: const Icon( Icons.fullscreen, + semanticLabel: '全屏切换', size: 20, color: Colors.white, ), diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 53e64405..237cfb9b 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -231,6 +231,7 @@ class _PLVideoPlayerState extends State child: ComBtn( icon: const Icon( Icons.skip_previous, + semanticLabel: '上一集', size: 22, color: Colors.white, ), @@ -246,7 +247,6 @@ class _PLVideoPlayerState extends State SmartDialog.showToast('已经是第一集了'); } }, - tooltip: '上一集', ), ), @@ -263,6 +263,7 @@ class _PLVideoPlayerState extends State child: ComBtn( icon: const Icon( Icons.skip_next, + semanticLabel: '下一集', size: 22, color: Colors.white, ), @@ -278,7 +279,6 @@ class _PLVideoPlayerState extends State SmartDialog.showToast('已经是最后一集了'); } }, - tooltip: '下一集', ), ), @@ -327,10 +327,10 @@ class _PLVideoPlayerState extends State 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 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 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 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 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 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 Duration.zero, player.state.duration, ); - player.seek(result); + widget.controller.seekTo(result, type: 'slider'); widget.controller.play(); }, ), diff --git a/lib/plugin/pl_player/widgets/common_btn.dart b/lib/plugin/pl_player/widgets/common_btn.dart index 18ffa228..1da7691f 100644 --- a/lib/plugin/pl_player/widgets/common_btn.dart +++ b/lib/plugin/pl_player/widgets/common_btn.dart @@ -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!, ), ); } diff --git a/lib/plugin/pl_player/widgets/play_pause_btn.dart b/lib/plugin/pl_player/widgets/play_pause_btn.dart index 78933ef3..294be6fd 100644 --- a/lib/plugin/pl_player/widgets/play_pause_btn.dart +++ b/lib/plugin/pl_player/widgets/play_pause_btn.dart @@ -66,25 +66,23 @@ class PlayOrPauseButtonState extends State 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( - progress: animation, - icon: AnimatedIcons.play_pause, - color: Colors.white, - size: 20, - // size: widget.iconSize ?? _theme(context).buttonBarButtonSize, - // color: widget.iconColor ?? _theme(context).buttonBarButtonColor, + child: Center( + child: AnimatedIcon( + semanticLabel: + widget.controller!.videoPlayerController!.state.playing + ? '暂停' + : '播放', + progress: animation, + icon: AnimatedIcons.play_pause, + color: Colors.white, + size: 20, + // size: widget.iconSize ?? _theme(context).buttonBarButtonSize, + // color: widget.iconColor ?? _theme(context).buttonBarButtonColor, + ), ), ), );