getAvatarComponent method

SBUAvatarComponent getAvatarComponent({
  1. required bool isLightTheme,
  2. required double size,
  3. User? user,
})
inherited

Implementation

SBUAvatarComponent getAvatarComponent({
  required bool isLightTheme,
  required double size,
  User? user,
}) {
  final imageUrl = user?.profileUrl ?? '';

  SBUIconComponent? icon = imageUrl.isEmpty
      ? SBUIconComponent(
          iconSize: size * 0.57138888888,
          iconData: SBUIcons.user,
          iconColor: isLightTheme
              ? SBUColors.darkThemeTextHighEmphasis
              : SBUColors.lightThemeTextHighEmphasis,
        )
      : null;
  Color? backgroundColor = imageUrl.isEmpty ? SBUColors.background300 : null;

  return SBUAvatarComponent(
    width: size,
    height: size,
    icon: icon,
    backgroundColor: backgroundColor,
    imageUrls: imageUrl.isNotEmpty ? [imageUrl] : [],
    isMutedMember: (user is Member && user.isMuted),
  );
}