onGalleryClick method

dynamic onGalleryClick(
  1. BuildContext context
)

Implementation

onGalleryClick(BuildContext context) {
  if (!availableFeatures.value.isImageAttachmentAvailable.checkNull() &&
      !availableFeatures.value.isVideoAttachmentAvailable.checkNull()) {
    Helper.showFeatureUnavailable(context);
    return;
  }
  AppPermission.getGalleryAccessPermissions().then((permissions) {
    AppPermission.checkAndRequestPermissions(
            permissions: permissions,
            permissionIcon: filePermission,
            permissionContent: AppConstants.filePermission,
            permissionPermanentlyDeniedContent:
                AppConstants.storagePermissionDenied,
            context: context)
        .then((permission) {
      if (permission) {
        try {
          // imagePicker();
          // Get.toNamed(Routes.galleryPicker, arguments: {
          //   "userName": getName(profile),
          //   'profile': profile,
          //   'caption': messageController.text
          // });
          if (context.mounted) {
            setOnGoingUserGone();
            Navigator.push(
                    context,
                    MaterialPageRoute(
                        builder: (con) => GalleryPickerView(
                            senderJid: profile.jid.checkNull(),
                            caption: messageController.text.trim())))
                .then((value) => setOnGoingUserAvail());
          }
        } catch (e) {
          debugPrint(e.toString());
        }
      }
    });
  });
}