deewan 0.2.0
deewan: ^0.2.0 copied to clipboard
Deewan video meetings for Flutter. Embed an end-to-end encrypted meeting in one widget, or build your own interface with every participant feature.
example/lib/main.dart
import 'package:deewan/deewan.dart';
import 'package:flutter/material.dart';
/// Opens a Deewan meeting from a join link.
///
/// Your server makes the link with `POST /rooms/{id}/join-links` (never put an
/// API key in an app) and hands it to the app; here it is pasted in.
void main() => runApp(const ExampleApp());
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) => const MaterialApp(title: 'Deewan example', home: JoinScreen());
}
class JoinScreen extends StatefulWidget {
const JoinScreen({super.key});
@override
State<JoinScreen> createState() => _JoinScreenState();
}
class _JoinScreenState extends State<JoinScreen> {
final _link = TextEditingController();
@override
void dispose() {
_link.dispose();
super.dispose();
}
void _open() {
final url = _link.text.trim();
if (url.isEmpty) return;
Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (context) => Scaffold(
body: SafeArea(
child: DeewanMeetingView(
joinUrl: url,
onExit: (_) => Navigator.of(context).pop(),
onError: (message) => ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(message))),
),
),
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Deewan')),
body: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
TextField(controller: _link, decoration: const InputDecoration(labelText: 'Join link from your server')),
const SizedBox(height: 12),
FilledButton(onPressed: _open, child: const Text('Join meeting')),
],
),
),
);
}
}