defaultZefyrEmbedBuilder function

Widget defaultZefyrEmbedBuilder(
  1. BuildContext context,
  2. EmbedNode node
)

Default implementation of a builder function for embeddable objects in Zefyr.

Only supports "horizontal rule" embeds.

Implementation

Widget defaultZefyrEmbedBuilder(BuildContext context, EmbedNode node) {
  if (node.value.type == 'hr') {
    final theme = ZefyrTheme.of(context)!;
    return Divider(
      height: theme.paragraph.style.fontSize! * theme.paragraph.style.height!,
      thickness: 2,
      color: Colors.grey.shade200,
    );
  }
  throw UnimplementedError(
      'Embeddable type "${node.value.type}" is not supported by default embed '
      'builder of ZefyrEditor. You must pass your own builder function to '
      'embedBuilder property of ZefyrEditor or ZefyrField widgets.');
}