diff --git a/android/app/src/main/kotlin/com/example/PiliPlus/MainActivity.kt b/android/app/src/main/kotlin/com/example/piliplus/MainActivity.kt similarity index 100% rename from android/app/src/main/kotlin/com/example/PiliPlus/MainActivity.kt rename to android/app/src/main/kotlin/com/example/piliplus/MainActivity.kt diff --git a/lib/pages/home/view.dart b/lib/pages/home/view.dart index 6215aaf83..2200659e5 100644 --- a/lib/pages/home/view.dart +++ b/lib/pages/home/view.dart @@ -231,7 +231,7 @@ Widget defaultUser({ width: 38, height: 38, child: IconButton( - tooltip: '默认用户头像', + tooltip: '点击登录', style: ButtonStyle( padding: const WidgetStatePropertyAll(EdgeInsets.zero), backgroundColor: WidgetStatePropertyAll( diff --git a/lib/pages/setting/models/play_settings.dart b/lib/pages/setting/models/play_settings.dart index 34e07caf7..26737dd21 100644 --- a/lib/pages/setting/models/play_settings.dart +++ b/lib/pages/setting/models/play_settings.dart @@ -140,18 +140,19 @@ List get playSettings => [ } }, ), - SettingsModel( - settingsType: SettingsType.sw1tch, - title: '最小化时暂停/还原时播放', - leading: const Icon(Icons.pause_circle_outline), - setKey: SettingBoxKey.pauseOnMinimize, - defaultVal: false, - onChanged: (value) { - try { - Get.find().pauseOnMinimize = value; - } catch (_) {} - }, - ), + if (Utils.isDesktop) + SettingsModel( + settingsType: SettingsType.sw1tch, + title: '最小化时暂停/还原时播放', + leading: const Icon(Icons.pause_circle_outline), + setKey: SettingBoxKey.pauseOnMinimize, + defaultVal: false, + onChanged: (value) { + try { + Get.find().pauseOnMinimize = value; + } catch (_) {} + }, + ), const SettingsModel( settingsType: SettingsType.sw1tch, title: '启用键盘控制', diff --git a/lib/pages/video/view.dart b/lib/pages/video/view.dart index 742100d40..e1e2b1333 100644 --- a/lib/pages/video/view.dart +++ b/lib/pages/video/view.dart @@ -198,7 +198,7 @@ class _VideoDetailPageVState extends State } // 播放器状态监听 - Future playerListener(PlayerStatus? status) async { + Future playerListener(PlayerStatus status) async { try { if (videoDetailController.scrollCtr.hasClients) { bool isPlaying = status == PlayerStatus.playing; diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index e51fd492d..711610758 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -2192,9 +2192,9 @@ class _PLVideoPlayerState extends State ); } - static const _overlaySpacing = 10.0; - static const _overlayItemWidth = 40.0; - static const _overlayHeight = 35.0; + static const _overlaySpacing = 5.0; + static const _actionItemWidth = 40.0; + static const _actionItemHeight = 35.0 - _triangleHeight; DanmakuItem? _suspendedDm; Offset? _dmOffset; @@ -2215,8 +2215,8 @@ class _PLVideoPlayerState extends State onTap(); }, child: SizedBox( - height: _overlayHeight, - width: _overlayItemWidth, + width: _actionItemWidth, + height: _actionItemHeight, child: Center( child: child, ), @@ -2250,12 +2250,12 @@ class _PLVideoPlayerState extends State final seekOffset = _getValidOffset(item.content.text); - final overlayWidth = _overlayItemWidth * (seekOffset == null ? 3 : 4); + final overlayWidth = _actionItemWidth * (seekOffset == null ? 3 : 4); final dy = item.content.type == DanmakuItemType.bottom ? maxHeight - item.yPosition - item.height : item.yPosition; - final top = dy + item.height + 4; + final top = dy + item.height + _triangleHeight + 2; final realLeft = dx + overlayWidth / 2; @@ -2277,112 +2277,114 @@ class _PLVideoPlayerState extends State return Positioned( right: right, top: top, - child: CustomPaint( - painter: _DanmakuTipPainter(offset: triangleOffset), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: switch (extra) { - null => throw UnimplementedError(), - VideoDanmaku() => [ - _dmActionItem( - extra.isLike - ? const Icon( - size: 20, - CustomIcons.player_dm_tip_like_solid, - color: Colors.white, - ) - : const Icon( - size: 20, - CustomIcons.player_dm_tip_like, - color: Colors.white, - ), - onTap: () => HeaderControl.likeDanmaku( - extra, - plPlayerController.cid!, + child: RepaintBoundary( + child: CustomPaint( + painter: _DanmakuTipPainter(offset: triangleOffset), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: switch (extra) { + null => throw UnimplementedError(), + VideoDanmaku() => [ + _dmActionItem( + extra.isLike + ? const Icon( + size: 20, + CustomIcons.player_dm_tip_like_solid, + color: Colors.white, + ) + : const Icon( + size: 20, + CustomIcons.player_dm_tip_like, + color: Colors.white, + ), + onTap: () => HeaderControl.likeDanmaku( + extra, + plPlayerController.cid!, + ), ), - ), - _dmActionItem( - const Icon( - size: 19, - CustomIcons.player_dm_tip_copy, - color: Colors.white, + _dmActionItem( + const Icon( + size: 19, + CustomIcons.player_dm_tip_copy, + color: Colors.white, + ), + onTap: () => Utils.copyText(item.content.text), ), - onTap: () => Utils.copyText(item.content.text), - ), - if (item.content.selfSend) + if (item.content.selfSend) + _dmActionItem( + const Icon( + size: 20, + CustomIcons.player_dm_tip_recall, + color: Colors.white, + ), + onTap: () => HeaderControl.deleteDanmaku( + extra.id, + plPlayerController.cid!, + ), + ) + else + _dmActionItem( + const Icon( + size: 20, + CustomIcons.player_dm_tip_back, + color: Colors.white, + ), + onTap: () => HeaderControl.reportDanmaku( + context, + extra: extra, + ctr: plPlayerController, + ), + ), + if (seekOffset != null) + _dmActionItem( + const Icon( + size: 18, + Icons.gps_fixed_outlined, + color: Colors.white, + ), + onTap: () => plPlayerController.seekTo( + Duration(seconds: seekOffset), + isSeek: false, + ), + ), + ], + LiveDanmaku() => [ _dmActionItem( const Icon( size: 20, - CustomIcons.player_dm_tip_recall, + MdiIcons.accountOutline, color: Colors.white, ), - onTap: () => HeaderControl.deleteDanmaku( - extra.id, - plPlayerController.cid!, + onTap: () => Get.toNamed('/member?mid=${extra.mid}'), + ), + _dmActionItem( + const Icon( + size: 19, + CustomIcons.player_dm_tip_copy, + color: Colors.white, ), - ) - else + onTap: () => Utils.copyText(item.content.text), + ), _dmActionItem( const Icon( size: 20, CustomIcons.player_dm_tip_back, color: Colors.white, ), - onTap: () => HeaderControl.reportDanmaku( + onTap: () => HeaderControl.reportLiveDanmaku( context, + roomId: (widget.bottomControl as live_bottom.BottomControl) + .liveRoomCtr + .roomId, + msg: item.content.text, extra: extra, ctr: plPlayerController, ), ), - if (seekOffset != null) - _dmActionItem( - const Icon( - size: 20, - Icons.gps_fixed_outlined, - color: Colors.white, - ), - onTap: () => plPlayerController.seekTo( - Duration(seconds: seekOffset), - isSeek: false, - ), - ), - ], - LiveDanmaku() => [ - _dmActionItem( - const Icon( - size: 20, - MdiIcons.accountOutline, - color: Colors.white, - ), - onTap: () => Get.toNamed('/member?mid=${extra.mid}'), - ), - _dmActionItem( - const Icon( - size: 19, - CustomIcons.player_dm_tip_copy, - color: Colors.white, - ), - onTap: () => Utils.copyText(item.content.text), - ), - _dmActionItem( - const Icon( - size: 20, - CustomIcons.player_dm_tip_back, - color: Colors.white, - ), - onTap: () => HeaderControl.reportLiveDanmaku( - context, - roomId: (widget.bottomControl as live_bottom.BottomControl) - .liveRoomCtr - .roomId, - msg: item.content.text, - extra: extra, - ctr: plPlayerController, - ), - ), - ], - }, + ], + }, + ), ), ), ); @@ -2732,6 +2734,8 @@ Widget buildViewPointWidget( ); } +const double _triangleHeight = 5.6; + class _DanmakuTipPainter extends CustomPainter { final double offset; @@ -2747,11 +2751,10 @@ class _DanmakuTipPainter extends CustomPainter { final strokePaint = Paint() ..color = const Color(0x7EFFFFFF) ..style = PaintingStyle.stroke - ..strokeWidth = 1.5; + ..strokeWidth = 1.25; final radius = size.height / 2; - final triangleHeight = size.height / 6; - final triangleBase = triangleHeight * 2 / 3; + const triangleBase = _triangleHeight * 2 / 3; final triangleCenterX = (size.width / 2 + offset).clamp( radius + triangleBase, @@ -2760,7 +2763,7 @@ class _DanmakuTipPainter extends CustomPainter { final path = Path() // triangle (exceed) ..moveTo(triangleCenterX - triangleBase, 0) - ..lineTo(triangleCenterX, -triangleHeight) + ..lineTo(triangleCenterX, -_triangleHeight) ..lineTo(triangleCenterX + triangleBase, 0) // top ..lineTo(size.width - radius, 0) diff --git a/lib/utils/storage_pref.dart b/lib/utils/storage_pref.dart index f233f6d0d..5d11c93cc 100644 --- a/lib/utils/storage_pref.dart +++ b/lib/utils/storage_pref.dart @@ -860,7 +860,7 @@ abstract class Pref { _setting.get(SettingBoxKey.enablePlayAll, defaultValue: true); static bool get enableTapDm => - _setting.get(SettingBoxKey.enableTapDm, defaultValue: Utils.isMobile); + _setting.get(SettingBoxKey.enableTapDm, defaultValue: true); static bool get showTrayIcon => _setting.get(SettingBoxKey.showTrayIcon, defaultValue: true);