WidgetSpan constructor

const WidgetSpan({
  1. required Widget child,
  2. PlaceholderAlignment alignment = ui.PlaceholderAlignment.bottom,
  3. TextBaseline? baseline,
  4. TextStyle? style,
})

Creates a WidgetSpan with the given values.

WidgetSpan is a leaf node in the InlineSpan tree. Child widgets are constrained by the width of the paragraph they occupy. Child widget heights are unconstrained, and may cause the text to overflow and be ellipsized/truncated.

A TextStyle may be provided with the style property, but only the decoration, foreground, background, and spacing options will be used.

Implementation

const WidgetSpan({
  required this.child,
  super.alignment,
  super.baseline,
  super.style,
}) : assert(
       baseline != null || !(
        identical(alignment, ui.PlaceholderAlignment.aboveBaseline) ||
        identical(alignment, ui.PlaceholderAlignment.belowBaseline) ||
        identical(alignment, ui.PlaceholderAlignment.baseline)
      ),
    );