Seats and layouts
Seat actions, seat modes and custom seat layouts in the audio room kit.
Built-in seat actions
You don't need any code for the common cases. Tapping an empty seat takes it, and tapping your own seat leaves it. Hosts and admins get a sheet with mute, kick, lock and invite.
To replace that sheet, pass onSeatTap. To be told when seats change, pass onSeatChanged.
Control seats from code
Get the controller from onControllerReady, then use seatController:
final me = controller.localIdentity!;
await controller.seatController.takeSeat(0, me);
await controller.seatController.moveSeat(me, 3);
await controller.seatController.leaveSeat(me);
// Host and admin actions
await controller.seatController.lockSeat(2, identity: me);
await controller.seatController.unlockSeat(2, identity: me);
await controller.seatController.muteSeat(1, identity: me);
await controller.seatController.unmuteSeat(1, identity: me);
await controller.seatController.kickFromSeat(1, identity: me);The current seats are in a ValueNotifier:
controller.seatController.seats.addListener(() {
final seats = controller.seatController.seats.value;
debugPrint('${seats.length} seats');
});Layout modes
The kit ships one layout: mode '3', with 9 seats in a 3×3 grid. Register your own with modes, and select one with layoutMode:
VoxeraAudioRoom(
appId: appId,
appKey: appKey,
userId: userId,
userName: userName,
roomId: roomId,
roomOwnerId: roomOwnerId,
layoutMode: 'party',
modes: const [
VoxeraRoomMode(id: 'party', seatCount: 8, rows: [[0, 1, 2, 3], [4, 5, 6, 7]]),
],
);Each number in rows is a seat index, and each inner list is one row on screen. A room can have 1 to 100 seats.
Custom seat appearance
These VoxeraAudioRoomConfig fields change how seats are drawn, without changing what they do:
| Field | Replaces |
|---|---|
seatBuilder | The whole seat |
avatarBuilder | The avatar of an occupied seat |
emptySeatBuilder | An empty seat |
lockedSeatBuilder | A locked seat |
Occupant names and avatars come from userInRoomAttributes, which each user shares when they join:
VoxeraAudioRoomConfig(
userInRoomAttributes: {'avatar': 'https://example.com/a.webp', 'name': 'John'},
);Seat modes
A room's seat mode decides who can sit down:
free: anyone can take an open, unlocked seat.request: everyone except hosts and admins must request to speak or be invited first.
The server APIs for this are in Seats and speakers.