Customize CometChat Calls SDK v5 call layouts on Flutter with tile, spotlight, sidebar views, layout changes, and layout events.
Choose how participants are displayed during a call. The SDK provides multiple layout options to suit different use cases like team meetings, presentations, or one-on-one calls.
class _LayoutListener extends LayoutListeners { @override void onCallLayoutChanged(LayoutType layoutType) { switch (layoutType) { case LayoutType.tile: debugPrint("Switched to Tile layout"); break; case LayoutType.spotlight: debugPrint("Switched to Spotlight layout"); break; case LayoutType.sidebar: debugPrint("Switched to Sidebar layout"); break; } // Update layout toggle button icon updateLayoutIcon(layoutType); } // every other callback already defaults to a no-op on the abstract class — // override only what you need (onParticipantListVisible, onParticipantListHidden, onPictureInPictureLayoutEnabled, onPictureInPictureLayoutDisabled).}CallSession? callSession = CallSession.getInstance();callSession?.layoutListener = _LayoutListener();
Flutter listeners are not lifecycle-aware. You must manually remove the layout listener in your widget’s dispose() method to prevent memory leaks: