build method

  1. @override
void build(
  1. ParagraphBuilder builder, {
  2. double textScaleFactor = 1.0,
  3. List<PlaceholderDimensions>? dimensions,
})
override

Adds a placeholder box to the paragraph builder if a size has been calculated for the widget.

Sizes are provided through dimensions, which should contain a 1:1 in-order mapping of widget to laid-out dimensions. If no such dimension is provided, the widget will be skipped.

The textScaler will be applied to the laid-out size of the widget.

Implementation

@override
void build(ui.ParagraphBuilder builder,
    {double textScaleFactor = 1.0, List<PlaceholderDimensions>? dimensions}) {
  assert(debugAssertIsValid());
  final bool hasStyle = style != null;
  if (hasStyle) {
    builder.pushStyle(style!.getTextStyle(textScaleFactor: textScaleFactor));
  }
  builder.addPlaceholder(
    size.width,
    size.height,
    alignment,
    scale: textScaleFactor,
  );
  if (hasStyle) {
    builder.pop();
  }
}