PaintContext:无法剪切带有圆角的子级

时间:2018-10-23 15:21:28

标签: flutter

为什么drawColor(#1)调用会被裁剪,而paintChild(#2)不会被裁剪?这在paint子类的RenderSliverSingleBoxAdapter方法中。

context.clipRRectAndPaint(
    RRect.fromRectAndCorners(
        offset & Size(paintBounds.width, paintBounds.height + 100.0),
        topLeft: Radius.circular(topCornerRadius),
        topRight: Radius.circular(topCornerRadius)),
    Clip.antiAlias,
    paintBounds, () {

  // 1
  context.canvas.drawColor(Colors.blue, BlendMode.srcOver);

  // 2
  context.paintChild(child, offset);
});

0 个答案:

没有答案