Skip to content

[Bug]: Prevent user from deleting specific (main photo) layer in the editor #566

Description

@SukhVilash1

Package Version

10.5.1

Flutter Version

3.34.0

Platforms

Android

How to reproduce?

I'm using the editor in my app, and I need to make sure the main baby photo added to the canvas cannot be deleted by the user. Currently, all layers are deletable, but I want to prevent deletion of this specific layer. If there's already a way to lock or protect a layer from being removed, please let me know how to implement it. If not, I’d appreciate any guidance or workaround to achieve this behavior.

babyPhoto.mp4

Logs (optional)

Example code (optional)

editorKey1.currentState?.addLayer(
            WidgetLayer(
              offset: Offset(editorSize.width * posX, editorSize.height * posY),
              scale: 1,
              interaction: LayerInteraction(
                enableEdit: enableInteraction,
                enableMove: enableInteraction,
                enableRotate: enableInteraction,
                enableScale: enableInteraction,
                enableSelection: enableInteraction,
              ),
              widget: IgnorePointer(
                ignoring: !enableInteraction,
                child: ClipRRect(
                  borderRadius: BorderRadius.circular(10),
                  child: Image.file(file, fit: BoxFit.cover),
                ),
              ),
            ),
          );

Device Model (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions