Closed ABedrock closed 4 weeks ago
To prevent interaction with the layers, you can use callbacks, as demonstrated below.
return ProImageEditor.network(
_url,
key: editorKey,
callbacks: ProImageEditorCallbacks(
mainEditorCallbacks: MainEditorCallbacks(
onScaleStart: (value) {
int selectedIndex = editorKey.currentState!.selectedLayerIndex;
if (selectedIndex < 0) return;
Layer layer = editorKey.currentState!.activeLayers[selectedIndex];
/// Stop interaction
if (layer.runtimeType == StickerLayerData ||
layer.runtimeType == TextLayerData) {
editorKey.currentState!.layerInteractionManager.onScaleEnd();
editorKey.currentState!.selectedLayerIndex = -1;
}
/// If you want to do more deep checks if the user can move the
/// layer or not you can do it like below
///
/// var runtimeType = layer.runtimeType;
/// if (runtimeType == PaintingLayerData) {
/// var paintLayer = layer as PaintingLayerData;
/// } else if (runtimeType == TextLayerData) {
/// var textLayer = layer as TextLayerData;
/// } else if (runtimeType == StickerLayerData) {
/// var stickerLayer = layer as StickerLayerData;
/// } else if (runtimeType == EmojiLayerData) {
/// var emojiLayer = layer as EmojiLayerData;
/// }
},
),
Platforms
iOS
Description
Hey @hm21,
I'm planning to use this amazing package with a fixed template, where users can modify the content but not the position of stickers or text. I reviewed your documentation, but I couldn't find anything relevant to that. Could you please help me find a solution?
Why
No response