onCameraClick method

dynamic onCameraClick()

Implementation

onCameraClick() async {
  // if (await AppPermission.askFileCameraAudioPermission()) {
  var cameraPermissionStatus = await AppPermission.checkPermission(context,
      Permission.camera, cameraPermission, AppConstants.cameraPermission);
  debugPrint("Camera Permission Status---> $cameraPermissionStatus");
  if (cameraPermissionStatus) {
    if (context.mounted) {
      setOnGoingUserGone();
      Navigator.push(
              context, MaterialPageRoute(builder: (con) => CameraPickView()))
          .then((photo) {
        photo as XFile?;
        if (photo != null) {
          mirrorFlyLog("photo", photo.name.toString());
          mirrorFlyLog("caption text sending-->", messageController.text);
          var file = PickedAssetModel(
            path: photo.path,
            type: !photo.name.endsWith(".mp4") ? "image" : "video",
          );
          Navigator.push(
              context,
              MaterialPageRoute(
                  builder: (con) => MediaPreviewView(
                        filePath: [file],
                        userName: profile.name.checkNull(),
                        profile: profile,
                        caption: messageController.text.trim(),
                        showAdd: false,
                      ))).then((value) => setOnGoingUserAvail());
        }else{
          setOnGoingUserAvail();
        }
      });
    }
    /*Get.toNamed(Routes.cameraPick)?.then((photo) {
      photo as XFile?;
      if (photo != null) {
        mirrorFlyLog("photo", photo.name.toString());
        mirrorFlyLog("caption text sending-->", messageController.text);
        */ /*if (photo.name.endsWith(".mp4")) {
          Get.toNamed(Routes.videoPreview, arguments: {
            "filePath": photo.path,
            "userName": profile.name!,
            "profile": profile,
            "caption": messageController.text
          });
        } else {
          Get.toNamed(Routes.imagePreview, arguments: {
            "filePath": photo.path,
            "userName": profile.name!,
            "profile": profile,
            "caption": messageController.text
          });
        }*/ /*
        var file = PickedAssetModel(
          path: photo.path,
          type: !photo.name.endsWith(".mp4") ? "image" : "video",
        );
        Get.toNamed(Routes.mediaPreview, arguments: {
          "filePath": [file],
          "userName": profile.name!,
          'profile': profile,
          'caption': messageController.text,
          'showAdd': false
        });
      }
    });*/
  }
  /*final XFile? photo = await _picker.pickImage(source: ImageSource.camera);
  if (photo != null) {
    Get.toNamed(Routes.imagePreview,
        arguments: {"filePath": photo.path, "userName": profile.name!});
  }*/
}