SlideShare a Scribd company logo
1 of 16
Mobile Application Development
class 04
Dr. Mazin Alkathiri
IT Department
Seiyun University
2023-2024
Introduction to Layouts
• Since the core concept of flutter is Everything is
widget, Flutter incorporates a user interface layout
functionality into the widgets itself.
• Flutter provides quite a lot of specially designed widgets
like Container, Center, Align, etc., only for the purpose of
laying out the user interface.
• Widgets build by composing other widgets normally use
layout widgets.
• Layout widgets can be grouped into two distinct category
based on its child −
– Widget supporting a single child
– Widget supporting multiple child
Single Child Widgets
• In this category, widgets will have only one widget as its child
and every widget will have a special layout functionality.
• For example, Center widget just centers it child widget with
respect to its parent widget and Container widget provides
complete flexibility to place it child at any given place inside it
using different option like padding, decoration, etc.,
• Single child widgets are great options to create high quality
widget having single functionality such as button, label, etc.,
some of the most important single child layout widgets
provided by Flutter are:
– Padding − Used to arrange its child widget by the given padding. Here,
padding can be provided by EdgeInsets class.
– Align − Align its child widget within itself using the value of alignment
property.
• The value for alignment property can be provided by FractionalOffset class.
The FractionalOffset class specifies the offsets in terms of a distance from the top left.
– FittedBox − It scales the child widget and then positions it according to the
specified fit.
– AspectRatio − It attempts to size the child widget to the specified aspect ratio
– Container − Generic, single child, box based container widget with alignment,
padding, border and margin along with rich styling features.
– Center − Simple, Single child container widget, which centers its child widget.
Multiple Child Widgets
• In this category, a given widget will have more
than one child widgets and the layout of each
widget is unique.
• For example, Row widget allows the laying out of
its children in horizontal direction, whereas
Column widget allows laying out of its children in
vertical direction. By composing Row and
Column, widget with any level of complexity can
be built.
Let us learn some of the frequently
used widgets in this section.
• Row − Allows to arrange its children in a horizontal
manner.
• Column − Allows to arrange its children in a vertical
manner.
• ListView − Allows to arrange its children as list.
• GridView − Allows to arrange its children as gallery.
• Expanded − Used to make the children of Row and
Column widget to occupy the maximum possible area.
• Table − Table based widget.
• Flow − Flow based widget.
• Stack − Stack based widget.
Aligning widgets
Advanced Layout Application
• In this section, let us learn how to create a
complex user interface of product listing with
custom design using both single and multiple
child layout widgets.
• For this purpose, follow the sequence given
below −
– Create a new Flutter application in Android
studio, product_layout_app.
– Replace the main.dart code with folowing code.
• Here, We have created MyHomePage widget by
extending StatelessWidget instead of default
StatefulWidget and then removed the relevant code.
• Now, create a new widget, ProductBox according to
the specified design as shown below
Please observe the following in the code −
• ProductBox has used four arguments as specified below −
– name - Product name
– description - Product description
– price - Price of the product
– image - Image of the product
• ProductBox uses seven build-in
widgets as specified below −
– Container
– Expanded
– Row
– Column
– Card
– Text
– Image
• ProductBox is designed using the above mentioned widget. The
arrangement or hierarchy of the widget is specified in the
diagram shown below −
• Now, place some dummy image (see below) for product
information in the assets folder of the application and
configure the assets folder in the pubspec.yaml file as
shown below −
assets:
- assets/appimages/floppy.png
- assets/appimages/iphone.png
- assets/appimages/laptop.png
- assets/appimages/pendrive.png
- assets/appimages/pixel.png
- assets/appimages/tablet.png
Finally, Use the ProductBox widget in the MyHomePage widget as
specified below −
Mobile Application Development class 004
Mobile Application Development class 004

More Related Content

Similar to Mobile Application Development class 004

Integrate widgets into content pages (DX) - Developers Meetup - October 2016
Integrate widgets into content pages (DX) - Developers Meetup - October 2016Integrate widgets into content pages (DX) - Developers Meetup - October 2016
Integrate widgets into content pages (DX) - Developers Meetup - October 2016Jahia Solutions Group
 
Android Screen Containers & Layouts
Android Screen Containers & LayoutsAndroid Screen Containers & Layouts
Android Screen Containers & LayoutsVijay Rastogi
 
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBoxKobkrit Viriyayudhakorn
 
Android layouts course-in-mumbai
Android layouts course-in-mumbaiAndroid layouts course-in-mumbai
Android layouts course-in-mumbaivibrantuser
 
Harnessing the power of blue foot for developers
Harnessing the power of blue foot for developersHarnessing the power of blue foot for developers
Harnessing the power of blue foot for developersJohn Hughes
 
Android layouts course-in-mumbai
Android layouts course-in-mumbaiAndroid layouts course-in-mumbai
Android layouts course-in-mumbaivibrantuser
 
Basics of expression blend4
Basics of expression blend4Basics of expression blend4
Basics of expression blend4Samson Tennela
 
Html5 Bootstrap Furniture Ecommerce Odoo Theme: User Manual
Html5 Bootstrap Furniture Ecommerce Odoo Theme: User ManualHtml5 Bootstrap Furniture Ecommerce Odoo Theme: User Manual
Html5 Bootstrap Furniture Ecommerce Odoo Theme: User ManualAppJetty
 
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...DicodingEvent
 
Responsive Mobile Odoo Theme: Mobicraft User Manual
Responsive Mobile Odoo Theme: Mobicraft User ManualResponsive Mobile Odoo Theme: Mobicraft User Manual
Responsive Mobile Odoo Theme: Mobicraft User ManualAppJetty
 
Goodbye Nightmare : Tops and Tricks for creating Layouts
Goodbye Nightmare : Tops and Tricks for creating LayoutsGoodbye Nightmare : Tops and Tricks for creating Layouts
Goodbye Nightmare : Tops and Tricks for creating LayoutsLuc Bors
 
Bootstrap - Basics
Bootstrap - BasicsBootstrap - Basics
Bootstrap - BasicsFirosK2
 
DecoratedBoxTransition Widget – Definition, Properties & How to Use It.pptx
DecoratedBoxTransition Widget – Definition, Properties & How to Use It.pptxDecoratedBoxTransition Widget – Definition, Properties & How to Use It.pptx
DecoratedBoxTransition Widget – Definition, Properties & How to Use It.pptxFlutter Agency
 
HTML5- Create divisions in a web page
HTML5- Create divisions in a web pageHTML5- Create divisions in a web page
HTML5- Create divisions in a web pageGrayzon Gonzales, LPT
 
3_4_widgets_wordpress_for_beginners.pdf
3_4_widgets_wordpress_for_beginners.pdf3_4_widgets_wordpress_for_beginners.pdf
3_4_widgets_wordpress_for_beginners.pdfNganPham667083
 
User experience and interactions design
User experience and interactions design User experience and interactions design
User experience and interactions design Rakesh Jha
 

Similar to Mobile Application Development class 004 (20)

Integrate widgets into content pages (DX) - Developers Meetup - October 2016
Integrate widgets into content pages (DX) - Developers Meetup - October 2016Integrate widgets into content pages (DX) - Developers Meetup - October 2016
Integrate widgets into content pages (DX) - Developers Meetup - October 2016
 
Mobile Application Development class 006
Mobile Application Development class 006Mobile Application Development class 006
Mobile Application Development class 006
 
Android Screen Containers & Layouts
Android Screen Containers & LayoutsAndroid Screen Containers & Layouts
Android Screen Containers & Layouts
 
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
 
Android layouts course-in-mumbai
Android layouts course-in-mumbaiAndroid layouts course-in-mumbai
Android layouts course-in-mumbai
 
Harnessing the power of blue foot for developers
Harnessing the power of blue foot for developersHarnessing the power of blue foot for developers
Harnessing the power of blue foot for developers
 
Android layouts course-in-mumbai
Android layouts course-in-mumbaiAndroid layouts course-in-mumbai
Android layouts course-in-mumbai
 
Neat Tricks with Content Types
Neat Tricks with Content TypesNeat Tricks with Content Types
Neat Tricks with Content Types
 
Basics of expression blend4
Basics of expression blend4Basics of expression blend4
Basics of expression blend4
 
Html5 Bootstrap Furniture Ecommerce Odoo Theme: User Manual
Html5 Bootstrap Furniture Ecommerce Odoo Theme: User ManualHtml5 Bootstrap Furniture Ecommerce Odoo Theme: User Manual
Html5 Bootstrap Furniture Ecommerce Odoo Theme: User Manual
 
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
Dicoding Developer Coaching #21: Android | Cara Membuat Widget di Aplikasi An...
 
Responsive Mobile Odoo Theme: Mobicraft User Manual
Responsive Mobile Odoo Theme: Mobicraft User ManualResponsive Mobile Odoo Theme: Mobicraft User Manual
Responsive Mobile Odoo Theme: Mobicraft User Manual
 
Goodbye Nightmare : Tops and Tricks for creating Layouts
Goodbye Nightmare : Tops and Tricks for creating LayoutsGoodbye Nightmare : Tops and Tricks for creating Layouts
Goodbye Nightmare : Tops and Tricks for creating Layouts
 
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
 
Bootstrap - Basics
Bootstrap - BasicsBootstrap - Basics
Bootstrap - Basics
 
DecoratedBoxTransition Widget – Definition, Properties & How to Use It.pptx
DecoratedBoxTransition Widget – Definition, Properties & How to Use It.pptxDecoratedBoxTransition Widget – Definition, Properties & How to Use It.pptx
DecoratedBoxTransition Widget – Definition, Properties & How to Use It.pptx
 
HTML5- Create divisions in a web page
HTML5- Create divisions in a web pageHTML5- Create divisions in a web page
HTML5- Create divisions in a web page
 
3_4_widgets_wordpress_for_beginners.pdf
3_4_widgets_wordpress_for_beginners.pdf3_4_widgets_wordpress_for_beginners.pdf
3_4_widgets_wordpress_for_beginners.pdf
 
Fewd week7 slides
Fewd week7 slidesFewd week7 slides
Fewd week7 slides
 
User experience and interactions design
User experience and interactions design User experience and interactions design
User experience and interactions design
 

More from Dr. Mazin Mohamed alkathiri

ESSENTIAL of (CS/IT/IS) class 05 (Software concepts)
ESSENTIAL of (CS/IT/IS) class 05 (Software concepts)ESSENTIAL of (CS/IT/IS) class 05 (Software concepts)
ESSENTIAL of (CS/IT/IS) class 05 (Software concepts)Dr. Mazin Mohamed alkathiri
 
Advance Mobile Application Development class 02-B
Advance Mobile Application Development class 02-BAdvance Mobile Application Development class 02-B
Advance Mobile Application Development class 02-BDr. Mazin Mohamed alkathiri
 
ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)
ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)
ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)Dr. Mazin Mohamed alkathiri
 

More from Dr. Mazin Mohamed alkathiri (20)

Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
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)
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Advance Mobile Application Development class 05
Advance Mobile Application Development class 05Advance Mobile Application Development class 05
Advance Mobile Application Development class 05
 
ESSENTIAL of (CS/IT/IS) class 05 (Software concepts)
ESSENTIAL of (CS/IT/IS) class 05 (Software concepts)ESSENTIAL of (CS/IT/IS) class 05 (Software concepts)
ESSENTIAL of (CS/IT/IS) class 05 (Software concepts)
 
OS-operating systems- ch03
OS-operating systems- ch03OS-operating systems- ch03
OS-operating systems- ch03
 
OS-operating systems - ch02 - part-2-2024
OS-operating systems - ch02 - part-2-2024OS-operating systems - ch02 - part-2-2024
OS-operating systems - ch02 - part-2-2024
 
Advance Mobile Application Development class 04
Advance Mobile Application Development class 04Advance Mobile Application Development class 04
Advance Mobile Application Development class 04
 
Advance Mobile Application Development class 03
Advance Mobile Application Development class 03Advance Mobile Application Development class 03
Advance Mobile Application Development class 03
 
Advance Mobile Application Development class 02-B
Advance Mobile Application Development class 02-BAdvance Mobile Application Development class 02-B
Advance Mobile Application Development class 02-B
 
OS-ch02-part-1-2024.ppt
OS-ch02-part-1-2024.pptOS-ch02-part-1-2024.ppt
OS-ch02-part-1-2024.ppt
 
Advance Mobile Application Development class 02
Advance Mobile Application Development class 02Advance Mobile Application Development class 02
Advance Mobile Application Development class 02
 
ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)
ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)
ESSENTIAL of (CS/IT/IS) class 03-04 (NUMERIC SYSTEMS)
 
Advance Mobile Application Development class 01
Advance Mobile Application Development class 01Advance Mobile Application Development class 01
Advance Mobile Application Development class 01
 
ESSENTIAL of (CS/IT/IS) class 02 (HCI)
ESSENTIAL of (CS/IT/IS) class 02 (HCI)ESSENTIAL of (CS/IT/IS) class 02 (HCI)
ESSENTIAL of (CS/IT/IS) class 02 (HCI)
 
Seminar
SeminarSeminar
Seminar
 
ESSENTIAL of (CS/IT/IS)
ESSENTIAL of (CS/IT/IS)ESSENTIAL of (CS/IT/IS)
ESSENTIAL of (CS/IT/IS)
 
OS-ch01-2024.ppt
OS-ch01-2024.pptOS-ch01-2024.ppt
OS-ch01-2024.ppt
 
Mobile Application Development class 008
Mobile Application Development class 008Mobile Application Development class 008
Mobile Application Development class 008
 
Academic Writing (Punctuation ) class 06
Academic Writing (Punctuation ) class 06Academic Writing (Punctuation ) class 06
Academic Writing (Punctuation ) class 06
 

Recently uploaded

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 

Recently uploaded (20)

Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 

Mobile Application Development class 004

  • 1. Mobile Application Development class 04 Dr. Mazin Alkathiri IT Department Seiyun University 2023-2024
  • 2. Introduction to Layouts • Since the core concept of flutter is Everything is widget, Flutter incorporates a user interface layout functionality into the widgets itself. • Flutter provides quite a lot of specially designed widgets like Container, Center, Align, etc., only for the purpose of laying out the user interface. • Widgets build by composing other widgets normally use layout widgets. • Layout widgets can be grouped into two distinct category based on its child − – Widget supporting a single child – Widget supporting multiple child
  • 3. Single Child Widgets • In this category, widgets will have only one widget as its child and every widget will have a special layout functionality. • For example, Center widget just centers it child widget with respect to its parent widget and Container widget provides complete flexibility to place it child at any given place inside it using different option like padding, decoration, etc., • Single child widgets are great options to create high quality widget having single functionality such as button, label, etc.,
  • 4. some of the most important single child layout widgets provided by Flutter are: – Padding − Used to arrange its child widget by the given padding. Here, padding can be provided by EdgeInsets class. – Align − Align its child widget within itself using the value of alignment property. • The value for alignment property can be provided by FractionalOffset class. The FractionalOffset class specifies the offsets in terms of a distance from the top left. – FittedBox − It scales the child widget and then positions it according to the specified fit. – AspectRatio − It attempts to size the child widget to the specified aspect ratio – Container − Generic, single child, box based container widget with alignment, padding, border and margin along with rich styling features. – Center − Simple, Single child container widget, which centers its child widget.
  • 5. Multiple Child Widgets • In this category, a given widget will have more than one child widgets and the layout of each widget is unique. • For example, Row widget allows the laying out of its children in horizontal direction, whereas Column widget allows laying out of its children in vertical direction. By composing Row and Column, widget with any level of complexity can be built.
  • 6. Let us learn some of the frequently used widgets in this section. • Row − Allows to arrange its children in a horizontal manner. • Column − Allows to arrange its children in a vertical manner. • ListView − Allows to arrange its children as list. • GridView − Allows to arrange its children as gallery. • Expanded − Used to make the children of Row and Column widget to occupy the maximum possible area. • Table − Table based widget. • Flow − Flow based widget. • Stack − Stack based widget.
  • 8. Advanced Layout Application • In this section, let us learn how to create a complex user interface of product listing with custom design using both single and multiple child layout widgets. • For this purpose, follow the sequence given below − – Create a new Flutter application in Android studio, product_layout_app. – Replace the main.dart code with folowing code.
  • 9.
  • 10. • Here, We have created MyHomePage widget by extending StatelessWidget instead of default StatefulWidget and then removed the relevant code. • Now, create a new widget, ProductBox according to the specified design as shown below
  • 11.
  • 12. Please observe the following in the code − • ProductBox has used four arguments as specified below − – name - Product name – description - Product description – price - Price of the product – image - Image of the product • ProductBox uses seven build-in widgets as specified below − – Container – Expanded – Row – Column – Card – Text – Image • ProductBox is designed using the above mentioned widget. The arrangement or hierarchy of the widget is specified in the diagram shown below −
  • 13. • Now, place some dummy image (see below) for product information in the assets folder of the application and configure the assets folder in the pubspec.yaml file as shown below − assets: - assets/appimages/floppy.png - assets/appimages/iphone.png - assets/appimages/laptop.png - assets/appimages/pendrive.png - assets/appimages/pixel.png - assets/appimages/tablet.png
  • 14. Finally, Use the ProductBox widget in the MyHomePage widget as specified below −