Skip to content

Add image as layer to pro editor #204

Answered by hm21
edwarddubi asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can add any layer you want, as demonstrated in the example below.

const url = 'https://picsum.photos/id/200/2000';

/// IMPORTANT: precache the image
await precacheImage(const NetworkImage(url), context);

/// If you use it outside from `customWidgets` access the editor like below.
/// editorKey.currentState!.addLayer(...);
///
/// If you use it inside of `customWidgets` you can access the editor
/// directly like below.
editor.addLayer(
  StickerLayerData(
    sticker: ClipRRect(
      borderRadius: BorderRadius.circular(7),
      child: Image.network(
        url,
        width: 80,
        height: 80,
        fit: BoxFit.cover,
        loadingBuilder: (context, child, loadingP…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@edwarddubi
Comment options

Answer selected by edwarddubi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants