createBackgroundSkeleton method

Skeleton? createBackgroundSkeleton(
  1. Element element,
  2. Rect elementRect,
  3. double width
)

Implementation

Skeleton? createBackgroundSkeleton(
  Element element,
  Rect elementRect,
  double width,
) {
  final double lineWidth = width;
  final Rect parentRectWithBorder = Rect.fromLTWH(
    elementRect.left + lineWidth,
    elementRect.top + lineWidth,
    elementRect.width - lineWidth,
    elementRect.height - lineWidth,
  );
  final Color? color = (element.renderObject as dynamic)?.decoration?.container?.fillColor as Color?;
  if (color == null) {
    return null;
  }

  return Skeleton(
    color: color,
    opacity: color.alpha / 0xFF,
    rect: parentRectWithBorder,
  );
}