Gesture Detector In Flutter

Gesture Detector In Flutter

Gesture Detector In Flutter

GestureDetector.dart

// Gestures

import 'package:flutter/material.dart';

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

class FirstApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Image App",
      home: new Scaffold(
        body: new Center(
          child: new Container(
            child: new InteractableWidget(),
          ),
        ),
      ),
    );
  }
}

class InteractableWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new GestureDetector(
      child: new PictureWidget(),
      //   onDoubleTap: () => print("Double Tap"),
      //     onHorizontalDragCancel: () => print("Dragged"),
      //    onHorizontalDragDown: (e)=> print(e),
      onHorizontalDragStart: (e) => print(e),
      //    onHorizontalDragEnd: (e)=> print(e),
      //    onHorizontalDragUpdate: (e)=> print(e),
      //     onTap: () => print("onTap"),
      //   onTapCancel: ()=> print("Tap Cancel"),
//      onTapDown: (e)=> print(e),
//      onTapUp: (e)=> print(e),
      onPanEnd: (e) => print(e),
    );
  }
}

class PictureWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new DecoratedBox(
      child: new Center(widthFactor: 2.0, child: new Text("My Image")),
      position: DecorationPosition.background,
      decoration: new BoxDecoration(
        shape: BoxShape.circle,
        color: Colors.blue,
        image: new DecorationImage(image: new AssetImage("assets/firefox.png")),
      ),
    );
  }
}

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit www.fluttertutorial.in