Ticket class

A customizable ticket-style widget that supports rounded corners, cutout effects, shadows, and child content.

Typically used for event tickets, vouchers, or boarding passes. You can control the orientation (CardPosition.horizontal or CardPosition.vertical), background color, shadows, and more.

Inheritance

Constructors

Ticket({Key? key, EdgeInsets padding = const EdgeInsets.symmetric(horizontal: 10), double borderRadius = 10, double clipRadius = 10, double smallClipRadius = 4, int numberOfSmallClips = 10, CardPosition cardPosition = CardPosition.horizontal, Color backgroundColor = Colors.blue, List<BoxShadow>? boxShadow, double ticketWidth = 350, double ticketHeight = 500, required Widget child, double circlePosition = 0.2})
Creates a new Ticket widget with customizable styling.
const

Properties

backgroundColor Color
Background color of the ticket.
final
borderRadius double
The corner radius of the ticket shape.
final
boxShadow List<BoxShadow>?
Optional shadows for the ticket.
final
cardPosition CardPosition
Ticket orientation: horizontal or vertical.
final
child Widget
The widget to render inside the ticket.
final
circlePosition double
Position (0–1) along the width/height where the large circle cutouts are drawn.
final
clipRadius double
The radius of the large circular cutouts.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
numberOfSmallClips int
The total number of small perforated circles to draw.
final
padding EdgeInsets
Inner padding for the ticket content.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
smallClipRadius double
The radius of the small perforated circles.
final
ticketHeight double
The overall height of the ticket.
final
ticketWidth double
The overall width of the ticket.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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