SlideShare a Scribd company logo
Mobile Application Development
class 05
Dr. Mazin Alkathiri
IT Department
Seiyun University
2023-2024
Flutter - Introduction to Gestures
• Gestures are an interesting feature in Flutter that allows us to interact
with the mobile app (or any touch-based device).
• Generally, gestures define any physical action or movement of a user in
the intention of specific control of the mobile device.
• Some of the 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.
• Flutter divides the gesture system into two different layers, which are
given below:
– Pointers
– Gestures
Pointers
• Pointers are the first layer that represents the raw data about
user interaction.
• It has events, which describe the location and movement of
pointers such as touches, mice, and style across the screens.
• Flutter does not provide any mechanism to cancel or stop the
pointer-events from being dispatched further.
• Flutter provides a Listener widget to listen to the pointer-
events directly from the widgets layer.
• The pointer-events are categories into mainly four types:
– PointerDownEvents
– PointerMoveEvents
– PointerUpEvents
– PointerCancelEvents
• PointerDownEvents: It allows the pointer to
contact the screen at a particular location.
• PointerMoveEvents: It allows the pointer to
move from one location to another location
on the screen.
• PointerUpEvents: It allows the pointer to stop
contacting the screen.
• PointerCancelEvents: This event is sent when
the pointer interaction is canceled.
Listener(
onPointerDown: (event) {
print('Pointer down');
},
onPointerUp: (event) {
print('Pointer up');
},
onPointerMove: (event) {
print('Pointer move');
},
child:Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
),
Gestures
• It is the second layer that represents semantic
actions such as tap, drag, and scale, which are
recognized from multiple individual pointer
events.
• It is also able to dispatch multiple events
corresponding to gesture lifecycle like drag start,
drag update, and drag end.
• Some of the popularly used gesture are listed
below:
Some of the widely used gestures are
mentioned here −
• Tap − Touching the surface of the device with fingertip for a
short period and then releasing the fingertip.
• Double Tap − Tapping twice in a short time.
• Drag − Touching the surface of the device with fingertip and
then moving the fingertip in a steady manner and then
finally releasing the fingertip.
• Flick − Similar to dragging, but doing it in a speeder way.
• Pinch − Pinching the surface of the device using two
fingers.
• Spread/Zoom − Opposite of pinching.
• Panning − Touching the surface of the device with fingertip
and moving it in any direction without releasing the
fingertip.
Gesture Detector
• Flutter provides an excellent support for all type of
gestures through its exclusive widget,
GestureDetector.
• GestureDetector is a non-visual widget primarily
used for detecting the user’s gesture.
• To identify a gesture targeted on a widget, the widget
can be placed inside GestureDetector widget.
• GestureDetector will capture the gesture and
dispatch multiple events based on the gesture.
return new Scaffold(
appBar: new AppBar(
title: new Text('Gestures Example'),
centerTitle: true,
),
body: new Center(child: GestureDetector(
onTap: () {
print('Box Clicked');
},
child: Container(
height: 60.0,
width: 120.0,
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.blueGrey,
borderRadius: BorderRadius.circular(15.0),
),
child: Center(child: Text('Click Me')),
)
)),
);
Some of the gestures and the
corresponding events are given below
• Tap
– onTapDown
– onTapUp
– onTap
– onTapCancel
• Double tap
– onDoubleTap
• Long press
– onLongPress
• Vertical drag
– onVerticalDragStart
– onVerticalDragUpdate
– onVerticalDragEnd
• Horizontal drag
– onHorizontalDragStart
– onHorizontalDragUpdate
– onHorizontalDragEnd
• Pan
– onPanStart
– onPanUpdate
– onPanEnd
• let us modify the hello world application to include
gesture detection feature and try to understand the
concept.
• Change the body content of the MyHomePage widget
as shown below −
body: Center(
child: GestureDetector(
onTap: () {
_showDialog(context);
},
child: Text( 'Hello World', )
)
),
• Observe that here we have placed the
GestureDetector widget above the Text widget in
the widget hierarchy, captured the onTap event
and then finally shown a dialog window.
• Implement the *_showDialog* function to
present a dialog when user tabs the hello world
message. It uses the
generic showDialog and AlertDialog widget to
create a new dialog widget.
• The code is shown below –
// user defined function void _showDialog(BuildContext context)
{
// flutter defined function
showDialog(
context: context, builder: (BuildContext context) {
// return object of type Dialog
return AlertDialog(
title: new Text("Message"),
content: new Text("Hello World"),
actions: <Widget>[
new FlatButton(
child: new Text("Close"),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}
Flutter also provides a set of widgets that can allow you to do a specific as
well as advanced gestures. These widgets are given below:
• Dismissible: It is a type of widget that supports the flick gesture to
dismiss the widget.
• Draggable: It is a type of widget that supports drag gestures to move
the widget.
• LongPressDraggable: It is a type of widget that supports drag gesture to
move a widget along with its parent widget.
• DragTarget: It is a type of widget that can accept any Draggable widget
• IgnorePointer: It is a type of widget that hides the widget and its
children from the gesture detection process.
• AbsorbPointer: It is a type of widget that stops the gesture detection
process itself. Due to this, any overlapping widget cannot able to
participate in the gesture detection process, and thus, no event is
raised.
• Scrollable: It is a type of widget that supports scrolling of the content
which is available inside the widget.
Ad

More Related Content

Similar to Mobile Application Development class 005 (20)

FlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptFlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.ppt
KevinNemo
 
Scratching the Surface with JavaFX
Scratching the Surface with JavaFXScratching the Surface with JavaFX
Scratching the Surface with JavaFX
javafxpert
 
Scratching the Surface with JavaFX
Scratching the Surface with JavaFXScratching the Surface with JavaFX
Scratching the Surface with JavaFX
NLJUG
 
DHTML - Events & Buttons
DHTML - Events  & ButtonsDHTML - Events  & Buttons
DHTML - Events & Buttons
Deep Patel
 
Multi Touch presentation
Multi Touch presentationMulti Touch presentation
Multi Touch presentation
senthil0809
 
How to use Listener Class in Flutter.pptx
How to use Listener Class in Flutter.pptxHow to use Listener Class in Flutter.pptx
How to use Listener Class in Flutter.pptx
RubenGray1
 
Tips for building fast multi touch enabled web sites
 Tips for building fast multi touch enabled web sites Tips for building fast multi touch enabled web sites
Tips for building fast multi touch enabled web sites
Aspenware
 
Fast multi touch enabled web sites
Fast multi touch enabled web sitesFast multi touch enabled web sites
Fast multi touch enabled web sites
Aspenware
 
Event handling
Event handlingEvent handling
Event handling
swapnac12
 
tL20 event handling
tL20 event handlingtL20 event handling
tL20 event handling
teach4uin
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
PERKYTORIALS
 
Advance java for bscit
Advance java for bscitAdvance java for bscit
Advance java for bscit
YogeshDhamke2
 
Developing Multi Touch Applications
Developing Multi Touch ApplicationsDeveloping Multi Touch Applications
Developing Multi Touch Applications
Brian Blanchard
 
Automate Mobile Gestures in Appium_ A Detailed Guide for Developers.pdf
Automate Mobile Gestures in Appium_ A Detailed Guide for Developers.pdfAutomate Mobile Gestures in Appium_ A Detailed Guide for Developers.pdf
Automate Mobile Gestures in Appium_ A Detailed Guide for Developers.pdf
kalichargn70th171
 
event-handling.pptx
event-handling.pptxevent-handling.pptx
event-handling.pptx
usvirat1805
 
Unreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User InterfaceUnreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User Interface
Nick Pruehs
 
Unit 6 Java
Unit 6 JavaUnit 6 Java
Unit 6 Java
arnold 7490
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
Palakjaiswal43
 
Event handling in Java(part 1)
Event handling in Java(part 1)Event handling in Java(part 1)
Event handling in Java(part 1)
RAJITHARAMACHANDRAN1
 
Introduction to development
Introduction to developmentIntroduction to development
Introduction to development
Matteo Valoriani
 
FlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.pptFlutterArchitecture FlutterArchitecture.ppt
FlutterArchitecture FlutterArchitecture.ppt
KevinNemo
 
Scratching the Surface with JavaFX
Scratching the Surface with JavaFXScratching the Surface with JavaFX
Scratching the Surface with JavaFX
javafxpert
 
Scratching the Surface with JavaFX
Scratching the Surface with JavaFXScratching the Surface with JavaFX
Scratching the Surface with JavaFX
NLJUG
 
DHTML - Events & Buttons
DHTML - Events  & ButtonsDHTML - Events  & Buttons
DHTML - Events & Buttons
Deep Patel
 
Multi Touch presentation
Multi Touch presentationMulti Touch presentation
Multi Touch presentation
senthil0809
 
How to use Listener Class in Flutter.pptx
How to use Listener Class in Flutter.pptxHow to use Listener Class in Flutter.pptx
How to use Listener Class in Flutter.pptx
RubenGray1
 
Tips for building fast multi touch enabled web sites
 Tips for building fast multi touch enabled web sites Tips for building fast multi touch enabled web sites
Tips for building fast multi touch enabled web sites
Aspenware
 
Fast multi touch enabled web sites
Fast multi touch enabled web sitesFast multi touch enabled web sites
Fast multi touch enabled web sites
Aspenware
 
Event handling
Event handlingEvent handling
Event handling
swapnac12
 
tL20 event handling
tL20 event handlingtL20 event handling
tL20 event handling
teach4uin
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
PERKYTORIALS
 
Advance java for bscit
Advance java for bscitAdvance java for bscit
Advance java for bscit
YogeshDhamke2
 
Developing Multi Touch Applications
Developing Multi Touch ApplicationsDeveloping Multi Touch Applications
Developing Multi Touch Applications
Brian Blanchard
 
Automate Mobile Gestures in Appium_ A Detailed Guide for Developers.pdf
Automate Mobile Gestures in Appium_ A Detailed Guide for Developers.pdfAutomate Mobile Gestures in Appium_ A Detailed Guide for Developers.pdf
Automate Mobile Gestures in Appium_ A Detailed Guide for Developers.pdf
kalichargn70th171
 
event-handling.pptx
event-handling.pptxevent-handling.pptx
event-handling.pptx
usvirat1805
 
Unreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User InterfaceUnreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User Interface
Nick Pruehs
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
Palakjaiswal43
 
Introduction to development
Introduction to developmentIntroduction to development
Introduction to development
Matteo Valoriani
 

More from Dr. Mazin Mohamed alkathiri (20)

Computer Introduction (Operating Systems)-Lecture06
Computer Introduction (Operating Systems)-Lecture06Computer Introduction (Operating Systems)-Lecture06
Computer Introduction (Operating Systems)-Lecture06
Dr. Mazin Mohamed alkathiri
 
Mobile Application Development (local database) class-07
Mobile Application Development (local database) class-07Mobile Application Development (local database) class-07
Mobile Application Development (local database) class-07
Dr. Mazin Mohamed alkathiri
 
Mobile Application Development (Shared Preferences) class-06
Mobile Application Development (Shared Preferences) class-06Mobile Application Development (Shared Preferences) class-06
Mobile Application Development (Shared Preferences) class-06
Dr. Mazin Mohamed alkathiri
 
Mobile Application Development((Handling User Input and Navigation) class-05
Mobile Application Development((Handling User Input and Navigation) class-05Mobile Application Development((Handling User Input and Navigation) class-05
Mobile Application Development((Handling User Input and Navigation) class-05
Dr. Mazin Mohamed alkathiri
 
Computer Introduction (Data Encryption)-Lecture05
Computer Introduction (Data Encryption)-Lecture05Computer Introduction (Data Encryption)-Lecture05
Computer Introduction (Data Encryption)-Lecture05
Dr. Mazin Mohamed alkathiri
 
Computer Introduction (Computer Viruses )-Lecture04
Computer Introduction (Computer Viruses  )-Lecture04Computer Introduction (Computer Viruses  )-Lecture04
Computer Introduction (Computer Viruses )-Lecture04
Dr. Mazin Mohamed alkathiri
 
Mobile Applications Development class 04-Layout-04
Mobile Applications Development class 04-Layout-04Mobile Applications Development class 04-Layout-04
Mobile Applications Development class 04-Layout-04
Dr. Mazin Mohamed alkathiri
 
Appendix to Lecture 3 Building a flutter app
Appendix to Lecture 3 Building a flutter appAppendix to Lecture 3 Building a flutter app
Appendix to Lecture 3 Building a flutter app
Dr. Mazin Mohamed alkathiri
 
Mobile Applications Development class 03-starting with flutter
Mobile Applications Development class 03-starting with flutterMobile Applications Development class 03-starting with flutter
Mobile Applications Development class 03-starting with flutter
Dr. Mazin Mohamed alkathiri
 
Mobile Applications Development class 02 ntroduction to Drat
Mobile Applications Development class 02 ntroduction to DratMobile Applications Development class 02 ntroduction to Drat
Mobile Applications Development class 02 ntroduction to Drat
Dr. Mazin Mohamed alkathiri
 
Computer Introduction (Software)-Lecture03
Computer Introduction (Software)-Lecture03Computer Introduction (Software)-Lecture03
Computer Introduction (Software)-Lecture03
Dr. Mazin Mohamed alkathiri
 
Computer Introduction (Hardware)-Lecture02
Computer Introduction (Hardware)-Lecture02Computer Introduction (Hardware)-Lecture02
Computer Introduction (Hardware)-Lecture02
Dr. Mazin Mohamed alkathiri
 
Computer Introduction (introduction)-Lecture01
Computer Introduction (introduction)-Lecture01Computer Introduction (introduction)-Lecture01
Computer Introduction (introduction)-Lecture01
Dr. Mazin Mohamed alkathiri
 
Introduction to Academic Writing class 0-1
Introduction to Academic Writing class 0-1Introduction to Academic Writing class 0-1
Introduction to Academic Writing class 0-1
Dr. Mazin Mohamed alkathiri
 
Mobile Applications Development class 01 - Introduction
Mobile Applications Development class 01 - IntroductionMobile Applications Development class 01 - Introduction
Mobile Applications Development class 01 - Introduction
Dr. Mazin Mohamed alkathiri
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
Dr. Mazin Mohamed alkathiri
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
Dr. Mazin Mohamed alkathiri
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
Dr. Mazin Mohamed alkathiri
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
Dr. Mazin Mohamed alkathiri
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
Dr. Mazin Mohamed alkathiri
 
Computer Introduction (Operating Systems)-Lecture06
Computer Introduction (Operating Systems)-Lecture06Computer Introduction (Operating Systems)-Lecture06
Computer Introduction (Operating Systems)-Lecture06
Dr. Mazin Mohamed alkathiri
 
Mobile Application Development (local database) class-07
Mobile Application Development (local database) class-07Mobile Application Development (local database) class-07
Mobile Application Development (local database) class-07
Dr. Mazin Mohamed alkathiri
 
Mobile Application Development (Shared Preferences) class-06
Mobile Application Development (Shared Preferences) class-06Mobile Application Development (Shared Preferences) class-06
Mobile Application Development (Shared Preferences) class-06
Dr. Mazin Mohamed alkathiri
 
Mobile Application Development((Handling User Input and Navigation) class-05
Mobile Application Development((Handling User Input and Navigation) class-05Mobile Application Development((Handling User Input and Navigation) class-05
Mobile Application Development((Handling User Input and Navigation) class-05
Dr. Mazin Mohamed alkathiri
 
Computer Introduction (Data Encryption)-Lecture05
Computer Introduction (Data Encryption)-Lecture05Computer Introduction (Data Encryption)-Lecture05
Computer Introduction (Data Encryption)-Lecture05
Dr. Mazin Mohamed alkathiri
 
Computer Introduction (Computer Viruses )-Lecture04
Computer Introduction (Computer Viruses  )-Lecture04Computer Introduction (Computer Viruses  )-Lecture04
Computer Introduction (Computer Viruses )-Lecture04
Dr. Mazin Mohamed alkathiri
 
Mobile Applications Development class 04-Layout-04
Mobile Applications Development class 04-Layout-04Mobile Applications Development class 04-Layout-04
Mobile Applications Development class 04-Layout-04
Dr. Mazin Mohamed alkathiri
 
Mobile Applications Development class 03-starting with flutter
Mobile Applications Development class 03-starting with flutterMobile Applications Development class 03-starting with flutter
Mobile Applications Development class 03-starting with flutter
Dr. Mazin Mohamed alkathiri
 
Mobile Applications Development class 02 ntroduction to Drat
Mobile Applications Development class 02 ntroduction to DratMobile Applications Development class 02 ntroduction to Drat
Mobile Applications Development class 02 ntroduction to Drat
Dr. Mazin Mohamed alkathiri
 
Mobile Applications Development class 01 - Introduction
Mobile Applications Development class 01 - IntroductionMobile Applications Development class 01 - Introduction
Mobile Applications Development class 01 - Introduction
Dr. Mazin Mohamed alkathiri
 
Ad

Recently uploaded (20)

U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
The History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptxThe History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
Ad

Mobile Application Development class 005

  • 1. Mobile Application Development class 05 Dr. Mazin Alkathiri IT Department Seiyun University 2023-2024
  • 2. Flutter - Introduction to Gestures • Gestures are an interesting feature in Flutter that allows us to interact with the mobile app (or any touch-based device). • Generally, gestures define any physical action or movement of a user in the intention of specific control of the mobile device. • Some of the 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. • Flutter divides the gesture system into two different layers, which are given below: – Pointers – Gestures
  • 3. Pointers • Pointers are the first layer that represents the raw data about user interaction. • It has events, which describe the location and movement of pointers such as touches, mice, and style across the screens. • Flutter does not provide any mechanism to cancel or stop the pointer-events from being dispatched further. • Flutter provides a Listener widget to listen to the pointer- events directly from the widgets layer. • The pointer-events are categories into mainly four types: – PointerDownEvents – PointerMoveEvents – PointerUpEvents – PointerCancelEvents
  • 4. • PointerDownEvents: It allows the pointer to contact the screen at a particular location. • PointerMoveEvents: It allows the pointer to move from one location to another location on the screen. • PointerUpEvents: It allows the pointer to stop contacting the screen. • PointerCancelEvents: This event is sent when the pointer interaction is canceled.
  • 5. Listener( onPointerDown: (event) { print('Pointer down'); }, onPointerUp: (event) { print('Pointer up'); }, onPointerMove: (event) { print('Pointer move'); }, child:Text( '$_counter', style: Theme.of(context).textTheme.headlineMedium, ), ),
  • 6. Gestures • It is the second layer that represents semantic actions such as tap, drag, and scale, which are recognized from multiple individual pointer events. • It is also able to dispatch multiple events corresponding to gesture lifecycle like drag start, drag update, and drag end. • Some of the popularly used gesture are listed below:
  • 7. Some of the widely used gestures are mentioned here − • Tap − Touching the surface of the device with fingertip for a short period and then releasing the fingertip. • Double Tap − Tapping twice in a short time. • Drag − Touching the surface of the device with fingertip and then moving the fingertip in a steady manner and then finally releasing the fingertip. • Flick − Similar to dragging, but doing it in a speeder way. • Pinch − Pinching the surface of the device using two fingers. • Spread/Zoom − Opposite of pinching. • Panning − Touching the surface of the device with fingertip and moving it in any direction without releasing the fingertip.
  • 8. Gesture Detector • Flutter provides an excellent support for all type of gestures through its exclusive widget, GestureDetector. • GestureDetector is a non-visual widget primarily used for detecting the user’s gesture. • To identify a gesture targeted on a widget, the widget can be placed inside GestureDetector widget. • GestureDetector will capture the gesture and dispatch multiple events based on the gesture.
  • 9. return new Scaffold( appBar: new AppBar( title: new Text('Gestures Example'), centerTitle: true, ), body: new Center(child: GestureDetector( onTap: () { print('Box Clicked'); }, child: Container( height: 60.0, width: 120.0, padding: EdgeInsets.all(10.0), decoration: BoxDecoration( color: Colors.blueGrey, borderRadius: BorderRadius.circular(15.0), ), child: Center(child: Text('Click Me')), ) )), );
  • 10. Some of the gestures and the corresponding events are given below • Tap – onTapDown – onTapUp – onTap – onTapCancel • Double tap – onDoubleTap • Long press – onLongPress • Vertical drag – onVerticalDragStart – onVerticalDragUpdate – onVerticalDragEnd • Horizontal drag – onHorizontalDragStart – onHorizontalDragUpdate – onHorizontalDragEnd • Pan – onPanStart – onPanUpdate – onPanEnd
  • 11. • let us modify the hello world application to include gesture detection feature and try to understand the concept. • Change the body content of the MyHomePage widget as shown below − body: Center( child: GestureDetector( onTap: () { _showDialog(context); }, child: Text( 'Hello World', ) ) ),
  • 12. • Observe that here we have placed the GestureDetector widget above the Text widget in the widget hierarchy, captured the onTap event and then finally shown a dialog window. • Implement the *_showDialog* function to present a dialog when user tabs the hello world message. It uses the generic showDialog and AlertDialog widget to create a new dialog widget. • The code is shown below –
  • 13. // user defined function void _showDialog(BuildContext context) { // flutter defined function showDialog( context: context, builder: (BuildContext context) { // return object of type Dialog return AlertDialog( title: new Text("Message"), content: new Text("Hello World"), actions: <Widget>[ new FlatButton( child: new Text("Close"), onPressed: () { Navigator.of(context).pop(); }, ), ], ); }, ); }
  • 14. Flutter also provides a set of widgets that can allow you to do a specific as well as advanced gestures. These widgets are given below: • Dismissible: It is a type of widget that supports the flick gesture to dismiss the widget. • Draggable: It is a type of widget that supports drag gestures to move the widget. • LongPressDraggable: It is a type of widget that supports drag gesture to move a widget along with its parent widget. • DragTarget: It is a type of widget that can accept any Draggable widget • IgnorePointer: It is a type of widget that hides the widget and its children from the gesture detection process. • AbsorbPointer: It is a type of widget that stops the gesture detection process itself. Due to this, any overlapping widget cannot able to participate in the gesture detection process, and thus, no event is raised. • Scrollable: It is a type of widget that supports scrolling of the content which is available inside the widget.
  翻译: