Avatar
A customizable avatar component that displays user profile images, initials, or icons
A customizable avatar component that can display an image, text label, or icon.
When to use this
- User profiles: Display user profile pictures or initials
- Comment sections: Show avatars next to user comments or posts
- Team members: Display team member photos in lists or grids
- Contact lists: Show profile images in contact or messaging interfaces
Basic implementation
Basic implementation
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class AvatarExample extends StatelessWidget {
const AvatarExample({super.key});
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 16,
children: [
RemixAvatar(
label: 'LF',
style: labelStyle,
),
RemixAvatar(
icon: Icons.person,
style: iconStyle,
),
RemixAvatar(
style: image,
),
],
);
}
RemixAvatarStyle get labelStyle {
return RemixAvatarStyle()
.textColor(Colors.deepPurpleAccent)
.size(50, 50)
.shapeCircle()
.wrapClipOval()
.labelColor(Colors.white)
.labelFontWeight(FontWeight.bold)
.labelFontSize(15);
}
RemixAvatarStyle get iconStyle {
return RemixAvatarStyle()
.textColor(Colors.deepOrangeAccent)
.size(70, 70)
.iconColor(Colors.white)
.iconSize(70)
.icon(IconStyler().wrapTranslate(x: 0, y: 12))
.shapeCircle()
.wrapClipOval();
}
RemixAvatarStyle get image {
return RemixAvatarStyle()
.size(90, 90)
.backgroundImageUrl('https://i.pravatar.cc/150?img=48')
.shapeCircle();
}
}
Fortal styles
Remix includes Fortal-themed style helpers for this component:
Fortal variants
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class FortalAvatarExample extends StatelessWidget {
const FortalAvatarExample({super.key});
@override
Widget build(BuildContext context) {
return Row(
spacing: 16,
children: [
// Soft variant - Subtle background
RemixAvatar(
label: 'AB',
style: FortalAvatarStyles.soft(),
),
// Solid variant - Bold background
RemixAvatar(
label: 'CD',
style: FortalAvatarStyles.solid(),
),
],
);
}
}
See the FortalAvatarStyles source code for all available options.
Constructor
Constructor
const RemixAvatar({
Key? key,
ImageProvider? backgroundImage,
ImageProvider? foregroundImage,
ImageErrorListener? onBackgroundImageError,
ImageErrorListener? onForegroundImageError,
Widget? child,
String? label,
RemixAvatarLabelBuilder? labelBuilder,
IconData? icon,
RemixAvatarIconBuilder? iconBuilder,
RemixAvatarStyle style = const RemixAvatarStyle.create(),
RemixAvatarSpec? styleSpec,
})
onBackgroundImageError → ImageErrorListener?
Optional. Callback function called when the background image fails to load.
onForegroundImageError → ImageErrorListener?
Optional. Callback function called when the foreground image fails to load.
child → Widget?
Optional. Custom content to display inside the avatar. When provided the caller is responsible for applying typography.
labelBuilder → RemixAvatarLabelBuilder?
Optional. Optional builder that exposes the resolved [TextSpec] for custom label rendering while keeping the configured typography.

