0 purchases
swipe widget
Swipe Widget #
A Flutter Widget to make your widgets swipe to the sides.
Features #
Your widget will be draggable with a smooth animation.
When dragging to the sides and releasing, the widget will swipe away if it passes a certain threshold.
You can set actions for swipe, left and right, and to when the distance changes.
You can customize how it reacts when dragged, parameters are available when creating the widget.
Getting started #
Install it using pub:
flutter pub add swipe_widget
copied to clipboard
And import the package:
import 'package:swipe_widget/swipe_widget.dart';
copied to clipboard
Usage #
It's as simple as:
SwipeWidget(
child: <widget>
);
copied to clipboard
If you want to add funcionalities you can add Functions:
SwipeWidget(
onSwipe: () => print('Swiped!'),
onSwipeLeft: () => print('Swiped left! I feel rejected...'),
onSwipeRight: () => print('Swiped right!'),
onUpdate: (distance) => print('The distance of the swipe is $distance (from 0 to 1)'),
child: <widget>
);
copied to clipboard
You can change how the swipe should react:
SwipeWidget(
distance: 0.5,
angle: 0.4,
rotation: 25,
scale: 1,
dragStrenght: 0.5,
child: <widget>
);
copied to clipboard
These properties are related to how far the widget is being dragged.
Distance is the threshold needed to take action when released. (Example: If it was 0.5, you would only need to drag half way and releasing, it would act like a full swipe)
Angle is in radians, while rotation is in degrees. (Angle has priority over rotation)
GitHub #
The widget code is available on Github: Flutter - SwipeWidget
Widget Preview #
Example 1
Example 2
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.