diff --git a/lib/pages/live_room/view.dart b/lib/pages/live_room/view.dart index e8dfa452f..4aa209231 100644 --- a/lib/pages/live_room/view.dart +++ b/lib/pages/live_room/view.dart @@ -775,8 +775,8 @@ class _LiveRoomPageState extends State children: [ Obx( () { - final enableShowDanmaku = - plPlayerController.enableShowDanmaku.value; + final enableShowLiveDanmaku = + plPlayerController.enableShowLiveDanmaku.value; return SizedBox( width: 34, height: 34, @@ -785,16 +785,17 @@ class _LiveRoomPageState extends State padding: EdgeInsets.zero, ), onPressed: () { - final newVal = !enableShowDanmaku; - plPlayerController.enableShowDanmaku.value = newVal; + final newVal = !enableShowLiveDanmaku; + plPlayerController.enableShowLiveDanmaku.value = + newVal; if (!plPlayerController.tempPlayerConf) { GStorage.setting.put( - SettingBoxKey.enableShowDanmaku, + SettingBoxKey.enableShowLiveDanmaku, newVal, ); } }, - icon: enableShowDanmaku + icon: enableShowLiveDanmaku ? const Icon( size: 22, Icons.subtitles_outlined, @@ -1019,7 +1020,7 @@ class _LiveDanmakuState extends State { return Obx( () { return AnimatedOpacity( - opacity: plPlayerController.enableShowDanmaku.value ? 1 : 0, + opacity: plPlayerController.enableShowLiveDanmaku.value ? 1 : 0, duration: const Duration(milliseconds: 100), child: DanmakuScreen( createdController: (DanmakuController e) { diff --git a/lib/pages/live_room/widgets/bottom_control.dart b/lib/pages/live_room/widgets/bottom_control.dart index 9158d1200..d5dbcb913 100644 --- a/lib/pages/live_room/widgets/bottom_control.dart +++ b/lib/pages/live_room/widgets/bottom_control.dart @@ -70,10 +70,10 @@ class BottomControl extends StatelessWidget { const SizedBox(width: 3), Obx( () { - final enableShowDanmaku = - plPlayerController.enableShowDanmaku.value; + final enableShowLiveDanmaku = + plPlayerController.enableShowLiveDanmaku.value; return ComBtn( - icon: enableShowDanmaku + icon: enableShowLiveDanmaku ? const Icon( size: 18, Icons.subtitles_outlined, @@ -85,11 +85,11 @@ class BottomControl extends StatelessWidget { color: Colors.white, ), onTap: () { - final newVal = !enableShowDanmaku; - plPlayerController.enableShowDanmaku.value = newVal; + final newVal = !enableShowLiveDanmaku; + plPlayerController.enableShowLiveDanmaku.value = newVal; if (!plPlayerController.tempPlayerConf) { GStorage.setting.put( - SettingBoxKey.enableShowDanmaku, + SettingBoxKey.enableShowLiveDanmaku, newVal, ); } diff --git a/lib/pages/video/widgets/player_focus.dart b/lib/pages/video/widgets/player_focus.dart index b5c4e7a69..deb1a29aa 100644 --- a/lib/pages/video/widgets/player_focus.dart +++ b/lib/pages/video/widgets/player_focus.dart @@ -75,10 +75,18 @@ class PlayerFocus extends StatelessWidget { return true; case LogicalKeyboardKey.keyD: - final newVal = !plPlayerController.enableShowDanmaku.value; - plPlayerController.enableShowDanmaku.value = newVal; - if (!plPlayerController.tempPlayerConf) { - GStorage.setting.put(SettingBoxKey.enableShowDanmaku, newVal); + if (plPlayerController.isLive) { + final newVal = !plPlayerController.enableShowLiveDanmaku.value; + plPlayerController.enableShowLiveDanmaku.value = newVal; + if (!plPlayerController.tempPlayerConf) { + GStorage.setting.put(SettingBoxKey.enableShowLiveDanmaku, newVal); + } + } else { + final newVal = !plPlayerController.enableShowDanmaku.value; + plPlayerController.enableShowDanmaku.value = newVal; + if (!plPlayerController.tempPlayerConf) { + GStorage.setting.put(SettingBoxKey.enableShowDanmaku, newVal); + } } return true; diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 5e2118b63..e1a11664e 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -254,7 +254,8 @@ class PlPlayerController { bool get isLive => _isLive; /// 弹幕开关 - RxBool enableShowDanmaku = Pref.enableShowDanmaku.obs; + late final RxBool enableShowDanmaku = Pref.enableShowDanmaku.obs; + late final RxBool enableShowLiveDanmaku = Pref.enableShowLiveDanmaku.obs; late final bool autoPiP = Pref.autoPiP; diff --git a/lib/utils/storage_key.dart b/lib/utils/storage_key.dart index 1fdecd679..df57f4cb4 100644 --- a/lib/utils/storage_key.dart +++ b/lib/utils/storage_key.dart @@ -167,6 +167,7 @@ abstract class SettingBoxKey { blockTrack = 'blockTrack'; static const String enableShowDanmaku = 'enableShowDanmaku', + enableShowLiveDanmaku = 'enableShowLiveDanmaku', pipNoDanmaku = 'pipNoDanmaku', showVipDanmaku = 'showVipDanmaku', showSpecialDanmaku = 'showSpecialDanmaku', diff --git a/lib/utils/storage_pref.dart b/lib/utils/storage_pref.dart index ed82c6e13..c8a150869 100644 --- a/lib/utils/storage_pref.dart +++ b/lib/utils/storage_pref.dart @@ -635,6 +635,9 @@ abstract class Pref { static bool get enableShowDanmaku => _setting.get(SettingBoxKey.enableShowDanmaku, defaultValue: true); + static bool get enableShowLiveDanmaku => + _setting.get(SettingBoxKey.enableShowLiveDanmaku, defaultValue: true); + static bool get enableQuickFav => _setting.get(SettingBoxKey.enableQuickFav, defaultValue: false);