getClip method

  1. @override
Path getClip(
  1. Size size
)
override

Builds the final ticket path by combining the base rectangle, large circles, and small perforations.

Implementation

@override
Path getClip(Size size) {
  var path = Path()..addRRect(rect(size));

  final clipPath = Path()
    ..addOval(circle(size).first)
    ..addOval(circle(size).last);

  // Add small perforated holes
  for (var centerOffset in _getSmallChip(size)) {
    clipPath.addOval(
        Rect.fromCircle(center: centerOffset, radius: smallClipRadius));
  }

  return Path.combine(PathOperation.reverseDifference, clipPath, path);
}