CurlCard class

A card widget with a page-curl effect when swiped horizontally.

This widget renders a card with customizable content and an action layer that is revealed underneath when the user performs a horizontal swipe gesture. The curl effect is achieved using a fragment shader.

Example:

CurlCard(
  width: 300,
  height: 200,
  borderRadius: 16,
  content: Container(
    color: Colors.blue,
    child: Center(child: Text('Swipe me!')),
  ),
  actionLayer: Container(
    color: Colors.red,
    child: Align(
      alignment: Alignment.centerRight,
      child: Padding(
        padding: EdgeInsets.all(16),
        child: Icon(Icons.delete, color: Colors.white),
      ),
    ),
  ),
  onCurlComplete: (amount) {
    if (amount > 0.5) {
      print('Card dismissed!');
    }
  },
)
Inheritance

Constructors

CurlCard({Key? key, required double width, required double height, required Widget content, Widget? actionLayer, double borderRadius = 16.0, double curlThreshold = 150.0, Duration animationDuration = const Duration(milliseconds: 240), Curve animationCurve = Curves.easeOut, VoidCallback? onCurlStart, ValueChanged<double>? onCurlUpdate, OnCurlComplete? onCurlComplete, bool enabled = true})
Creates a curl card widget.
const

Properties

actionLayer Widget?
Optional layer revealed underneath the curl (e.g., delete button).
final
animationCurve Curve
Curve for the snap-back animation.
final
animationDuration Duration
Duration of the snap-back animation when gesture ends.
final
borderRadius double
Corner radius of the card.
final
content Widget
The main content of the card (displayed on top).
final
curlThreshold double
Threshold distance for curl effect visibility (in logical pixels). Higher values = more gradual curl reveal.
final
enabled bool
Whether curl gesture is enabled.
final
hashCode int
The hash code for this object.
no setterinherited
height double
Height of the card.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onCurlComplete OnCurlComplete?
Callback when curl gesture completes (on drag end).
final
onCurlStart VoidCallback?
Callback when curl gesture starts.
final
onCurlUpdate OnCurlComplete?
Callback during curl gesture with curl amount (0.0 to 1.0).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width double
Width of the card.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<CurlCard>
Creates the mutable state for this widget at a given location in the tree.
override
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