fromRxContact static method
- RxChatContact? contact, {
- Key? key,
- Avatar? avatar,
- AvatarRadius? radius,
- double opacity = 1,
- bool badge = true,
Creates an AvatarWidget from the specified reactive contact
.
Implementation
static Widget fromRxContact(
RxChatContact? contact, {
Key? key,
Avatar? avatar,
AvatarRadius? radius,
double opacity = 1,
bool badge = true,
}) {
if (contact == null) {
return AvatarWidget.fromContact(
key: key,
contact?.contact.value,
avatar: avatar,
radius: radius,
opacity: opacity,
);
}
return Obx(() {
return AvatarWidget(
key: key,
isOnline:
badge &&
contact.contact.value.users.length == 1 &&
contact.user.value?.user.value.online == true,
isAway:
badge && contact.user.value?.user.value.presence == Presence.away,
avatar: contact.user.value?.user.value.avatar,
title: contact.contact.value.name.val,
color:
contact.user.value == null
? contact.contact.value.name.val.sum()
: contact.user.value?.user.value.num.val.sum(),
radius: radius,
opacity: opacity,
);
});
}