AudioCardOptions class
Configuration options for the AudioCard
widget.
Provides properties to customize the audio-only participant card display, including mini-card avatar, animated waveform bars, mute controls, and overlay styling.
Core Display Properties:
name
: Participant display nameparticipant
: Participant model (used for mute state, audio level, permissions)parameters
: AudioCardParameters providing runtime state (audioDecibels, socket, etc.)customStyle
: BoxDecoration for outer container (background, border, etc.)backgroundColor
: Fallback background color (default: Colors.white)
Audio Visualization:
barColor
: Waveform bar color (default: red); animated based on audio levelsshowInfo
: If true, displays participant name badge (default: true)showControls
: If true, shows mute toggle button (default: true)
Avatar/Image Props:
imageSource
: Optional participant image URL for MiniCard avatarroundedImage
: If true, renders circular avatar (default: false)imageStyle
: BoxDecoration for avatar containertextColor
: Name badge text color (default: white)
Controls/Info Positioning:
controlsPosition
: Mute button placement: 'topLeft', 'topRight', 'bottomLeft', 'bottomRight' (default: 'topLeft')infoPosition
: Name badge placement: same options (default: 'topRight')videoInfoComponent
: Custom widget override for info area (replaces name badge)videoControlsComponent
: Custom widget override for controls area (replaces mute button)
Mute Control:
controlUserMedia
: Function handling mute/unmute actions; default=controlMedia
- Checks host/coHost permissions via
coHostResponsibility
- Sends socket events to mute remote participants
- Only host/coHost with
media
permission can mute others
- Checks host/coHost permissions via
Builder Hooks (5):
customBuilder
: Full widget replacement; receives AudioCardOptionswrapperBuilder
: Override Stack wrapper; receives stackChildren + defaultcontainerBuilder
: Override Container; receives child + defaultinfoBuilder
: Override name badge overlay; receives overlay + defaultoverlayBuilder
: Override waveform overlay; receives waveform + defaultwaveformBuilder
: Override animated bars; receives animationControllers + default
Styling Properties:
containerPadding
/containerMargin
/containerAlignment
: Outer container layoutoverlayDecoration
: BoxDecoration for waveform overlay layeroverlayPadding
: Padding for overlay content
Usage Patterns:
-
Basic Audio Card:
AudioCard( options: AudioCardOptions( name: 'John Doe', participant: participant, parameters: parameters, customStyle: BoxDecoration(color: Colors.grey[800], borderRadius: BorderRadius.circular(8)), ), )
-
Custom Waveform Colors:
AudioCard( options: AudioCardOptions( name: 'John Doe', participant: participant, parameters: parameters, barColor: Colors.green, customStyle: BoxDecoration(color: Colors.black), ), )
-
Hide Controls (View-Only):
AudioCard( options: AudioCardOptions( name: 'John Doe', participant: participant, parameters: parameters, showControls: false, ), )
-
Builder Hook Override:
AudioCard( options: AudioCardOptions( name: 'John Doe', participant: participant, parameters: parameters, infoBuilder: (context, overlay, defaultInfo) { return Column( children: [ Text('Custom Header'), defaultInfo, ], ); }, ), )
Override Integration:
Integrates with MediasfuUICustomOverrides
for global styling:
overrides: MediasfuUICustomOverrides(
audioCardOptions: ComponentOverride<AudioCardOptions>(
builder: (existingOptions) => AudioCardOptions(
name: existingOptions.name,
participant: existingOptions.participant,
parameters: existingOptions.parameters,
customStyle: BoxDecoration(border: Border.all(color: Colors.blue, width: 2)),
barColor: Colors.cyan,
),
),
),
Waveform Animation:
- Displays 9 animated bars representing audio levels
- Bar heights animate based on
audioDecibels
fromparameters.audioDecibels
- Animation controllers created in State (1 per bar)
- Bars hidden if participant muted or no audio detected
Permission-Based Mute:
- Host (islevel='2') can always mute others
- CoHost (islevel='1') can mute if
coHostResponsibility
includesmedia
permission - Participants (islevel='0') can only mute themselves
- Socket event
'controlMedia'
emitted when muting remote participants
Constructors
- AudioCardOptions({ControlMediaType controlUserMedia = controlMedia, required BoxDecoration customStyle, required String name, Color barColor = const Color.fromARGB(255, 240, 35, 35), Color textColor = Colors.white, String? imageSource, bool roundedImage = false, BoxDecoration? imageStyle, bool showControls = true, bool showInfo = true, Widget? videoInfoComponent, Widget? videoControlsComponent, String controlsPosition = 'topLeft', String infoPosition = 'topRight', required Participant participant, Color backgroundColor = Colors.white, required AudioCardParameters parameters, AudioCardType? customBuilder, EdgeInsetsGeometry? containerPadding, EdgeInsetsGeometry? containerMargin, AlignmentGeometry? containerAlignment, BoxDecoration? overlayDecoration, EdgeInsetsGeometry? overlayPadding, AudioCardWrapperBuilder? wrapperBuilder, AudioCardContainerBuilder? containerBuilder, AudioCardInfoBuilder? infoBuilder, AudioCardOverlayBuilder? overlayBuilder, AudioCardWaveformBuilder? waveformBuilder})
Properties
- backgroundColor → Color
-
final
- barColor → Color
-
final
- containerAlignment → AlignmentGeometry?
-
final
- containerBuilder → AudioCardContainerBuilder?
-
final
- containerMargin → EdgeInsetsGeometry?
-
final
- containerPadding → EdgeInsetsGeometry?
-
final
- controlsPosition → String
-
final
- controlUserMedia → ControlMediaType
-
final
- customBuilder → AudioCardType?
-
final
- customStyle → BoxDecoration
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- imageSource → String?
-
final
- imageStyle → BoxDecoration?
-
final
- infoBuilder → AudioCardInfoBuilder?
-
final
- infoPosition → String
-
final
- name → String
-
final
- overlayBuilder → AudioCardOverlayBuilder?
-
final
- overlayDecoration → BoxDecoration?
-
final
- overlayPadding → EdgeInsetsGeometry?
-
final
- parameters → AudioCardParameters
-
final
- participant → Participant
-
final
- roundedImage → bool
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showControls → bool
-
final
- showInfo → bool
-
final
- textColor → Color
-
final
- videoControlsComponent → Widget?
-
final
- videoInfoComponent → Widget?
-
final
- waveformBuilder → AudioCardWaveformBuilder?
-
final
- wrapperBuilder → AudioCardWrapperBuilder?
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited