hm21 / pro_image_editor

The pro_image_editor is a Flutter widget designed for image editing within your application. It provides a flexible and convenient way to integrate image editing capabilities into your Flutter project.
https://hm21.github.io/pro_image_editor/
BSD 3-Clause "New" or "Revised" License
94 stars 59 forks source link

[Feature request] Edit option for the sticker #188

Closed ABedrock closed 1 month ago

ABedrock commented 1 month ago

Platforms

iOS

Description

Hi @hm21 ,

Thank you for providing such an excellent image editing platform and for your ongoing maintenance efforts. I greatly appreciate your work.

I'm currently working on a project and need a feature that allows users to change or edit a sticker when they click on it, similar to how text editing works. I've gone through the documentation but couldn't find anything related to this functionality. Could you please guide me on how to implement this feature if it already exists, or consider adding it in a future update? I would be truly grateful.

Thanks

image image

Why

No response

hm21 commented 1 month ago

Hi @ABedrock,

Thank you for your kind words. I'm glad to hear that you like my package.

Previously, this was not possible, but I have just released version 5.1.0, which allows you to do that as shown below. The edit button will automatically be visible when you add the callback.

    ProImageEditor.network(
      _url,
      callbacks: ProImageEditorCallbacks(
        stickerEditorCallbacks: StickerEditorCallbacks(
          onTapEditSticker: (state, sticker, index) async {
            /// Keep in mind that if you use an image, ensure to call precacheImage so that the 
            /// background task takes the correct screenshot.
            state.replaceLayer(
              index: index,
              layer: sticker.copyWith(
                /// Replace Sticker with your updated sticker
                sticker: Sticker(
                  index: newIndex,
                ),
              ),
            );
          },
        ),
      ),
);
ABedrock commented 4 weeks ago

I'm glad to have that feature in my app. Thank you!