Skip to content

A widget for creating whatsapp like drag effect.

License

Notifications You must be signed in to change notification settings

DK070202/swipe_plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;

About

A widget for creating whatsapp like drag effect.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published