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) {
const sz = 20.0;
var path = Path();
switch (test) {
case 0:
// clockwise - normal
path
..addRect(Rect.fromLTRB(sz / 2, sz / 2, size.width, size.height))
..moveTo(0, 0)
..lineTo(sz, 0)
..lineTo(sz, sz)
..lineTo(0, sz)
..close();
case 1:
// counterclockwise - hole
path
..addRect(Rect.fromLTRB(sz / 2, sz / 2, size.width, size.height))
..moveTo(0, 0)
..lineTo(0, sz)
..lineTo(sz, sz)
..lineTo(sz, 0)
..close();
case 2:
path.addRRect(
RRect.fromLTRBR(
sz,
0,
size.width,
size.height,
const Radius.circular(sz),
),
);
// Magic shadow
final path2 = Path()
..moveTo(sz + sz, 0)
..lineTo(sz + sz, sz)
..lineTo(0, sz)
..lineTo(0, 0)
..close();
path = Path.combine(PathOperation.union, path, path2);
case 3:
path.addRRect(
RRect.fromLTRBR(sz, 0, size.width, size.height, Radius.zero),
);
// Magic shadow
final path2 = Path()
..moveTo(sz + sz, 0)
..lineTo(sz + sz, sz)
..lineTo(0, sz)
..lineTo(0, 0)
..close();
path = Path.combine(PathOperation.union, path, path2);
}
return path;
}