getClip method
Returns a description of the clip given that the render object being clipped is of the given size.
Implementation
@override
Path getClip(Size size) {
// 定义一个矩形路径
Path outerPath = Path()
..addRect(Rect.fromLTWH(0, 0, size.width, size.height));
// 定义一个内部镂空的矩形路径
Path innerPath = Path()
..addRect(
Rect.fromLTRB(left, top, size.width - right, size.height - bottom));
// 使用 Path.combine 进行路径的合并,将内部的矩形镂空
return Path.combine(PathOperation.difference, outerPath, innerPath);
}