Types of Widgets
There are broadly two types of widgets in the flutter:
- Stateless Widget
- Stateful Widget
1. Stateless Widget
Stateless Widget is a type of widget which once built , then it’s properties and state can’t be changed. These widgets are immutable, once created can’t be modified.
Note: These are used for static content or UI content that don’t need a change after time.
Key Characterstics of Stateless Widgets are: Immutable , No State and Lightweight.
Examples: Display Text , Icons, Images, etc.
2. Stateful Widget
Stateful Widgets is a type of widget that can change state. It can maintain and update the appearance in the response to change in state.
Note: These are used for dynamic change in the properties and appearance over the time.
Key Characterstics of Stateful Widgets are: Mutable State , State Lifecycle and Dynamic Updates.
Examples: Buttons, Sliders, Text Fields, etc.
What is Widgets in Flutter?
Flutter is Google’s UI toolkit for crafting beautiful, natively compiled iOS and Android apps from a single code base. To build any application we start with widgets – The building block of Flutter applications. Widgets describe what their view should look like given their current configuration and state. It includes a text widget, row widget, column widget, container widget, and many more.