NmSwipeCard class

A card of a swipe deck: follows the finger with a tilt, shows the LIKE / PASS stamps while dragged sideways, and flies out in the drag direction once it passes threshold (then calls onSwipe); otherwise it springs back. Background cards set enabled false. Screen readers get "Like" / "Pass" / "Save for later" actions. Added in 0.3.0.

Inheritance

Constructors

NmSwipeCard({Key? key, required Widget child, ValueChanged<NmSwipeDirection>? onSwipe, VoidCallback? onTap, bool enabled = true, double threshold = 100, double maxRotation = .3, double radius = 20, String? likeLabel, String? passLabel, Duration flyOut = const Duration(milliseconds: 200)})
Creates a NmSwipeCard.
const

Properties

child → Widget
Card face.
final
enabled → bool
Whether the card reacts to drags and taps (the front card of a deck).
final
flyOut → Duration
Time the card takes to fly out before onSwipe fires.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
likeLabel → String?
Stamp on a right drag (defaults to the localized "LIKE").
final
maxRotation → double
Largest tilt, in radians.
final
onSwipe → ValueChanged<NmSwipeDirection>?
Called after the card has flown out in a direction.
final
onTap → VoidCallback?
Called when the card is tapped.
final
passLabel → String?
Stamp on a left drag (defaults to the localized "PASS").
final
radius → double
Corner radius of the card (the stamp border follows it).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
threshold → double
Drag distance that counts as a swipe.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<NmSwipeCard>
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