memspace / zefyr

Soft and gentle rich text editing for Flutter applications.
https://zefyr-editor.gitbook.io
2.22k stars 550 forks source link

Feature request: ZefyrEmbedBuilder add ZefyrController parameter #603

Closed taojoe closed 2 years ago

taojoe commented 2 years ago

make ZefyrEmbedBuilder add ZefyrController as third parameter, so the embed builder can change itself by controller.

it's required when building a image cropper or image resizer.

typedef ZefyrEmbedBuilder = Widget Function(
    BuildContext context, EmbedNode node, ZefyrController controller);
cgestes commented 2 years ago

Hi,

not sure what's the official reason for the API.

Just in case you can do something along those lines:

            ZefyrEditor(
              controller: controller,
              focusNode: focusNode,
              embedBuilder: (context, node) => yourEmbedBuilder(context, node, controller),
            ),
taojoe commented 2 years ago

Hi,

not sure what's the official reason for the API.

Just in case you can do something along those lines:

            ZefyrEditor(
              controller: controller,
              focusNode: focusNode,
              embedBuilder: (context, node) => yourEmbedBuilder(context, node, controller),
            ),

Thanks, it's good.

cgestes commented 2 years ago

Great. Lets close then.

😁