computeWidgetSpanWidth static method

double? computeWidgetSpanWidth(
  1. InlineSpan? span, {
  2. double? width,
})

Implementation

static double? computeWidgetSpanWidth(InlineSpan? span, {double? width}) {
  if (width == null) {
    width = 0;
  }
  if (span == null) {
    return width;
  }
  if (span is TextSpan) {
    width = width + (span.text?.runes?.length ?? 0);
    if (span.children != null) {
      for (InlineSpan child in span.children!) {
        width = width! + computeWidgetSpanWidth(child, width: width)!;
      }
    }
  }
//    else if (span is VdWidgetSpan) {
//      width = width + span.width ?? 1;
//      return width;
//    }
  else if (span is WidgetSpan) {
    width = width + 1;
  }
  return width;
}