UserAvatar constructor
UserAvatar({})
Implementation
UserAvatar({
super.key,
required BuildContext context,
Color? backgroundColor,
Color? foregroundColor,
double? radius,
this.textStyle,
this.userImageUrl,
this.userName,
}) : assert(userName?.isNotEmpty == true || userImageUrl != null),
super(
radius: radius,
backgroundColor:
backgroundColor ?? Theme.of(context).colorScheme.primary,
backgroundImage:
userImageUrl == null ? null : NetworkImage(userImageUrl),
child: userImageUrl == null
? Text(
userName!.toInitials(),
style: textStyle ??
Theme.of(context).textTheme.titleSmall?.copyWith(
color: foregroundColor ?? Colors.white,
fontSize: radius != null ? radius * 0.75 : null,
),
)
: null,
);