MainAspectComponentOptions class
Configuration options for the MainAspectComponent
widget.
Defines styling, sizing fractions, and responsive callbacks for the primary video area. This component typically occupies the main portion of the screen and adjusts dimensions based on control visibility, screen size, and safe area insets.
Properties:
backgroundColor
: Background color for the container (visible when no children fill the area)children
: List of widgets rendered in Stack (e.g., main video grid, participant cards, overlays)showControls
: Visibility flag affecting height calculation (true = applydefaultFraction
to height; false = subtract safe area top inset)containerWidthFraction
: Width as fraction of screen width (0.0-1.0). Defaults to 1.0 (full width)containerHeightFraction
: Height as fraction of screen height (0.0-1.0). Defaults to 1.0 (full height)defaultFraction
: Height reduction factor whenshowControls = true
(e.g., 0.94 = 94% height to reserve space for controls). Defaults to 0.94updateIsWideScreen
: Callback invoked when wide screen state changes (parentWidth > 768 or aspectRatio > 1.5)updateIsMediumScreen
: Callback invoked when medium screen state changes (576 < parentWidth ≤ 768)updateIsSmallScreen
: Callback invoked when small screen state changes (parentWidth ≤ 576)
Dimension Calculation Logic:
Width:
parentWidth = screenWidth * containerWidthFraction
Height (when showControls = true):
parentHeight = screenHeight * containerHeightFraction * defaultFraction
(Applies defaultFraction to reserve space for control bar)
Height (when showControls = false):
parentHeight = screenHeight * containerHeightFraction - safeAreaTop
(Subtracts safe area inset to avoid notch/status bar overlap)
Screen Size Breakpoints:
Small: parentWidth ≤ 576px (mobile portrait)
Medium: 576px < parentWidth ≤ 768px (mobile landscape, small tablets)
Wide: parentWidth > 768px OR aspectRatio > 1.5 (tablets, desktops, wide screens)
Special case: If aspectRatio > 1.5 (very wide screen), force isWideScreen=true
Callback Invocation:
- Called in
initState()
(addPostFrameCallback) for initial state - Called in
didChangeMetrics()
(WidgetsBindingObserver) on screen rotation, resize, or keyboard visibility change - Callbacks update parent state to trigger responsive layout adjustments elsewhere
Common Configurations:
// 1. Full-screen main video area with control bar space
MainAspectComponentOptions(
backgroundColor: Colors.black,
children: [mainVideoGrid],
showControls: true, // reserves 6% height for control bar (94% height)
containerWidthFraction: 1.0, // full width
containerHeightFraction: 1.0, // full height
defaultFraction: 0.94, // 94% height when controls visible
updateIsWideScreen: (isWide) => parameters.updateIsWideScreen(isWide),
updateIsMediumScreen: (isMed) => parameters.updateIsMediumScreen(isMed),
updateIsSmallScreen: (isSmall) => parameters.updateIsSmallScreen(isSmall),
)
// 2. Reduced width/height for picture-in-picture mode
MainAspectComponentOptions(
backgroundColor: Colors.grey[900]!,
children: [singleParticipantVideo],
showControls: false, // full height minus safe area
containerWidthFraction: 0.5, // 50% width
containerHeightFraction: 0.5, // 50% height
defaultFraction: 1.0, // no reduction (not applied when showControls=false)
updateIsWideScreen: (_) {},
updateIsMediumScreen: (_) {},
updateIsSmallScreen: (_) {},
)
// 3. Custom fraction for bottom control panel
MainAspectComponentOptions(
backgroundColor: Colors.black,
children: [participantGrid, audioIndicators],
showControls: true,
containerWidthFraction: 1.0,
containerHeightFraction: 1.0,
defaultFraction: 0.88, // reserve 12% height for larger control bar
updateIsWideScreen: (isWide) => updateLayoutMode(isWide),
updateIsMediumScreen: (isMed) => updateLayoutMode(!isWide && !isSmall),
updateIsSmallScreen: (isSmall) => updateLayoutMode(false),
)
Typical Use Cases:
- Primary video conference area (main participant grid)
- Screenshare display area (presenter content)
- Single participant video (spotlight mode)
- Gallery view container (multiple participant tiles)
- Webinar stage area (hosts/speakers only)
Constructors
-
MainAspectComponentOptions({required Color backgroundColor, required List<
Widget> children, bool showControls = true, double containerWidthFraction = 1.0, double containerHeightFraction = 1.0, double defaultFraction = 0.94, required dynamic updateIsWideScreen(bool), required dynamic updateIsMediumScreen(bool), required dynamic updateIsSmallScreen(bool)}) -
Constructs a MainAspectComponentOptions object.
const
Properties
- backgroundColor → Color
-
The background color of the component.
final
-
children
→ List<
Widget> -
The list of child widgets to be displayed inside the component.
final
- containerHeightFraction → double
-
The fraction of the screen height that the container should occupy.
final
- containerWidthFraction → double
-
The fraction of the screen width that the container should occupy.
final
- defaultFraction → double
-
The default fraction value used when showControls is true.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showControls → bool
-
A flag indicating whether to show controls.
final
- updateIsMediumScreen → dynamic Function(bool)
-
Callback to update whether the screen is medium-sized.
final
- updateIsSmallScreen → dynamic Function(bool)
-
Callback to update whether the screen is small.
final
- updateIsWideScreen → dynamic Function(bool)
-
Callback to update whether the screen is wide.
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