Week7-1
Week7-1
Widget
What is Widget?
Widget Tree
Types of Widgets
Widgets State
Widgets Lifecycle
What is Widget?
• Widget is the basic building block of Flutter apps.
• User Interface in flutter is nothing more than the
arrangement of widgets.
• Using widgets is like combining Legos. Like Legos, you
can mix and match widgets to create something
amazing.
What is Widget?
• Each element on a screen of the Flutter app is a widget, therefore
whenever you are going to code for building anything in Flutter, it will
be inside a widget.
• To build an app Widgets are nested with each other.
• Flutter has a rich set of in-built widgets like text, buttons, sliders,
lists, layouts, gesture detectors, animations, etc.
Widget Tree
• To develop an interface in a flutter, widgets are arranged into a tree of
parent and child widgets.
• Widgets are nested inside of each other to form your app.
• The Entire widget tree forms a layout that you see on the screen.
Types of Widgets
We can split the Flutter widget into two categories:
• Visible (Output and Input): These widgets are related to the user
input and output data. Some of the important are
Text, Button, Image, Icon, etc.
• Invisible (Layout and Control): The invisible widgets are related to the
layout and control of widgets. It provides controlling how the widgets
behave and how they will look on the screen. Some of the important
are
Column, Row, Center, Padding, Scaffold, Stack
Widget State Management
The state is information that
1. Can be read synchronously when the widget is built
2. And might change during the lifetime of the widget.
In other words, a state is data that a widget can hold, which is available
after the widget is rendered/rebuilt.