Create android & web plugins (#15)
* create android & web plugins * apply `flutter format .`
This commit is contained in:
@@ -24,7 +24,8 @@ extension LKExampleExt on BuildContext {
|
||||
context: this,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('UnPublish'),
|
||||
content: const Text('Would you like to un-publish your Camera & Mic ?'),
|
||||
content:
|
||||
const Text('Would you like to un-publish your Camera & Mic ?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
@@ -92,7 +93,8 @@ extension LKExampleExt on BuildContext {
|
||||
context: this,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: const Text('Send data'),
|
||||
content: const Text('This will send a sample data to all participants in the room'),
|
||||
content: const Text(
|
||||
'This will send a sample data to all participants in the room'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
|
||||
@@ -65,7 +65,8 @@ class _ConnectPageState extends State<ConnectPage> {
|
||||
// Save for next time
|
||||
await _writePrefs();
|
||||
|
||||
print('Connecting with url: ${_uriCtrl.text}, token: ${_tokenCtrl.text}...');
|
||||
print(
|
||||
'Connecting with url: ${_uriCtrl.text}, token: ${_tokenCtrl.text}...');
|
||||
|
||||
final room = await LiveKitClient.connect(
|
||||
_uriCtrl.text,
|
||||
@@ -113,7 +114,8 @@ class _ConnectPageState extends State<ConnectPage> {
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: Theme.of(context).colorScheme.secondary),
|
||||
border:
|
||||
Border.all(color: Theme.of(context).colorScheme.secondary),
|
||||
),
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: 320,
|
||||
|
||||
@@ -50,7 +50,8 @@ class _RoomPageState extends State<RoomPage> {
|
||||
|
||||
void _setUpListeners() => _listener
|
||||
..on<RoomDisconnectedEvent>((_) async {
|
||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) => Navigator.pop(context));
|
||||
WidgetsBinding.instance
|
||||
?.addPostFrameCallback((timeStamp) => Navigator.pop(context));
|
||||
})
|
||||
..on<DataReceivedEvent>((event) {
|
||||
String decoded = 'Failed to decode';
|
||||
@@ -120,7 +121,8 @@ class _RoomPageState extends State<RoomPage> {
|
||||
}
|
||||
|
||||
// joinedAt
|
||||
return a.joinedAt.millisecondsSinceEpoch - b.joinedAt.millisecondsSinceEpoch;
|
||||
return a.joinedAt.millisecondsSinceEpoch -
|
||||
b.joinedAt.millisecondsSinceEpoch;
|
||||
});
|
||||
|
||||
if (participants.length > 1) {
|
||||
@@ -138,8 +140,9 @@ class _RoomPageState extends State<RoomPage> {
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child:
|
||||
participants.isNotEmpty ? ParticipantWidget(participants.first) : Container()),
|
||||
child: participants.isNotEmpty
|
||||
? ParticipantWidget(participants.first)
|
||||
: Container()),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
child: ListView.builder(
|
||||
@@ -149,7 +152,8 @@ class _RoomPageState extends State<RoomPage> {
|
||||
width: 100,
|
||||
height: 100,
|
||||
padding: const EdgeInsets.all(2),
|
||||
child: ParticipantWidget(participants[index + 1], quality: VideoQuality.LOW),
|
||||
child: ParticipantWidget(participants[index + 1],
|
||||
quality: VideoQuality.LOW),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -32,7 +32,8 @@ class LiveKitTheme {
|
||||
foregroundColor: MaterialStateProperty.all<Color>(Colors.white),
|
||||
// backgroundColor: MaterialStateProperty.all<Color>(accentColor),
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
if (states.contains(MaterialState.disabled)) return accentColor.withOpacity(0.5);
|
||||
if (states.contains(MaterialState.disabled))
|
||||
return accentColor.withOpacity(0.5);
|
||||
return accentColor;
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -89,7 +89,8 @@ class _ControlsWidgetState extends State<ControlsWidget> {
|
||||
|
||||
void _toggleCamera() async {
|
||||
//
|
||||
final track = participant.videoTracks.firstOrNull?.track as LocalVideoTrack?;
|
||||
final track =
|
||||
participant.videoTracks.firstOrNull?.track as LocalVideoTrack?;
|
||||
if (track == null) return;
|
||||
|
||||
try {
|
||||
@@ -113,7 +114,8 @@ class _ControlsWidgetState extends State<ControlsWidget> {
|
||||
}
|
||||
|
||||
try {
|
||||
final screenTrack = await LocalVideoTrack.createScreenTrack(); // Defaults to camera
|
||||
final screenTrack =
|
||||
await LocalVideoTrack.createScreenTrack(); // Defaults to camera
|
||||
await widget.room.localParticipant.publishVideoTrack(
|
||||
screenTrack,
|
||||
);
|
||||
@@ -177,7 +179,9 @@ class _ControlsWidgetState extends State<ControlsWidget> {
|
||||
icon: const Icon(EvaIcons.videoOff),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(position == CameraPosition.back ? EvaIcons.camera : EvaIcons.person),
|
||||
icon: Icon(position == CameraPosition.back
|
||||
? EvaIcons.camera
|
||||
: EvaIcons.person),
|
||||
onPressed: () => _toggleCamera(),
|
||||
),
|
||||
IconButton(
|
||||
|
||||
@@ -50,7 +50,8 @@ class _ParticipantWidgetState extends State<ParticipantWidget> {
|
||||
// register for change so Flutter will re-build the widget upon change
|
||||
void _onParticipantChanged() {
|
||||
//
|
||||
final firstAudio = widget.participant.audioTracks.firstWhereOrNull((pub) => pub.subscribed);
|
||||
final firstAudio = widget.participant.audioTracks
|
||||
.firstWhereOrNull((pub) => pub.subscribed);
|
||||
final firstVideo = widget.participant.videoTracks
|
||||
.firstWhereOrNull((pub) => !pub.isScreenShare && pub.subscribed);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user