Prevent user from deleting specific layer in the editor #567
Unanswered
SukhVilash1
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
In that case, you’ll need to create your own remove area like this: configs: ProImageEditorConfigs(
mainEditor: MainEditorConfigs(
widgets: MainEditorWidgets(
removeLayerArea: (removeAreaKey, editor, rebuildStream) {
int selectedLayerIndex = editor.selectedLayerIndex;
Layer activeLayer = editor.activeLayers[selectedLayerIndex];
if (activeLayer.meta?['disableDelete'] == true) {
return const SizedBox.shrink();
}
return Positioned(
key: removeAreaKey,
top: 0,
left: 0,
child: SafeArea(
bottom: false,
child: StreamBuilder(
stream: rebuildStream,
builder: (context, snapshot) {
return Container(
height: kToolbarHeight,
width: kToolbarHeight,
decoration: BoxDecoration(
color: editor.layerInteractionManager.hoverRemoveBtn
? Colors.red
: Colors.white,
borderRadius: const BorderRadius.only(
bottomRight: Radius.circular(100),
),
),
padding: const EdgeInsets.only(right: 12, bottom: 7),
child: const Center(
child: Icon(
Icons.delete_outline,
size: 28,
),
),
);
},
),
),
);
},
),
),
),After that, you can update your FYI that's actually a question, not a bug, so I'll move that post to the Discuss tab now. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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)
Device Model (optional)
No response
Beta Was this translation helpful? Give feedback.
All reactions