2024-06-01 12:18:25 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-09-07 09:45:44 +00:00
|
|
|
import 'package:gap/gap.dart';
|
2024-08-02 10:29:01 +00:00
|
|
|
import 'package:get/get.dart';
|
2024-06-01 12:18:25 +00:00
|
|
|
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(
|
|
|
|
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.75),
|
|
|
|
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,
|
|
|
|
style: const TextStyle(color: Colors.white),
|
|
|
|
),
|
|
|
|
),
|
2024-09-07 09:45:44 +00:00
|
|
|
const Gap(5),
|
2024-06-01 12:18:25 +00:00
|
|
|
isScreenShare
|
2024-08-02 10:29:01 +00:00
|
|
|
? const Icon(
|
|
|
|
Icons.monitor,
|
|
|
|
color: Colors.white,
|
|
|
|
size: 16,
|
2024-06-01 12:18:25 +00:00
|
|
|
)
|
2024-08-02 10:29:01 +00:00
|
|
|
: Icon(
|
|
|
|
audioAvailable ? Icons.mic : Icons.mic_off,
|
|
|
|
color: audioAvailable ? Colors.white : Colors.red,
|
|
|
|
size: 16,
|
2024-06-01 12:18:25 +00:00
|
|
|
),
|
2024-09-07 09:45:44 +00:00
|
|
|
const Gap(3),
|
2024-06-01 12:18:25 +00:00
|
|
|
if (connectionQuality != ConnectionQuality.unknown)
|
2024-08-02 10:29:01 +00:00
|
|
|
Icon(
|
|
|
|
{
|
|
|
|
ConnectionQuality.excellent: Icons.signal_cellular_alt,
|
|
|
|
ConnectionQuality.good: Icons.signal_cellular_alt_2_bar,
|
|
|
|
ConnectionQuality.poor: Icons.signal_cellular_alt_1_bar,
|
|
|
|
}[connectionQuality],
|
|
|
|
color: {
|
|
|
|
ConnectionQuality.excellent: Colors.green,
|
|
|
|
ConnectionQuality.good: Colors.orange,
|
|
|
|
ConnectionQuality.poor: Colors.red,
|
|
|
|
}[connectionQuality],
|
|
|
|
size: 16,
|
|
|
|
)
|
|
|
|
else
|
|
|
|
const SizedBox(
|
|
|
|
width: 12,
|
|
|
|
height: 12,
|
|
|
|
child: CircularProgressIndicator(
|
|
|
|
color: Colors.white,
|
|
|
|
strokeWidth: 2,
|
2024-06-01 12:18:25 +00:00
|
|
|
),
|
2024-08-02 10:29:01 +00:00
|
|
|
).paddingAll(3),
|
2024-06-01 12:18:25 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|