All Projects → TEDConsulting → swipedetector

TEDConsulting / swipedetector

Licence: other
A Flutter package to detect up, down, left, right swipes.

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to swipedetector

flutter sliding tutorial
User onboarding library with smooth animation of objects and background colors
Stars: ✭ 127 (+273.53%)
Mutual labels:  flutter-plugin, flutter-demo, flutter-examples, dart2, flutter-widget, flutter-package
flutter-app
Full Feature Todos Flutter Mobile app with fireStore integration.
Stars: ✭ 138 (+305.88%)
Mutual labels:  flutter-plugin, flutter-apps, flutter-examples, dart2, flutter-widget, flutter-package
Motion-Tab-Bar
A beautiful animated flutter widget package library. The tab bar will attempt to use your current theme out of the box, however you may want to theme it.
Stars: ✭ 237 (+597.06%)
Mutual labels:  flutter-plugin, flutter-apps, flutter-demo, flutter-widget, flutter-package
Flutter-Apps
🌀 This is mainly focus on a complete application for production
Stars: ✭ 18 (-47.06%)
Mutual labels:  flutter-plugin, flutter-apps, flutter-examples, flutter-widget, flutter-package
flutter-UI
将Flutter各种Widget各种API📘都实现一次。喜欢请Star。
Stars: ✭ 67 (+97.06%)
Mutual labels:  flutter-apps, flutter-demo, flutter-examples, flutter-widget, flutter-package
http middleware
A middleware library for Dart's http library.
Stars: ✭ 38 (+11.76%)
Mutual labels:  flutter-plugin, flutter-apps, flutter-examples, dart2
Flutter Learning
🔥 👍 🌟 ⭐ ⭐⭐ Flutter all you want.Flutter install,flutter samples,Flutter projects,Flutter plugin,Flutter problems,Dart codes,etc.Flutter安装和配置,Flutter开发遇到的难题,Flutter示例代码和模板,Flutter项目实战,Dart语言学习示例代码。
Stars: ✭ 4,941 (+14432.35%)
Mutual labels:  flutter-plugin, flutter-apps, flutter-examples, flutter-widget
stuff
Crud operation with Firebase
Stars: ✭ 80 (+135.29%)
Mutual labels:  flutter-apps, flutter-demo, flutter-examples, flutter-widget
Gsy flutter demo
Flutter 不同于 GSYGithubAppFlutter 完整项目,本项目将逐步完善各种 Flutter 独立例子,方便新手学习上手和小问题方案解决。 目前开始逐步补全完善,主要提供一些有用或者有趣的例子,如果你也有好例子,欢迎提交 PR 。
Stars: ✭ 2,140 (+6194.12%)
Mutual labels:  flutter-plugin, flutter-demo, flutter-examples, flutter-widget
flutter bolg manage
Flutter实战项目,采用Getx框架管理,遵循Material design设计风格,适合您实战参考或练手
Stars: ✭ 373 (+997.06%)
Mutual labels:  flutter-plugin, flutter-apps, flutter-examples, flutter-widget
liquid button
Liquify your buttons, web demo at website
Stars: ✭ 18 (-47.06%)
Mutual labels:  flutter-plugin, flutter-apps, flutter-widget, flutter-package
flutter todos
A cross platform todo list app using flutter, sqlite etc. If you read the code, you will understand how to create simple elegant mobile app using Flutter and Dart language.
Stars: ✭ 60 (+76.47%)
Mutual labels:  flutter-apps, flutter-demo, flutter-examples, flutter-widget
flutter example
flutter code,flutter-banner,flutter-codekk,flutter-panda,flutter_tab
Stars: ✭ 94 (+176.47%)
Mutual labels:  flutter-plugin, flutter-demo, flutter-examples, flutter-widget
WhatsAppUIClone
WhatsApp UI Clone with Flutter
Stars: ✭ 66 (+94.12%)
Mutual labels:  flutter-apps, flutter-demo, flutter-examples, dart2
barcode.flutter
barcode generate library for Flutter
Stars: ✭ 58 (+70.59%)
Mutual labels:  flutter-plugin, flutter-examples, flutter-widget, flutter-package
Best Flutter Ui Templates
completely free for everyone. Its build-in Flutter Dart.
Stars: ✭ 13,448 (+39452.94%)
Mutual labels:  flutter-apps, flutter-demo, flutter-examples, flutter-widget
Interactive-Add-Button-Layout
Custom Layout with interactive add button to impove your UI and UX .
Stars: ✭ 20 (-41.18%)
Mutual labels:  flutter-demo, flutter-examples, flutter-widget, flutter-package
car rental lite
A platform for car sharing where users can book any car that suits their needs and wants for their intended journey, from the closest hosts in the community.
Stars: ✭ 28 (-17.65%)
Mutual labels:  flutter-apps, flutter-demo, flutter-examples, flutter-widget
Knockdown-Flutter
Enough exercises to knockdown the fear of Flutter in you 👊
Stars: ✭ 33 (-2.94%)
Mutual labels:  flutter-apps, flutter-demo, flutter-examples, flutter-widget
getwidget-docs
Get Widgets UI library docs.
Stars: ✭ 17 (-50%)
Mutual labels:  flutter-plugin, flutter-apps, flutter-widget, flutter-package

swipedetector

A Flutter package to detect up, down, left, right swipes.

Getting Started

For help getting started with Flutter, view our online documentation.

Usage

Using SwipeDetector is straightforward, just wrap it around the Widget you want to detect swipes on.

SwipeDetector(
    child: ... //You Widget Tree here
    ),
    onSwipeUp: () {
        setState(() {
            _swipeDirection = "Swipe Up";
        });
    },
    onSwipeDown: () {
        setState(() {
            _swipeDirection = "Swipe Down";
        });
    },
    onSwipeLeft: () {
      setState(() {
        _swipeDirection = "Swipe Left";
      });
    },
    onSwipeRight: () {
      setState(() {
        _swipeDirection = "Swipe Right";
      });
    },
)

Configuration Options

In case you don't require the default configuration and want to tune the sensitivity of swipes, you can pass your own configuration values.

SwipeDetector(
    child: ... //You Widget Tree here
    ),
    onSwipeUp: ...
    onSwipeDown: ...
    onSwipeLeft: ...
    onSwipeRight: ...,
    swipeConfiguration: SwipeConfiguration(
      verticalSwipeMinVelocity: 100.0,
      verticalSwipeMinDisplacement: 50.0,
      verticalSwipeMaxWidthThreshold:100.0,
      horizontalSwipeMaxHeightThreshold: 50.0,
      horizontalSwipeMinDisplacement:50.0,
      horizontalSwipeMinVelocity: 200.0),
    ),
)

All the parameters are optional, so you can register for any swipe direction and provide any configuration value.

Here is a simple example. Copy and Past to run it.

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String _swipeDirection = "";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: Container(
          child: Row(
            children: <Widget>[
              Expanded(
                child: SwipeDetector(
                  child: Card(
                    child: Container(
                      padding: EdgeInsets.only(
                        top: 80.0,
                        bottom: 80.0,
                        left: 16.0,
                        right: 16.0,
                      ),
                      child: Column(
                        mainAxisSize: MainAxisSize.min,
                        children: <Widget>[
                          Text(
                            'Swipe Me!',
                            style: TextStyle(
                              fontSize: 40.0,
                            ),
                          ),
                          Text(
                            '$_swipeDirection',
                            style: TextStyle(),
                          ),
                        ],
                      ),
                    ),
                  ),
                  onSwipeUp: () {
                    setState(() {
                      _swipeDirection = "Swipe Up";
                    });
                  },
                  onSwipeDown: () {
                    setState(() {
                      _swipeDirection = "Swipe Down";
                    });
                  },
                  onSwipeLeft: () {
                    setState(() {
                      _swipeDirection = "Swipe Left";
                    });
                  },
                  onSwipeRight: () {
                    setState(() {
                      _swipeDirection = "Swipe Right";
                    });
                  },
                  swipeConfiguration: SwipeConfiguration(
                      verticalSwipeMinVelocity: 100.0,
                      verticalSwipeMinDisplacement: 50.0,
                      verticalSwipeMaxWidthThreshold:100.0,
                      horizontalSwipeMaxHeightThreshold: 50.0,
                      horizontalSwipeMinDisplacement:50.0,
                      horizontalSwipeMinVelocity: 200.0),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].