Table of contents
In this phase of my #100DaysOfFlutter Challenge, I am working on a notes app to understand how Flutter works. For Day 13, I worked on a user registration screen that enables a user to register an account using an email and password by utilising firebase authentication. Here is some of what I learnt in the process;
Scaffold
A scaffold is a pre-built widget that provides a basic structure and layout that contains some UI parts of a screen. A scaffold usually has an app bar, a body for the main content of the screen, a bottom navigation bar, or a floating action button.
Stateless And Stateful Widgets
Widgets
are the building blocks of the user interface of an application. Almost every UI building block in Flutter is a widget. Some examples of a widget are the buttons, text fields, the app bar etc.
A state
refers to mutable data that determines the appearance and behaviour of a widget. The state of a widget can change depending on data changes or user interaction.
A Stateless widget
doesn’t have a mutable state and holds the initial appearance and data assigned to it upon creation. A stateless widget is used to build simple static UI elements that do not need to respond to user interactions or data changes.
A Stateful widget
has a mutable state and can change its appearance over time, depending on user interaction or data changes. Stateful widgets are utilised in building UI elements that require interactivity or dynamic behaviour. A stateful widget is initialised using the init()
method upon creation and is destroyed using dispose()
after use.
TextEditingController
The TextEditingController
is an intermediary between the registration text fields and the button. It passes the data received from the text field to the button when the user taps the button.