MiniCard class
A compact avatar/badge widget displaying participant image or initials.
Renders a small circular or rectangular card showing either:
- Network image (if
imageSourceprovided and loads successfully) - Text initials (if no image or image fails to load)
Rendering Logic:
- If
customBuilderprovided → delegates full rendering to custom function - If
imageSourcenon-empty → attempts network image load - If image load fails or no source → displays initials text
- Applies builder hooks at each layer: container, image, initials
Layout Structure:
Container (containerBuilder)
├─ padding/margin/alignment/decoration
└─ IF hasImage:
└─ Container (imageBuilder)
└─ ClipRRect (borderRadius)
└─ Image.network (with errorBuilder → initials)
ELSE:
└─ Container (initialsBuilder)
└─ Text (initials)
Builder Hook Priorities:
customBuilder→ full widget replacement (ignores all other props)containerBuilder→ wraps outer container (receives default + context)imageBuilder→ wraps image container (receives default + context)initialsBuilder→ wraps initials text (receives default + context)
Common Use Cases:
-
Participant Avatar in Grid:
MiniCard( options: MiniCardOptions( initials: participant.name.substring(0, 2).toUpperCase(), imageSource: participant.photoURL, customStyle: BoxDecoration(color: Colors.grey[300], shape: BoxShape.circle), ), ) -
Fallback Display:
MiniCard( options: MiniCardOptions( initials: 'NA', fontSize: 12, initialsTextStyle: TextStyle(color: Colors.grey), ), ) -
Custom Interactive Badge:
MiniCard( options: MiniCardOptions( initials: 'Host', containerBuilder: (context, defaultContainer) { return Tooltip( message: 'Meeting Host', child: defaultContainer, ); }, ), )
Override Integration:
Integrates with MediasfuUICustomOverrides for global styling:
overrides: MediasfuUICustomOverrides(
miniCardOptions: ComponentOverride<MiniCardOptions>(
builder: (existingOptions) => MiniCardOptions(
initials: existingOptions.initials,
imageSource: existingOptions.imageSource,
roundedImage: true,
customStyle: BoxDecoration(
gradient: LinearGradient(colors: [Colors.blue, Colors.purple]),
shape: BoxShape.circle,
),
),
),
),
Implementation Details:
- Uses ClipRRect for circular/rounded image clipping
- Image errorBuilder automatically falls back to initials
- Border radius extracted from imageStyle.borderRadius if provided
- All builder hooks receive both BuildContext and default widget
- Initials centered with default black/600 styling
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- MiniCard
Constructors
- MiniCard({Key? key, required MiniCardOptions options})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- options → MiniCardOptions
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited