💄 Optimized signal indicator

This commit is contained in:
LittleSheep 2024-08-02 18:29:01 +08:00
parent 7e8993fbd2
commit 7d45c06302
2 changed files with 50 additions and 48 deletions

View File

@ -217,28 +217,25 @@ class InteractiveParticipantWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return GestureDetector(
color: Colors.transparent, child: Container(
child: GestureDetector( width: width,
child: Container( height: height,
width: width, color: color,
height: height, child: ParticipantWidget.widgetFor(participant, isFixed: isFixed),
color: color,
child: ParticipantWidget.widgetFor(participant, isFixed: isFixed),
),
onTap: () => onTap(),
onLongPress: () {
if (participant.participant is LocalParticipant) return;
showModalBottomSheet(
context: context,
builder: (context) => ParticipantMenu(
participant: participant.participant as RemoteParticipant,
videoTrack: participant.videoTrack,
isScreenShare: participant.isScreenShare,
),
);
},
), ),
onTap: () => onTap(),
onLongPress: () {
if (participant.participant is LocalParticipant) return;
showModalBottomSheet(
context: context,
builder: (context) => ParticipantMenu(
participant: participant.participant as RemoteParticipant,
videoTrack: participant.videoTrack,
isScreenShare: participant.isScreenShare,
),
);
},
); );
} }
} }

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:livekit_client/livekit_client.dart'; import 'package:livekit_client/livekit_client.dart';
class ParticipantInfoWidget extends StatelessWidget { class ParticipantInfoWidget extends StatelessWidget {
@ -34,38 +35,42 @@ class ParticipantInfoWidget extends StatelessWidget {
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
), ),
const SizedBox(width: 5),
isScreenShare isScreenShare
? const Padding( ? const Icon(
padding: EdgeInsets.only(left: 5), Icons.monitor,
child: Icon( color: Colors.white,
Icons.monitor, size: 16,
color: Colors.white,
size: 16,
),
) )
: Padding( : Icon(
padding: const EdgeInsets.only(left: 5), audioAvailable ? Icons.mic : Icons.mic_off,
child: Icon( color: audioAvailable ? Colors.white : Colors.red,
audioAvailable ? Icons.mic : Icons.mic_off, size: 16,
color: audioAvailable ? Colors.white : Colors.red,
size: 16,
),
), ),
const SizedBox(width: 3),
if (connectionQuality != ConnectionQuality.unknown) if (connectionQuality != ConnectionQuality.unknown)
Padding( Icon(
padding: const EdgeInsets.only(left: 5), {
child: Icon( ConnectionQuality.excellent: Icons.signal_cellular_alt,
connectionQuality == ConnectionQuality.poor ConnectionQuality.good: Icons.signal_cellular_alt_2_bar,
? Icons.wifi_off_outlined ConnectionQuality.poor: Icons.signal_cellular_alt_1_bar,
: Icons.wifi, }[connectionQuality],
color: { color: {
ConnectionQuality.excellent: Colors.green, ConnectionQuality.excellent: Colors.green,
ConnectionQuality.good: Colors.orange, ConnectionQuality.good: Colors.orange,
ConnectionQuality.poor: Colors.red, ConnectionQuality.poor: Colors.red,
}[connectionQuality], }[connectionQuality],
size: 16, size: 16,
)
else
const SizedBox(
width: 12,
height: 12,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
), ),
), ).paddingAll(3),
], ],
), ),
); );