gestures 1.0.0 copy "gestures: ^1.0.0" to clipboard
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,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
5
likes
150
points
12.9k
downloads

Publisher

verified publisherandrebaltazar.com

Weekly Downloads

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