AvatarWidget.fromMyUser constructor

AvatarWidget.fromMyUser(
  1. MyUser? myUser, {
  2. Key? key,
  3. AvatarRadius? radius,
  4. double opacity = 1,
  5. bool badge = true,
  6. FutureOr<void> onForbidden()?,
  7. BoxShape shape = BoxShape.circle,
})

Creates an AvatarWidget from the specified MyUser.

Implementation

factory AvatarWidget.fromMyUser(
  MyUser? myUser, {
  Key? key,
  AvatarRadius? radius,
  double opacity = 1,
  bool badge = true,
  FutureOr<void> Function()? onForbidden,
  BoxShape shape = BoxShape.circle,
}) => AvatarWidget(
  key: key,
  isOnline: badge && myUser?.online == true,
  isAway: badge && myUser?.presence == Presence.away,
  avatar: myUser?.avatar,
  title: myUser?.name?.val ?? myUser?.num.toString(),
  color: myUser?.num.val.sum(),
  radius: radius,
  opacity: opacity,
  onForbidden: onForbidden,
  shape: shape,
);