MiniCardOptions class
Configuration options for the MiniCard
widget.
Provides properties to customize the appearance of a small participant avatar/badge, displaying either an image or text initials with extensive styling options.
Core Display Properties:
initials
: Text fallback when no image provided (e.g., "JD" for "John Doe")fontSize
: Text size for initials (default: 14)imageSource
: Optional network image URL; if null/empty, displays initialsroundedImage
: If true, applies circular clipping (borderRadius=9999); default=true
Container Styling:
customStyle
: BoxDecoration for outer container (background, border, etc.)padding
/margin
/alignment
: Positioning and spacing for outer container
Initials Styling:
initialsDecoration
: BoxDecoration for initials wrapper (background color, etc.)initialsPadding
: Padding around initials textinitialsTextStyle
: TextStyle override (font, color, weight); default=black/600
Image Styling:
imageStyle
: BoxDecoration for image wrapper (border radius extracted for ClipRRect)imageContainerDecoration
: BoxDecoration for image wrapper containerimageContainerPadding
/imageContainerMargin
: Spacing for image wrapperimageFit
: How image fills bounds (default: BoxFit.cover)imageAlignment
: Image alignment within bounds (default: Alignment.center)
Builder Hooks (3):
customBuilder
: Full widget replacement; receives MiniCardOptionscontainerBuilder
: Override outer Container; receives MiniCardContainerContext + defaultimageBuilder
: Override image display; receives MiniCardImageContext + defaultinitialsBuilder
: Override initials display; receives MiniCardInitialsContext + default
Usage Patterns:
-
Default Initials Display:
MiniCard( options: MiniCardOptions( initials: 'JD', customStyle: BoxDecoration(color: Colors.blue, shape: BoxShape.circle), ), )
-
Image Avatar:
MiniCard( options: MiniCardOptions( initials: 'JD', imageSource: 'https://example.com/avatar.jpg', roundedImage: true, ), )
-
Custom Builder Hook:
MiniCard( options: MiniCardOptions( initials: 'JD', containerBuilder: (context, defaultContainer) { return GestureDetector( onTap: () => print('Avatar tapped'), child: defaultContainer, ); }, ), )
Override Integration:
Can be overridden via MediasfuUICustomOverrides
using ComponentOverride<MiniCardOptions>
:
overrides: MediasfuUICustomOverrides(
miniCardOptions: ComponentOverride<MiniCardOptions>(
builder: (existingOptions) => MiniCardOptions(
initials: existingOptions.initials,
imageSource: existingOptions.imageSource,
customStyle: BoxDecoration(border: Border.all(color: Colors.gold, width: 2)),
),
),
),
Implementation Notes:
- Image loading failures automatically fallback to initials display
- Border radius extraction from imageStyle.borderRadius for ClipRRect compatibility
- Builder hooks receive both context and default widget for wrapping patterns
Constructors
- MiniCardOptions.new({required String initials, double fontSize = 14, BoxDecoration customStyle = const BoxDecoration(), String? imageSource, bool roundedImage = true, BoxDecoration? imageStyle, MiniCardType? customBuilder, EdgeInsetsGeometry? padding, EdgeInsetsGeometry? margin, AlignmentGeometry? alignment, BoxDecoration? initialsDecoration, EdgeInsetsGeometry? initialsPadding, TextStyle? initialsTextStyle, BoxDecoration? imageContainerDecoration, EdgeInsetsGeometry? imageContainerPadding, EdgeInsetsGeometry? imageContainerMargin, BoxFit imageFit = BoxFit.cover, AlignmentGeometry imageAlignment = Alignment.center, MiniCardContainerBuilder? containerBuilder, MiniCardImageBuilder? imageBuilder, MiniCardInitialsBuilder? initialsBuilder})
-
const
Properties
- alignment → AlignmentGeometry?
-
final
- containerBuilder → MiniCardContainerBuilder?
-
final
- customBuilder → MiniCardType?
-
final
- customStyle → BoxDecoration
-
final
- fontSize → double
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- imageAlignment → AlignmentGeometry
-
final
- imageBuilder → MiniCardImageBuilder?
-
final
- imageContainerDecoration → BoxDecoration?
-
final
- imageContainerMargin → EdgeInsetsGeometry?
-
final
- imageContainerPadding → EdgeInsetsGeometry?
-
final
- imageFit → BoxFit
-
final
- imageSource → String?
-
final
- imageStyle → BoxDecoration?
-
final
- initials → String
-
final
- initialsBuilder → MiniCardInitialsBuilder?
-
final
- initialsDecoration → BoxDecoration?
-
final
- initialsPadding → EdgeInsetsGeometry?
-
final
- initialsTextStyle → TextStyle?
-
final
- margin → EdgeInsetsGeometry?
-
final
- padding → EdgeInsetsGeometry?
-
final
- roundedImage → bool
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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