zeba_academy_gesture 1.0.0
zeba_academy_gesture: ^1.0.0 copied to clipboard
A Flutter gesture utility package with double tap, long press, swipe, drag and pinch callbacks.
zeba_academy_gesture #
A powerful and lightweight Flutter gesture utility package providing reusable gesture detection widgets with support for double tap, long press, swipe, drag, and pinch callbacks.
Features #
✨ Simple gesture callbacks
✨ Double tap detection
✨ Long press detection
✨ Swipe direction detection
✨ Drag handling
✨ Pinch and scale detection
✨ Lightweight and dependency-free
✨ Null safety support
✨ Clean Flutter-friendly API
Installation #
Add this package to your pubspec.yaml:
dependencies:
zeba_academy_gesture: ^1.0.0
Run:
flutter pub get
Import #
import 'package:zeba_academy_gesture/zeba_academy_gesture.dart';
Usage #
Double Tap & Long Press #
ZebaGestureDetector(
onDoubleTap: () {
print("Double Tap Detected");
},
onLongPress: () {
print("Long Press Detected");
},
child: Container(
height: 150,
width: 150,
color: Colors.blue,
),
)
Swipe Detection #
Detect left, right, up, and down swipe gestures.
ZebaSwipeDetector(
onSwipe: (direction) {
switch(direction){
case SwipeDirection.left:
print("Swiped Left");
break;
case SwipeDirection.right:
print("Swiped Right");
break;
case SwipeDirection.up:
print("Swiped Up");
break;
case SwipeDirection.down:
print("Swiped Down");
break;
}
},
child: Container(
height: 200,
width: 200,
color: Colors.green,
),
)
Drag Detection #
Handle drag updates and drag completion.
ZebaDragDetector(
onDragUpdate: (details){
print(
details.delta
);
},
onDragEnd: (details){
print("Drag Completed");
},
child: Container(
height: 200,
width: 200,
color: Colors.orange,
),
)
Pinch / Zoom Detection #
Use pinch gestures for zooming and scaling.
ZebaPinchDetector(
onScale: (scale){
print(
"Current scale: $scale"
);
},
child: Image.asset(
"assets/image.png",
),
)
Available Widgets #
| Widget | Description |
|---|---|
ZebaGestureDetector |
Double tap, long press, and tap callbacks |
ZebaSwipeDetector |
Detect swipe direction |
ZebaDragDetector |
Handle drag gestures |
ZebaPinchDetector |
Handle pinch and zoom gestures |
Swipe Directions #
enum SwipeDirection {
left,
right,
up,
down,
}
Example Application #
class GestureExample extends StatelessWidget {
const GestureExample({
super.key,
});
@override
Widget build(BuildContext context){
return Scaffold(
body: Center(
child: ZebaSwipeDetector(
onSwipe: (direction){
print(direction);
},
child: Container(
width: 200,
height: 200,
color: Colors.blue,
),
),
),
);
}
}
Why Use Zeba Academy Gesture? #
Flutter provides powerful gesture APIs, but managing reusable gesture logic across applications can become repetitive.
zeba_academy_gesture provides:
✅ Consistent gesture APIs
✅ Cleaner widget structure
✅ Reusable components
✅ Faster development workflow
Roadmap #
Future improvements:
- Gesture sensitivity configuration
- Swipe velocity customization
- Pinch start/end callbacks
- Rotation gesture support
- Multi-touch gesture support
- Gesture event streams
Contributing #
Contributions are welcome.
Steps:
- Fork the repository
- Create your feature branch
git checkout -b feature/new-feature
- Commit your changes
git commit -m "Add new feature"
- Push the branch
git push origin feature/new-feature
- Create a Pull Request
About Me #
✨ I’m Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects.
You can learn more about me and my work at:
Connect with me on LinkedIn:
🔗 https://www.linkedin.com/in/sufyanism
Your all-in-one learning hub! #
🚀 Explore courses and resources in coding, tech, and development at:
🌐 https://zeba.academy
🌐 https://code.zeba.academy
Empower yourself with practical skills through curated tutorials, real-world projects, and hands-on experience.
Level up your tech game today! 💻✨
Zeba Academy #
Zeba Academy is a learning platform dedicated to coding, technology, and development.
➡ Main Website:
➡ Hands-on courses and resources:
➡ YouTube Tutorials:
https://www.youtube.com/@zeba.academy
➡ Instagram:
https://www.instagram.com/zeba.academy/
License #
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
You are free to use, modify, and distribute this package under the terms of the GPL-3.0 license.
See the full license:
https://www.gnu.org/licenses/gpl-3.0.html
Thank you for using zeba_academy_gesture! ❤️