build method

  1. @override
InlineSpan build(
  1. ExtensionContext context
)

The final step in the chain. Converts the StyledElement tree, with its attached Style elements, into an InlineSpan tree that includes Widget/TextSpans that can be rendered in a RichText widget.

Implementation

@override
InlineSpan build(ExtensionContext context) {
  if (context.elementName == "table") {
    return WidgetSpan(
      child: CssBoxWidget(
        style: context.styledElement!.style,
        child: LayoutBuilder(
          builder: (_, constraints) {
            return _layoutCells(
              context.styledElement as TableElement,
              context.builtChildrenMap!,
              context,
              constraints,
            );
          },
        ),
      ),
    );
  }

  return WidgetSpan(
    child: CssBoxWidget.withInlineSpanChildren(
      children: context.inlineSpanChildren!,
      style: Style(),
    ),
  );
}