defaultFleatherEmbedBuilder function

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

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

Only supports "horizontal rule" embeds.

Implementation

Widget defaultFleatherEmbedBuilder(BuildContext context, EmbedNode node) {
  if (node.value.type == 'hr') {
    final fleatherThemeData = FleatherTheme.of(context)!;

    return Divider(
      height: fleatherThemeData.horizontalRule.height,
      thickness: fleatherThemeData.horizontalRule.thickness,
      color: fleatherThemeData.horizontalRule.color,
    );
  }
  throw UnimplementedError(
      'Embeddable type "${node.value.type}" is not supported by default embed '
      'builder of FleatherEditor. You must pass your own builder function to '
      'embedBuilder property of FleatherEditor or FleatherField widgets.');
}