gestures 1.0.0 icon indicating copy to clipboard operation
gestures: ^1.0.0 copied to clipboard

Custom Gesture Detector for Flutter. Empower your users with custom gestures.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter Demo Home Page'),
      ),
      body: CustomGestureDetector(
        behavior: HitTestBehavior.opaque,
        gestures: [
          GestureLine(AxisDirection.up),
        ],
        onGestureEnd: (bool success) {
          if (success) _incrementCounter();
        },
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              const Text(
                'You have pushed the button this many times:',
              ),
              Text(
                '$_counter',
                style: Theme.of(context).textTheme.headline4,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
130
pub points
83%
popularity

Publisher

verified publisher iconandrebaltazar.com

Custom Gesture Detector for Flutter. Empower your users with custom gestures.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on gestures