createSpan method

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

Implementation

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

  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;
}