asWidgetSpan method
InlineSpan
asWidgetSpan(
- Widget child, {
- PlaceholderAlignment alignment = PlaceholderAlignment.baseline,
- TextBaseline? baseline = TextBaseline.alphabetic,
child in a placeholder wrapped exactly the way the deprecated
LinkBuilder's result is, with onTap attached.
The escape hatch for a link that genuinely has to be a widget. It cannot wrap across lines, is skipped by text selection, is one opaque character to the streaming reveal, and does not paint on iOS when nested inside another placeholder — prefer a span where the design allows.
Implementation
InlineSpan asWidgetSpan(
Widget child, {
PlaceholderAlignment alignment = PlaceholderAlignment.baseline,
TextBaseline? baseline = TextBaseline.alphabetic,
}) {
final tap = onTap;
return scaledWidgetSpan(
config: config,
alignment: alignment,
baseline: baseline,
child: tap == null ? child : GestureDetector(onTap: tap, child: child),
);
}