Skip to content

Swipable

Inheritance

Constructors

Swipable

const Swipable({
  1. Key? key,
  2. @required Widget? child,
  3. void onSwipeRight(
    1. Offset finalPosition
    )?,
  4. void onSwipeLeft(
    1. Offset finalPosition
    )?,
  5. void onSwipeDown(
    1. Offset finalPosition
    )?,
  6. void onSwipeUp(
    1. Offset finalPosition
    )?,
  7. void onPositionChanged(
    1. DragUpdateDetails details
    )?,
  8. void onSwipeStart(
    1. DragStartDetails details
    )?,
  9. void onSwipeCancel(
    1. Offset position,
    2. DragEndDetails details
    )?,
  10. void onSwipeEnd(
    1. Offset position,
    2. DragEndDetails details
    )?,
  11. Stream<double>? swipe,
  12. int? animationDuration = 300,
  13. Curve? animationCurve = Curves.easeInOut,
  14. bool horizontalSwipe = true,
  15. bool verticalSwipe = true,
  16. double? threshold = 0.3,
})

Properties

animationCurve

Curve? animationCurve
final

@param animationCurve Curve Animation timing function.

animationDuration

int? animationDuration
final

@param animationDuration int Animation duration (in milliseconds) for the card to swipe atuomatically or get back to its original position on swipe cancel.

child

Widget? child
final

@param child Widget @required Swipable content.

horizontalSwipe

bool horizontalSwipe
final

@param horizontalSwipe bool To enable or disable the swipe in horizontal direction. defaults to true.

onPositionChanged

void Function(DragUpdateDetails details)? onPositionChanged
final

Callback Hook triggered when the card position changes. @param details DragUpdateDetails

onSwipeCancel

void Function(Offset position, DragEndDetails details)? onSwipeCancel
final

Callback Hook triggered when the card stopped being dragged and doesn't meet the requirement to be swiped. @param details DragEndDetails

onSwipeDown

void Function(Offset finalPosition)? onSwipeDown
final

Callback Hook triggered when the card finished swiping down. @param finalPosition Offset

onSwipeEnd

void Function(Offset position, DragEndDetails details)? onSwipeEnd
final

Callback Hook triggered when the card stopped being dragged and meets the requirement to be swiped. @param details DragEndDetails

onSwipeLeft

void Function(Offset finalPosition)? onSwipeLeft
final

Callback Hook triggered when the card finished swiping left. @param finalPosition Offset

onSwipeRight

void Function(Offset finalPosition)? onSwipeRight
final

Callback Hook triggered when the card finished swiping right. @param finalPosition Offset

onSwipeStart

void Function(DragStartDetails details)? onSwipeStart
final

Callback Hook triggered when the card starts being dragged. @param details DragStartDetails

onSwipeUp

void Function(Offset finalPosition)? onSwipeUp
final

Callback Hook triggered when the card finished swiping up. @param finalPosition Offset

swipe

Stream<double>? swipe
final

@param swipe Stream<double> Triggers an automatic swipe. Cancels automatically after first emission.R The double value sent corresponds to the direction the card should follow (clockwise radian angle).

threshold

double? threshold
final

@param threshold double Defines the strength needed for a card to be swiped. The bigger, the easier it is to swipe.

verticalSwipe

bool verticalSwipe
final

@param verticalSwipe bool To enable or disable the swipe in vertical direction. defaults to true.

Methods

createState

SwipableState createState()
override

Creates the mutable state for this widget at a given location in the tree.

Subclasses should override this method to return a newly created instance of their associated State subclass:

@override
State<SomeWidget> createState() => _SomeWidgetState();

The framework can call this method multiple times over the lifetime of a StatefulWidget. For example, if the widget is inserted into the tree in multiple locations, the framework will create a separate State object for each location. Similarly, if the widget is removed from the tree and later inserted into the tree again, the framework will call createState again to create a fresh State object, simplifying the lifecycle of State objects.