Conference Call
Loading preview
Starting the Flutter app
Multi-participant video conferencing grid with mute and controls
import 'package:flutter/material.dart';
class ConferenceCall extends StatefulWidget {
const ConferenceCall({super.key});
@override
State<ConferenceCall> createState() => _ConferenceCallState();
}
class _ConferenceCallState extends State<ConferenceCall> {
final List<Map<String, dynamic>> _participants = [
{
'name': 'Sarah Johnson',
'avatar': 'S',
'isMuted': false,
'isSpeaking': true,
},
{'name': 'Mike Chen', 'avatar': 'M', 'isMuted': true, 'isSpeaking': false},
{
'name': 'Emma Wilson',
'avatar': 'E',
'isMuted': false,
'isSpeaking': false,
},
{
'name': 'James Brown',
'avatar': 'J',
'isMuted': true,
'isSpeaking': false,
},
{'name': 'Lisa Davis', 'avatar': 'L', 'isMuted': false, 'isSpeaking': true},
];
bool _isMuted = false;
bool _isSpeakerOn = true;
@override
Widget build(BuildContext context) {
final isDark = Theme.of(context).brightness == Brightness.dark;
return Scaffold(
backgroundColor: isDark ? Colors.grey[900] : Colors.blue[900],
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Team Meeting',
style: TextStyle(color: Colors.white, fontSize: 18),
),
Text(
'${_participants.length} participants',
style: TextStyle(
color: Colors.white.withValues(alpha: 0.7),
fontSize: 12,
),
),
],
),
actions: [
Container(
margin: const EdgeInsets.only(right: 16),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: Colors.red.withValues(alpha: 0.8),
borderRadius: BorderRadius.circular(20),
),
child: Row(
children: [
const Icon(Icons.circle, color: Colors.white, size: 8),
const SizedBox(width: 6),
Text(
'12:34',
style: TextStyle(
color: Colors.white.withValues(alpha: 0.9),
fontWeight: FontWeight.w500,
),
),
],
),
),
],
),
body: Column(
children: [
Expanded(
child: GridView.builder(
padding: const EdgeInsets.all(16),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 0.8,
crossAxisSpacing: 12,
mainAxisSpacing: 12,
),
itemCount: _participants.length,
itemBuilder: (context, index) {
final participant = _participants[index];
return _buildParticipantTile(participant, isDark);
},
),
),
Container(
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 24),
decoration: BoxDecoration(
color: isDark
? Colors.black38
: Colors.white.withValues(alpha: 0.1),
borderRadius: const BorderRadius.vertical(
top: Radius.circular(24),
),
),
child: SafeArea(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
_buildControlButton(
icon: _isMuted ? Icons.mic_off : Icons.mic,
label: _isMuted ? 'Unmute' : 'Mute',
isActive: _isMuted,
onTap: () => setState(() => _isMuted = !_isMuted),
),
_buildControlButton(
icon: Icons.call_end,
label: 'Leave',
color: Colors.red,
onTap: () => Navigator.pop(context),
),
_buildControlButton(
icon: Icons.person_add,
label: 'Invite',
onTap: () => _showDemo(context, 'Invite (demo)'),
),
_buildControlButton(
icon: Icons.chat_bubble_outline,
label: 'Chat',
onTap: () => _showDemo(context, 'Chat (demo)'),
),
_buildControlButton(
icon: _isSpeakerOn ? Icons.volume_up : Icons.volume_off,
label: 'Speaker',
isActive: _isSpeakerOn,
onTap: () => setState(() => _isSpeakerOn = !_isSpeakerOn),
),
],
),
),
),
],
),
);
}
Widget _buildParticipantTile(Map<String, dynamic> participant, bool isDark) {
final isSpeaking = participant['isSpeaking'] as bool;
final isMuted = participant['isMuted'] as bool;
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: isSpeaking ? Colors.green : Colors.transparent,
width: 3,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(13),
child: Stack(
fit: StackFit.expand,
children: [
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Colors.purple[700]!, Colors.blue[700]!],
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircleAvatar(
radius: 32,
backgroundColor: Colors.white24,
child: Text(
participant['avatar'],
style: const TextStyle(
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 8),
Text(
participant['name'],
style: const TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
),
if (isMuted)
Positioned(
bottom: 8,
right: 8,
child: Container(
padding: const EdgeInsets.all(6),
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
child: const Icon(
Icons.mic_off,
color: Colors.white,
size: 14,
),
),
),
],
),
),
);
}
Widget _buildControlButton({
required IconData icon,
required String label,
bool isActive = false,
Color? color,
required VoidCallback onTap,
}) {
return GestureDetector(
onTap: onTap,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 52,
height: 52,
decoration: BoxDecoration(
color: isActive
? Colors.white.withValues(alpha: 0.3)
: Colors.white.withValues(alpha: 0.2),
shape: BoxShape.circle,
),
child: Icon(icon, color: color ?? Colors.white, size: 24),
),
const SizedBox(height: 6),
Text(
label,
style: TextStyle(
color: Colors.white.withValues(alpha: 0.8),
fontSize: 11,
),
),
],
),
);
}
}
void _showDemo(BuildContext context, String message) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(message)));
}
Add it to your project
Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.
First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.
How it works
_participants is a fixed list of five maps, rendered as a two-column GridView.builder of avatar tiles with no video. _buildParticipantTile draws a green border for isSpeaking and a red badge for isMuted, but those flags never change. Your own _isMuted and _isSpeakerOn toggles only swap icons and labels, and the red pill’s ‘12:34’ is a literal.
Adapting it
- Feed
_participantsfrom an RTC SDK such as LiveKit, mapping active-speaker events toisSpeaking. - In
_buildParticipantTile, replace the gradientContainerwith the SDK’s video view. - Leave only calls
Navigator.pop, so disconnect from the room first, then connect the Invite and Chat_buildControlButtoncallbacks.