Flutter. GestureDetector in-depth

Flutter. GestureDetector in-depth

For out test examples we will be using simple Flutter app, using started scaffold and simplest GestureDetectorPage() widget. For getting ... Let’s find out the main concepts of GestureDetector widget in examples…

Let’s find out the main concepts of GestureDetector widget in examples…

Image for post

For out test examples, we will be using a simple Flutter app, using the started scaffold, and the simplest *GestureDetectorPage() *widget.

Image for post

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.grey,
      ),
      home: GestureDetectorPage(),
...

GestureDetectorPage() **implementation:**

    class GestureDetectorPage extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Container(
            color: Colors.grey[100],
            width: double.infinity,
            height: double.infinity,
            child: MainContent(),
          ),
        );
      }
    }

    class MainContent extends StatefulWidget {
      @override
      _MainContentState createState() => _MainContentState();
    }

    class _MainContentState extends State<MainContent> {
      String dragDirection = '';
      String startDXPoint = '';
      String startDYPoint = '';

      @override
      Widget build(BuildContext context) {
        return Container(
          child: Center(
              child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text(
                this.dragDirection,
                style: TextStyle(
                  fontSize: 55,
                  fontWeight: FontWeight.w700,
                ),
              ),
              Text(
                'Start DX point: ${this.startDXPoint}',
                style: TextStyle(
                  fontSize: 30,
                  fontWeight: FontWeight.w500,
                ),
              ),
              Text(
                'Start DY point: ${this.startDYPoint}',
                style: TextStyle(
                  fontSize: 30,
                  fontWeight: FontWeight.w500,
                ),
              ),
            ],
          )),
        );
      }
    }

drag scroll gesturedetector swipe flutter

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Google's Flutter 1.20 stable announced with new features - Navoki

Google has announced new flutter 1.20 stable with many improvements, and features, enabling flutter for Desktop and Web

How to Create Liquid Swipe Animation in Flutter | Liquid Swipe Flutter

Today tutorial, I am going to show you how to create Liquid Swipe Animation in Flutter. liquid Swipe animation is amazing and its Created for iOS Platform and f

What is Flutter and why you should learn it?

Flutter is an open-source UI toolkit for mobile developers, so they can use it to build native-looking Android and iOS applications from the same code base for both platforms. Flutter is also working to make Flutter apps for Web, PWA (progressive Web-App) and Desktop platform (Windows,macOS,Linux).

Complete SQLite CRUD Operations in Flutter

Now a days almost all application have to have some kind of data storage. Application without collaboration with other users will make use of local storage db – SQLite. In this tutorial, we are going to cover all CRUD operations in Flutter with SQLite.

How to Create Liquid Swipe Animation in Flutter | Liquid Swipe Flutter

In this tutorial, how to Create liquid Swipe Animation in a flutter inspired by Cuberto. Liquid swipe is the revealing clipper to bring off an amazing liquid...