How to add a custom CropAspectRatioPreset to image_cropper?

Viewed 90

I need to have an AspectRatio that is opposite to CropAspectRatioPreset.ratio3x2 with image_cropper plugin. When I initialise with aspectRatio: CropAspectRatio(ratioX: 2, ratioY: 3) I have only one option, but I need to have both. How can I do that?

here is my code:

    final profileManager = context.read<ProfileManager>();
    final File croppedFile = await ImageCropper.cropImage(
        sourcePath: path,
       // aspectRatio: CropAspectRatio(ratioX: 2, ratioY: 3),
        aspectRatioPresets: [
          CropAspectRatioPreset.ratio3x2,
        ],
        androidUiSettings: AndroidUiSettings(
          toolbarTitle: 'Posicione a Imagem',
          toolbarColor: Colors.black,
          toolbarWidgetColor: Colors.white,
          backgroundColor: Colors.black,
          activeControlsWidgetColor: Colors.white,
          showCropGrid: false,
        ),
        iosUiSettings: IOSUiSettings(
            title: "Posicione a Imagem",
            cancelButtonTitle: 'Cancelar',
            doneButtonTitle: "Concluir"));

   
  }
0 Answers
Related