TicketClipper class

A CustomClipper that creates a ticket-style shape.

Supports both vertical and horizontal layouts with:

  • Rounded or straight borders
  • Large circular cutouts (sides/top/bottom)
  • Optional small "torn" holes for a perforated effect

Typically used together with ClipPath to create widgets resembling tickets, boarding passes, or vouchers.

Inheritance

Constructors

TicketClipper({required double borderRadius, required double clipRadius, required double smallClipRadius, required int numberOfSmallClips, required CardPosition cardPosition, required double circlePosition})
Creates a new TicketClipper with the given configuration.
const

Properties

borderRadius double
The corner radius of the main ticket rectangle.
final
cardPosition CardPosition
Defines the layout orientation of the ticket (CardPosition.horizontal or CardPosition.vertical).
final
circlePosition double
Position (0–1) along the width/height where the main circle is drawn.
final
clipRadius double
The radius of the main circular cutouts (sides for horizontal, top/bottom for vertical).
final
hashCode int
The hash code for this object.
no setterinherited
numberOfSmallClips int
The total number of small perforated circles to draw.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
smallClipRadius double
The radius of the small perforated circles.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be notified when it is time to reclip.
inherited
circle(Size size) List<Rect>
Returns the two large circular cutouts (either left/right or top/bottom).
getApproximateClipRect(Size size) Rect
Returns an approximation of the clip returned by getClip, as an axis-aligned Rect. This is used by the semantics layer to determine whether widgets should be excluded.
inherited
getClip(Size size) Path
Builds the final ticket path by combining the base rectangle, large circles, and small perforations.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rect(Size size) RRect
Returns a rounded rectangle that represents the base shape of the ticket.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies when it is time to reclip.
inherited
shouldReclip(covariant TicketClipper oldClipper) bool
Called whenever a new instance of the custom clipper delegate class is provided to the clip object, or any time that a new clip object is created with a new instance of the custom clipper delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

clipPadding → const double
Padding from the edge before small clips start.