From 0483e99a4c73894845edf5dee54daf23d88e5227 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 28 Apr 2024 00:21:16 +0800 Subject: [PATCH] :bug: Bug fixes of duplication --- lib/screens/chat/call.dart | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/screens/chat/call.dart b/lib/screens/chat/call.dart index 3f33b4c..f05c590 100644 --- a/lib/screens/chat/call.dart +++ b/lib/screens/chat/call.dart @@ -147,12 +147,12 @@ class _ChatCallState extends State { void autoPublish() async { try { - if(_enableVideo) await _callRoom.localParticipant?.setCameraEnabled(true); + if (_enableVideo) await _callRoom.localParticipant?.setCameraEnabled(true); } catch (error) { await context.showErrorDialog(error); } try { - if(_enableAudio) await _callRoom.localParticipant?.setMicrophoneEnabled(true); + if (_enableAudio) await _callRoom.localParticipant?.setMicrophoneEnabled(true); } catch (error) { await context.showErrorDialog(error); } @@ -277,6 +277,14 @@ class _ChatCallState extends State { } } } + + var checklistIdx = List.empty(growable: true); + userMediaTracks = userMediaTracks.where((element) { + if(checklistIdx.contains(element.participant.sid)) return false; + checklistIdx.add(element.participant.sid); + return true; + }).toList(); + setState(() { _participantTracks = [...screenTracks, ...userMediaTracks]; }); @@ -403,14 +411,21 @@ class _ChatCallState extends State { right: 0, top: 0, child: SizedBox( - height: 120, + height: 120 + 16, child: ListView.builder( scrollDirection: Axis.horizontal, itemCount: math.max(0, _participantTracks.length - 1), - itemBuilder: (BuildContext context, int index) => SizedBox( - width: 120, - height: 120, - child: ParticipantWidget.widgetFor(_participantTracks[index + 1]), + itemBuilder: (BuildContext context, int index) => Padding( + padding: const EdgeInsets.all(8.0), + child: ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(8)), + child: Container( + width: 120, + height: 120, + color: Theme.of(context).cardColor, + child: ParticipantWidget.widgetFor(_participantTracks[index + 1]), + ), + ), ), ), ),