Skip to main content
Monitor layout changes with LayoutListeners. This listener provides callbacks for call layout changes, participant list visibility, and Picture-in-Picture (PiP) mode state changes.

Prerequisites

Register Listener

Set the layoutListener on the CallSession to receive layout event callbacks:
Flutter listeners are not lifecycle-aware. You must manually remove the layout listener in your widget’s dispose() method to prevent memory leaks.

Callbacks

onCallLayoutChanged

Triggered when the call layout changes between Tile and Spotlight modes.
LayoutType Values: Use Cases:
  • Update layout toggle button icon
  • Adjust custom UI overlays
  • Log layout preference analytics

onParticipantListVisible

Triggered when the participant list panel becomes visible.
Use Cases:
  • Log analytics events
  • Adjust custom UI elements
  • Pause other UI animations

onParticipantListHidden

Triggered when the participant list panel is hidden.
Use Cases:
  • Restore UI elements
  • Resume animations
  • Update button states

onPictureInPictureLayoutEnabled

Triggered when Picture-in-Picture (PiP) mode is enabled.
Use Cases:
  • Hide call control buttons
  • Simplify UI for small window
  • Track PiP feature usage

onPictureInPictureLayoutDisabled

Triggered when Picture-in-Picture (PiP) mode is disabled.
Use Cases:
  • Restore call control buttons
  • Show full call UI
  • Resume normal layout

Complete Example

Here’s a complete example handling all layout events:

Remove Listener

Remove the layout listener in your widget’s dispose() method to prevent memory leaks:

Controlling Layout Programmatically

You can change the layout and PiP state programmatically:

Change Layout

Enable/Disable PiP


Initial Layout Configuration

Set the initial layout when joining a session:

Callbacks Summary

Next Steps

Layout & UI

Control layout programmatically

Session Settings

Configure initial layout settings