paint method
Called to draw the border around a span.
If the span represents a row, axisDirection
will be AxisDirection.left
or AxisDirection.right. For columns, the axisDirection
will be
AxisDirection.down or AxisDirection.up.
The provided SpanDecorationPaintDetails describes the bounds and orientation of the span that are currently visible inside the viewport. The extent of the actual span may be larger.
If a span contains pinned parts, paint is invoked separately for the pinned and unpinned parts. For example: If a row contains a pinned column, paint is called with the SpanDecorationPaintDetails.rect for the cell representing the pinned column and separately with another SpanDecorationPaintDetails.rect containing all the other unpinned cells.
Implementation
void paint(
SpanDecorationPaintDetails details,
BorderRadius? borderRadius,
) {
final AxisDirection axisDirection = details.axisDirection;
switch (axisDirectionToAxis(axisDirection)) {
case Axis.horizontal:
final Border border = Border(
top: axisDirection == AxisDirection.right ? leading : trailing,
bottom: axisDirection == AxisDirection.right ? trailing : leading,
);
border.paint(
details.canvas,
details.rect,
borderRadius: borderRadius,
);
case Axis.vertical:
final Border border = Border(
left: axisDirection == AxisDirection.down ? leading : trailing,
right: axisDirection == AxisDirection.down ? trailing : leading,
);
border.paint(
details.canvas,
details.rect,
borderRadius: borderRadius,
);
}
}