11Applying Interactivity

WHAT YOU WILL LEARN IN THIS CHAPTER

  • How to use GestureDetector, which recognizes gestures such as tap, double tap, long press, pan, vertical drag, horizontal drag, and scale.
  • How to use the Draggable widget that is dragged to a DragTarget.
  • How to use the DragTarget widget that receives data from a Draggable.
  • How to use the InkWell and InkResponse widgets. You will learn that InkWell is a rectangular area that responds to touch and clips splashes within its area. You'll learn that InkResponse responds to touch and that splashes expand outside its area.
  • How to use the Dismissible widget that is dismissed by dragging.

In this chapter, you'll learn how to add interactivity to an app by using gestures. In a mobile application, gestures are the heart of listening to user interaction. Making use of gestures can define an app with a great UX. Overusing gestures when they don't add value or convey an action creates a poor UX. You'll take a closer look at how to find a balance by using the correct gesture for the task at hand.

SETTING UP GESTUREDETECTOR: THE BASICS

The GestureDetector widget detects gestures such as tap, double tap, long press, pan, vertical drag, horizontal drag, and scale. It has an optional child property, and if a child widget is specified, the gestures apply only to the child widget. If the child widget is omitted, then the GestureDetector fills the entire parent instead. If you need to catch vertical drag and horizontal drag at the same ...

Get Beginning Flutter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.