swipe_plus 0.8.1 copy "swipe_plus: ^0.8.1" to clipboard
swipe_plus: ^0.8.1 copied to clipboard

Simple way to implement horizontal drag interaction.

Swipe Plus. #

For creating a message drag effect. #

Installation #

  swipe_plus:
    git:
      url: https://github.com/DK070202/drag_and_swipe.git
      ref: master

Usage. #

Wrap your widget with SwipePlus and provide onDragComplete and/or onDragCancel callback.

SwipePlus(
    child: someWidget,
    onDragComplete: (){
        /// TODO : Reply to message.
    }
)

Available Configuration. #

1.onDragComplete On drag complete call back

  /// When horizontal drag is enough to cross [minThreshold] then it will be called.
  final VoidCallback? onDragComplete;

2.onDragCancel callback for drag cancel.

/// When horizontal drag is not enough to cross [minThreshold] and callback
/// canceled from user.
final VoidCallback? onDragCancel;

3.alignment For aligning child.

  /// This uses [Align] and [ColoredBox] internally to set Alignment of Widget
  /// so, the complete area of widget including whitespace can be available for
  /// hit-test.
  final Alignment alignment;

4.dragDirection It decides the drag direction of child.

  /// * If [DragDirection.RTL] then it can dragged from right side to left side.
  /// * If [DragDirection.LTR] then it can be dragged from left to to right.
  final DragDirection alignment;

5.maxTranslation Value of width percentage of child,for max translation in direction.

 /// It defines bounds of translation in direction. If it is set to .3 then at
 /// max drag you will able to translate 30% of [child] size in any direction.
 final double maxTranslation;

6.reverseDuration Duration for reverse translation.

  /// If drag not completes or if it not crosses the [minThreshold] percentage
  /// of width then it play reverse animation with [reverseDuration] duration.
  final Duration reverseDuration;

7.minThreshold A percentage of minThreshold for calling completeCallback.

  /// It helps to define boundary for calling [onDragComplete]. If it is set
  /// to .2 and the value of [maxTranslation] is set to .3 then if we leave 
  /// drag handle at grater than 15% of translation it will consider this action
  /// as threshold.
  final Duration reverseDuration;
16
likes
150
points
48
downloads

Publisher

unverified uploader

Weekly Downloads

Simple way to implement horizontal drag interaction.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on swipe_plus