paintBackground method

void paintBackground(
  1. Canvas canvas,
  2. Offset offset,
  3. ImageConfiguration configuration
)

Implementation

void paintBackground(
  Canvas canvas, Offset offset, ImageConfiguration configuration) {
  assert(configuration.size != null);
  Offset baseOffset = Offset.zero;

  final TextDirection? textDirection = configuration.textDirection;
  bool hasLocalAttachment = _hasLocalBackgroundImage();

  // Rect of background color
  Rect backgroundColorRect =
  _getBackgroundClipRect(baseOffset, configuration);
  _paintBackgroundColor(canvas, backgroundColorRect, textDirection);

  // Background image of background-attachment local scroll with content
  Offset backgroundImageOffset = hasLocalAttachment ? offset : baseOffset;
  // Rect of background image
  Rect backgroundClipRect =
  _getBackgroundClipRect(backgroundImageOffset, configuration);
  Rect backgroundOriginRect =
  _getBackgroundOriginRect(backgroundImageOffset, configuration);
  Rect backgroundImageRect =
  backgroundClipRect.intersect(backgroundOriginRect);
  _paintBackgroundImage(canvas, backgroundImageRect, configuration);
}