Lecture 7-1 (Gesture)
Lecture 7-1 (Gesture)
Gestures are primarily a way for a user to interact with a mobile (or any
touch based device) application. Some examples of gestures are:
• When the mobile screen is locked, you slide your finger across the screen to
unlock it.
• Tapping a button on your mobile screen, and
• Tapping and holding an app icon on a touch-based device to drag it across
screens.
body: Center(
child: GestureDetector(
onTap: () {
// do your code
},
child: Container
child: Text( 'Hello World’, ),
color: Colors.yellow) ),
IT Industry-Academia Bridge Program
GestrueDetector Callback Functions
• Tap: The user briefly touched the screen with a fingertip.
Callback Functions:- onTapDown, onTapUp, onTap, onTapCancel
Applications:- Select / Cancel / Submit
• Double-tap:- The user tapped the screen at the same location twice in quick succession.
Callback Functions: onDoubleTapDown / onDoubleTap / onDoubleTapCancel
Applications: Like / dislike, Screen on/off, Resize an image
• Long Press:- The user made contact with the screen at the same location for a long period of time.
Callback Functions: nLongPressDown, onLongPressStart, onLongPress, onLongPressEnd, onLongPressUp
Applications: Show more options, Move an icon
• Scale:- The user pinched or spread the screen.
Callback Functions: onScaleStart, onScaleEnd, onScaleUpdate, screenPossible
Applications: Zoom in/out, Rotation.
• Vertical Drag:- The user made contact with the screen and moved their fingertip in a steady manner
vertically.
Callback Function: onVerticalDragDown, onVerticalDragStart, onVerticalDragEnd, onVerticalDragCancel,
onVerticalDragDown
Applications: Scrool
Horzontal Drag: The user made contact with the screen and moved their fingertip in a steady manner
horizontally.
GestureDetector with Scalling
With Scalling user pinched or spread the screen. Its callback
function are
onScaleStart: triggered when contact with the screen has
established. It has a parameter of type ScaleStartDetails.
onScaleEnd: triggered when user is no longer making contact
with. It has a parameter of type ScaleEndDetails.
onScaleUpdate: triggered when contact with the screen has
indicated a new focal point and/or scale. It has a parameter
of type onScaleUpdate.