Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Configure only selected crop aspect ratio #20

Closed
rahatcse5bu opened this issue Mar 19, 2024 · 5 comments
Closed

Feature Request: Configure only selected crop aspect ratio #20

rahatcse5bu opened this issue Mar 19, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@rahatcse5bu
Copy link

Need such options to Configure/control only selected crop aspect ratio like only 16:9 or 4:3

I mean there needs have the control-availity to disable some aspect ratio.

Also need the control to change the editing options' position as wish

@rahatcse5bu rahatcse5bu added the enhancement New feature or request label Mar 19, 2024
@MarcioPereira155
Copy link

onImageEditingComplete: (Uint8List bytes) async { does not return the edited image, can you tell me why?

hm21 added a commit that referenced this issue Mar 20, 2024
@hm21
Copy link
Owner

hm21 commented Mar 20, 2024

@rahatcse5bu Thank you for your feature request. In version 2.5.6, I have added a configuration option where you can specify which aspect ratio you want. Below is an example:

configs: ProImageEditorConfigs(
  cropRotateEditorConfigs: const CropRotateEditorConfigs(
    initAspectRatio: CropAspectRatios.ratio3_4,
    allowedAspectRatios: [
      CropAspectRatios.custom,
      CropAspectRatios.original,
      CropAspectRatios.ratio1_1,
      CropAspectRatios.ratio3_4,
      CropAspectRatios.ratio9_16,
    ],
  ),
),

By "control to change editing position" do you mean to order the AppBar and BottomBar differently? If yes, here you can see an example how to completely customize the AppBar and the same is also possible for the BottomBar with your own order and widgets.

@hm21
Copy link
Owner

hm21 commented Mar 20, 2024

@MarcioPereira155 I would appreciate it if you would open a new thread here with your question. I can then help you to solve this problem. Please also post your code as you currently configure ProImageEditor.

@hm21 hm21 closed this as completed Mar 20, 2024
@rahatcse5bu
Copy link
Author

@rahatcse5bu Thank you for your feature request. In version 2.5.6, I have added a configuration option where you can specify which aspect ratio you want. Below is an example:

configs: ProImageEditorConfigs(
  cropRotateEditorConfigs: const CropRotateEditorConfigs(
    initAspectRatio: CropAspectRatios.ratio3_4,
    allowedAspectRatios: [
      CropAspectRatios.custom,
      CropAspectRatios.original,
      CropAspectRatios.ratio1_1,
      CropAspectRatios.ratio3_4,
      CropAspectRatios.ratio9_16,
    ],
  ),
),

By "control to change editing position" do you mean to order the AppBar and BottomBar differently? If yes, here you can see an example how to completely customize the AppBar and the same is also possible for the BottomBar with your own order and widgets.

Lovely. for 2:3 and 3:2, will be like this: > cropRotateEditorConfigs: const CropRotateEditorConfigs(
initAspectRatio: CropAspectRatios.ratio2_3,
allowedAspectRatios: [

  CropAspectRatios.ratio3__2,
  CropAspectRatios.ratio2_3,

],
), , I mean I want to allow only 2 aspect ratio and want to disable others. and for text , is this possible like this image?
image
. Yes, I meant to order the AppBar and BottomBar differently. Thank you so much for your lovely work and reply as well

@hm21
Copy link
Owner

hm21 commented Mar 20, 2024

I see you want to use custom aspect ratios. I've changed the code in version 2.5.7 so that it's now possible to completely set custom aspect ratios. In your case, you need to configure the code like this:

 configs: ProImageEditorConfigs(
    cropRotateEditorConfigs: const CropRotateEditorConfigs(
      initAspectRatio: 3.0 / 2.0,
      aspectRatios: [
        AspectRatioItem(text: '3*2', value: 3.0 / 2.0),
        AspectRatioItem(text: '2*3', value: 2.0 / 3.0),
      ],
    ),
 ),

In this case, all other aspect ratios are disabled and the user has only these two options.

It is also possible to edit the TextEditor as shown in the picture. The easiest way to do this is to create your own TextEditor widget. Below is a guide on how to do this:

  1. Create your own BottomBar. You can see an example here
  2. Create your own TextEditor. Copy the current TextEditor code and edit it as needed.
  3. Open your custom TextEditor in the BottomBar like this
FlatIconTextButton(
        label: Text('Text', style: bottomTextStyle),
        icon: const Icon(
          Icons.text_fields,
          size: 22.0,
          color: Colors.white,
        ),
        onPressed: (){
          // TODO: open your widget. After closing the editor push the new layer to the editor.

          _editorKey.currentState.addLayer(layer);
        },
      ),
```

@Kora3 Kora3 mentioned this issue Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants