buildValue method

  1. @override
InlineSpan buildValue(
  1. BuildContext context
)
override

Implementation

@override
InlineSpan buildValue(BuildContext context) {
  final config = JsonConfig.of(context);
  final color = config.color?.nullBackground;
  TextStyle style = const TextStyle();
  if (config.style?.valuesStyle != null) {
    style = config.style!.valuesStyle!;
  }
  style = style.copyWith(color: valueColor(context));
  if (color == null) {
    return ValueSpan(value: value, style: style);
  }

  return WidgetSpan(
    child: CustomPaint(
      painter: ValueBackgroundPainter(
        color: color,
        radius: const Radius.circular(4),
      ),
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 4),
        child: Text(value, style: style),
      ),
    ),
  );
}