getJidOfContact method

Widget getJidOfContact({
  1. ContactChatMessage? contactChatMessage,
  2. required bool showChatDeliveryIndicator,
})

Implementation

Widget getJidOfContact(
    {ContactChatMessage? contactChatMessage,
    required bool showChatDeliveryIndicator}) {
  // String? userJid;
  if (contactChatMessage == null ||
      contactChatMessage.contactPhoneNumbers.isEmpty) {
    return const SizedBox.shrink();
  }
  return FutureBuilder(
      future: getUserJid(contactChatMessage),
      builder: (context, snapshot) {
        if (snapshot.hasError || !snapshot.hasData) {
          return const SizedBox.shrink();
        }
        var userJid = snapshot.data;
        return InkWell(
          onTap: () {
            (userJid != null && userJid.isNotEmpty)
                ? sendToChatPage(context, userJid, showChatDeliveryIndicator)
                : showInvitePopup(contactChatMessage, context);
          },
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Expanded(
                  child: Center(
                      child: Padding(
                          padding: const EdgeInsets.all(8.0),
                          child: (userJid != null && userJid.isNotEmpty)
                              ? Text(
                                  AppConstants.message,
                                  style: TextStyle(
                                      color: chatMessage.isMessageSentByMe
                                          ? MirrorflyUikit
                                              .getTheme
                                              ?.chatBubblePrimaryColor
                                              .textPrimaryColor
                                          : MirrorflyUikit
                                              .getTheme
                                              ?.chatBubbleSecondaryColor
                                              .textPrimaryColor),
                                )
                              : Text(
                                  AppConstants.invite,
                                  style: TextStyle(
                                      color: chatMessage.isMessageSentByMe
                                          ? MirrorflyUikit
                                              .getTheme
                                              ?.chatBubblePrimaryColor
                                              .textPrimaryColor
                                          : MirrorflyUikit
                                              .getTheme
                                              ?.chatBubbleSecondaryColor
                                              .textPrimaryColor),
                                )))),
            ],
          ),
        );
      });
}