zeba_academy_custom_gesture

Smart multi-touch gesture detection for Flutter apps with swipe pattern recognition and macros.


Features

  • Multi-touch gesture recognition (supports up to 5 simultaneous touches)
  • Swipe detection in four directions: up, down, left, right
  • Macro detection for custom swipe patterns (zigzag, double swipe, etc.)
  • Easy-to-use API for integration in games, creative apps, or custom controls
  • Works on mobile, tablet, and desktop

Installation

Add the package to your pubspec.yaml:

dependencies:
  zeba_academy_custom_gesture:
    path: ../zeba_academy_custom_gesture

Then run:

flutter pub get

Usage

import 'package:flutter/material.dart';
import 'package:zeba_academy_custom_gesture/zeba_academy_custom_gesture.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  final GestureMacroManager macroManager = GestureMacroManager()
    ..registerMacro("zigzag", [
      SwipeDirection.right,
      SwipeDirection.down,
      SwipeDirection.left,
      SwipeDirection.up,
    ])
    ..registerMacro("doubleDown", [
      SwipeDirection.down,
      SwipeDirection.down,
    ]);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: CustomGestureDetector(
          macroManager: macroManager,
          onSwipe: (dir) => print("Swipe: $dir"),
          onMacroDetected: (macro) => print("Macro detected: $macro"),
          child: Center(
            child: Container(
              width: 250,
              height: 250,
              decoration: BoxDecoration(
                color: Colors.blue.shade200,
                borderRadius: BorderRadius.circular(16),
              ),
              alignment: Alignment.center,
              child: const Text(
                "Swipe Here!\nTry zigzag or double down",
                textAlign: TextAlign.center,
                style: TextStyle(fontSize: 18, color: Colors.white),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

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 sufyanism.com or connect with me on Linkedin

Your all-in-one no-bloat hub!

🚀 Explore cutting-edge resources in coding, tech, and development at zeba.academy and code.zeba.academy. Empower yourself with practical skills through curated directives, real-world projects, and hands-on experience. Level up your tech game today! 💻✨

Zeba Academy is a learning platform dedicated to coding, technology, and development. ➡ Visit our main site: zeba.academy
➡ Explore hands-on courses and resources at: code.zeba.academy
➡ Check out our YouTube for more tutorials: zeba.academy
➡ Follow us on Instagram: zeba.academy

Thank you for visiting!