2024-04-27 05:12:26 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:livekit_client/livekit_client.dart';
|
|
|
|
|
|
|
|
class ParticipantInfoWidget extends StatelessWidget {
|
|
|
|
final String? title;
|
|
|
|
final bool audioAvailable;
|
|
|
|
final ConnectionQuality connectionQuality;
|
|
|
|
final bool isScreenShare;
|
|
|
|
|
|
|
|
const ParticipantInfoWidget({
|
|
|
|
super.key,
|
|
|
|
this.title,
|
|
|
|
this.audioAvailable = true,
|
|
|
|
this.connectionQuality = ConnectionQuality.unknown,
|
|
|
|
this.isScreenShare = false,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) => Container(
|
2024-04-27 16:07:32 +00:00
|
|
|
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.75),
|
2024-04-27 05:12:26 +00:00
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
vertical: 7,
|
|
|
|
horizontal: 10,
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
if (title != null)
|
|
|
|
Flexible(
|
|
|
|
child: Text(
|
|
|
|
title!,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
2024-04-27 16:07:32 +00:00
|
|
|
style: const TextStyle(color: Colors.white),
|
2024-04-27 05:12:26 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
isScreenShare
|
|
|
|
? const Padding(
|
|
|
|
padding: EdgeInsets.only(left: 5),
|
|
|
|
child: Icon(
|
|
|
|
Icons.monitor,
|
|
|
|
color: Colors.white,
|
|
|
|
size: 16,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 5),
|
|
|
|
child: Icon(
|
|
|
|
audioAvailable ? Icons.mic : Icons.mic_off,
|
|
|
|
color: audioAvailable ? Colors.white : Colors.red,
|
|
|
|
size: 16,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (connectionQuality != ConnectionQuality.unknown)
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(left: 5),
|
|
|
|
child: Icon(
|
2024-05-01 09:37:34 +00:00
|
|
|
connectionQuality == ConnectionQuality.poor
|
|
|
|
? Icons.wifi_off_outlined
|
|
|
|
: Icons.wifi,
|
2024-04-27 05:12:26 +00:00
|
|
|
color: {
|
|
|
|
ConnectionQuality.excellent: Colors.green,
|
|
|
|
ConnectionQuality.good: Colors.orange,
|
|
|
|
ConnectionQuality.poor: Colors.red,
|
|
|
|
}[connectionQuality],
|
|
|
|
size: 16,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|