@@ -51,12 +51,16 @@ Widget buildFullControls(
5151 buildDanmuView (videoState, controller),
5252
5353 // 左下角SC显示
54- Visibility (
55- visible: (! Platform .isAndroid && ! Platform .isIOS) || controller.fullScreenState.value,
56- child: Positioned (
57- left: 24 ,
58- bottom: 24 ,
59- child: PlayerSuperChatOverlay (controller: controller),
54+ Obx (
55+ () => Visibility (
56+ visible: AppSettingsController .instance.playershowSuperChat.value &&
57+ ((! Platform .isAndroid && ! Platform .isIOS) ||
58+ controller.fullScreenState.value),
59+ child: Positioned (
60+ left: 24 ,
61+ bottom: 24 ,
62+ child: PlayerSuperChatOverlay (controller: controller),
63+ ),
6064 ),
6165 ),
6266
@@ -286,7 +290,8 @@ Widget buildFullControls(
286290 padding: const EdgeInsets .only (left: 8.0 ),
287291 child: Text (
288292 controller.liveDuration.value,
289- style: const TextStyle (fontSize: 14 , color: Colors .white),
293+ style:
294+ const TextStyle (fontSize: 14 , color: Colors .white),
290295 ),
291296 ),
292297 ),
@@ -432,12 +437,16 @@ Widget buildControls(
432437 buildDanmuView (videoState, controller),
433438
434439 // 左下角SC显示
435- Visibility (
436- visible: (! Platform .isAndroid && ! Platform .isIOS) || controller.fullScreenState.value,
437- child: Positioned (
438- left: 24 ,
439- bottom: 24 ,
440- child: PlayerSuperChatOverlay (controller: controller),
440+ Obx (
441+ () => Visibility (
442+ visible: AppSettingsController .instance.playershowSuperChat.value &&
443+ ((! Platform .isAndroid && ! Platform .isIOS) ||
444+ controller.fullScreenState.value),
445+ child: Positioned (
446+ left: 24 ,
447+ bottom: 24 ,
448+ child: PlayerSuperChatOverlay (controller: controller),
449+ ),
441450 ),
442451 ),
443452
@@ -907,7 +916,12 @@ class PlayerSuperChatCard extends StatefulWidget {
907916 final LiveSuperChatMessage message;
908917 final VoidCallback onExpire;
909918 final int duration;
910- const PlayerSuperChatCard ({required this .message, required this .onExpire, required this .duration, Key ? key}) : super (key: key);
919+ const PlayerSuperChatCard (
920+ {required this .message,
921+ required this .onExpire,
922+ required this .duration,
923+ Key ? key})
924+ : super (key: key);
911925 @override
912926 State <PlayerSuperChatCard > createState () => _PlayerSuperChatCardState ();
913927}
@@ -930,11 +944,13 @@ class _PlayerSuperChatCardState extends State<PlayerSuperChatCard> {
930944 });
931945 });
932946 }
947+
933948 @override
934949 void dispose () {
935950 timer.cancel ();
936951 super .dispose ();
937952 }
953+
938954 @override
939955 Widget build (BuildContext context) {
940956 return Opacity (
@@ -957,7 +973,8 @@ class LocalDisplaySC {
957973
958974class PlayerSuperChatOverlay extends StatefulWidget {
959975 final LiveRoomController controller;
960- const PlayerSuperChatOverlay ({required this .controller, Key ? key}) : super (key: key);
976+ const PlayerSuperChatOverlay ({required this .controller, Key ? key})
977+ : super (key: key);
961978 @override
962979 State <PlayerSuperChatOverlay > createState () => _PlayerSuperChatOverlayState ();
963980}
@@ -994,7 +1011,8 @@ class _PlayerSuperChatOverlayState extends State<PlayerSuperChatOverlay> {
9941011 }
9951012 }
9961013 // 监听SC列表变化
997- _worker = ever <List <LiveSuperChatMessage >>(widget.controller.superChats, (list) {
1014+ _worker =
1015+ ever <List <LiveSuperChatMessage >>(widget.controller.superChats, (list) {
9981016 // 新增
9991017 for (var sc in list) {
10001018 if (! _displayed.any ((e) => e.sc == sc)) {
@@ -1018,7 +1036,8 @@ class _PlayerSuperChatOverlayState extends State<PlayerSuperChatOverlay> {
10181036
10191037 @override
10201038 Widget build (BuildContext context) {
1021- final sorted = _displayed.toList ()..sort ((a, b) => a.sc.endTime.compareTo (b.sc.endTime));
1039+ final sorted = _displayed.toList ()
1040+ ..sort ((a, b) => a.sc.endTime.compareTo (b.sc.endTime));
10221041 return Column (
10231042 crossAxisAlignment: CrossAxisAlignment .start,
10241043 children: [
0 commit comments