paint method

  1. @override
void paint(
  1. Canvas canvas,
  2. Offset offset,
  3. ImageConfiguration configuration
)
override

Paint the box decoration into the given location on the given canvas

Implementation

@override
void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
  assert(configuration.size != null);

  final Rect rect = offset & configuration.size!;
  final TextDirection? textDirection = configuration.textDirection;

  bool hasLocalAttachment = _hasLocalBackgroundImage();
  if (!hasLocalAttachment) {
    Rect backgroundClipRect = _getBackgroundClipRect(offset, configuration);
    _paintBackgroundColor(canvas, backgroundClipRect, textDirection);

    Rect backgroundOriginRect =
    _getBackgroundOriginRect(offset, configuration);
    Rect backgroundImageRect =
    backgroundClipRect.intersect(backgroundOriginRect);

    _paintBackgroundImage(canvas, backgroundImageRect, configuration);
  }

  _decoration.border?.paint(
    canvas,
    rect,
    shape: _decoration.shape,
    borderRadius: _decoration.borderRadius,
    textDirection: configuration.textDirection,
  );

  _paintShadows(canvas, rect, textDirection);
}