0
0
Fluttermobile~5 mins

GestureDetector in Flutter - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the GestureDetector widget in Flutter?
The GestureDetector widget detects gestures like taps, drags, and swipes on its child widget and lets you respond to them.
Click to reveal answer
beginner
Which property of GestureDetector handles a tap event?
The onTap property is a callback that runs when the user taps the widget.
Click to reveal answer
beginner
How do you make a widget respond to a double tap using GestureDetector?
Use the onDoubleTap property and provide a function to run when the user double taps the widget.
Click to reveal answer
intermediate
Can GestureDetector detect drag gestures? If yes, which callback is used?
Yes, it can detect drag gestures using callbacks like onPanUpdate which gives the drag movement details.
Click to reveal answer
intermediate
What happens if you wrap a button with GestureDetector and use onTap?
The GestureDetector will detect taps on the button and run your onTap code, allowing you to customize tap behavior.
Click to reveal answer
Which GestureDetector property detects a single tap?
AonTap
BonDoubleTap
ConLongPress
DonPanUpdate
What type of widget must GestureDetector have inside it?
AA text widget only
BA parent widget
CNo widget needed
DA child widget to detect gestures on
Which callback detects when the user drags their finger across the screen?
AonTap
BonPanUpdate
ConDoubleTap
DonLongPress
If you want to detect a long press, which GestureDetector property do you use?
AonTap
BonDoubleTap
ConLongPress
DonPanEnd
What happens if you do not provide any gesture callbacks to GestureDetector?
AIt does nothing on gestures
BIt disables child widget
CIt throws an error
DIt still detects gestures automatically
Explain how to use GestureDetector to detect a tap and change the color of a box.
Think about wrapping a colored box and changing its color inside onTap.
You got /4 concepts.
    Describe the difference between onTap and onDoubleTap in GestureDetector.
    Consider how users interact with buttons or images differently.
    You got /4 concepts.