showQuickProfilePopup function

void showQuickProfilePopup({
  1. required dynamic chatTap(),
  2. dynamic callTap()?,
  3. dynamic videoTap()?,
  4. required dynamic infoTap(),
  5. required Rx<ProfileDetails> profile,
  6. required Rx<AvailableFeatures> availableFeatures,
})

Implementation

void showQuickProfilePopup(
    {required Function() chatTap,
    Function()? callTap,
    Function()? videoTap,
    required Function() infoTap,
    required Rx<ProfileDetails> profile,
    required Rx<AvailableFeatures> availableFeatures}) {
  var isAudioCallAvailable = profile.value.isGroupProfile.checkNull()
      ? false
      : availableFeatures.value.isOneToOneCallAvailable.checkNull();
  var isVideoCallAvailable = profile.value.isGroupProfile.checkNull()
      ? false
      : availableFeatures.value.isOneToOneCallAvailable.checkNull();

  DialogUtils.createDialog(
    Obx(() {
      return Dialog(
        shape: const RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(20.0))),
        child: SizedBox(
          width: NavUtils.width * 0.7,
          height: 300,
          child: Column(
            children: [
              Expanded(
                child: InkWell(
                  onTap: () {
                    LogMessage.d('image click', 'true');
                    debugPrint(
                        "quick profile click--> ${profile.toJson().toString()}");
                    if (profile.value.image!.isNotEmpty &&
                        !(profile.value.isBlockedMe.checkNull() ||
                            profile.value.isAdminBlocked.checkNull()) &&
                        !( //!profile.value.isItSavedContact.checkNull() || //This is commented because Android side received as true and iOS side false
                            profile.value.isDeletedContact())) {
                      NavUtils.back();
                      NavUtils.toNamed(Routes.imageView, arguments: {
                        'imageName': getName(profile.value),
                        'imageUrl': profile.value.image.checkNull()
                      });
                    }
                  },
                  child: Stack(
                    fit: StackFit.expand,
                    children: [
                      ClipRRect(
                          borderRadius: const BorderRadius.only(
                              topLeft: Radius.circular(20),
                              topRight: Radius.circular(20)),
                          child: ImageNetwork(
                            url: profile.value.image.toString(),
                            width: NavUtils.width * 0.7,
                            height: 250,
                            clipOval: false,
                            errorWidget: profile.value.isGroupProfile!
                                ? AppUtils.assetIcon(
                                    assetName: groupImg,
                                    height: 250,
                                    width: NavUtils.width * 0.72,
                                    fit: BoxFit.cover,
                                  )
                                : ProfileTextImage(
                                    text: getName(profile.value),
                                    fontSize: 75,
                                    radius: 0,
                                  ),
                            isGroup: profile.value.isGroupProfile.checkNull(),
                            blocked: profile.value.isBlockedMe.checkNull() ||
                                profile.value.isAdminBlocked.checkNull(),
                            unknown:
                                (!profile.value.isItSavedContact.checkNull() ||
                                    profile.value.isDeletedContact()),
                          )),
                      Padding(
                        padding: const EdgeInsets.symmetric(
                            vertical: 10.0, horizontal: 20),
                        child: Text(
                          profile.value.isGroupProfile!
                              ? profile.value.name.checkNull()
                              : !Constants.enableContactSync
                                  ? profile.value.mobileNumber.checkNull()
                                  : profile.value.nickName.checkNull(),
                          style: const TextStyle(color: Colors.white),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
              SizedBox(
                height: 50,
                child: Row(
                  // mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Expanded(
                      child: InkWell(
                        onTap: chatTap,
                        child: AppUtils.svgIcon(
                          icon: quickMessage,
                          fit: BoxFit.contain,
                          width: 30,
                          height: 30,
                        ),
                      ),
                    ),
                    isAudioCallAvailable
                        ? Expanded(
                            child: InkWell(
                              onTap: () {
                                NavUtils.back();
                                makeVoiceCall(profile, availableFeatures);
                              },
                              child: AppUtils.svgIcon(
                                icon: quickCall,
                                fit: BoxFit.contain,
                              ),
                            ),
                          )
                        : const SizedBox.shrink(),
                    isVideoCallAvailable
                        ? Expanded(
                            child: InkWell(
                              onTap: () {
                                NavUtils.back();
                                makeVideoCall(profile, availableFeatures);
                              },
                              child: AppUtils.svgIcon(
                                icon: quickVideo,
                                fit: BoxFit.contain,
                              ),
                            ),
                          )
                        : const SizedBox.shrink(),
                    Expanded(
                      child: InkWell(
                        onTap: infoTap,
                        child: AppUtils.svgIcon(
                          icon: quickInfo,
                          fit: BoxFit.contain,
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      );
    }),
  );
}