createSpan method

  1. @override
InlineSpan createSpan(
  1. {required BuildContext context,
  2. String? text,
  3. String? textContent,
  4. List<InlineSpan>? children,
  5. required Map<String?, String?> attributes,
  6. GestureRecognizer? recognizer}
)
override

Implementation

@override
InlineSpan createSpan({
  required BuildContext context,
  String? text,
  String? textContent,
  List<InlineSpan>? children,
  required Map<String?, String?> attributes,
  GestureRecognizer? recognizer,
}) {
  Widget widget = builder(context, attributes, textContent);

  if (size != null) {
    widget = SizedBox(
      width: (size!.width == double.infinity) ? null : size!.width,
      height: (size!.height == double.infinity) ? null : size!.height,
      child: widget,
    );
  }

  if (constraints != null) {
    widget = ConstrainedBox(
      constraints: constraints!,
      child: widget,
    );
  }

  final InlineSpan span = TextSpan(
    children: [
      WidgetSpan(
        child: widget,
        alignment: alignment,
        baseline: baseline,
        // style: TextStyle(backgroundColor: backgroundColor),
      ),
    ],
  );

  return span;
}