paint method

  1. @override
void paint(
  1. PaintingContext context,
  2. Offset offset
)
override

Paints this render object into the given context at offset.

Implementation

@override
void paint(PaintingContext context, Offset offset) {
  const edgeInsetsZero = EdgeInsets.zero;
  final totalMargin = margin ?? edgeInsetsZero;
  final totalPadding = padding ?? edgeInsetsZero;
  final innerOffset = offset + Offset(totalMargin.left, totalMargin.top);
  final innerWidth =
      (size!.width - totalMargin.horizontal).clamp(0, size!.width);
  final innerHeight =
      (size!.height - totalMargin.vertical).clamp(0, size!.height);

  _paintBackground(context, innerOffset, innerWidth, innerHeight);

  if (child != null) {
    final Offset childOffset = _childPaintOffset(totalPadding);
    context.paintChild(child!, innerOffset + childOffset);
  }

  if (_hasBorder) {
    _paintBorder(context, innerOffset, innerWidth, innerHeight);
  }
}