
ASSIGNMENT 3
Deepmalika Das/T11/21
AIM:
To design and develop a Flutter-based Login UI that accepts a username and
password from the user and performs validation using regular expressions when
the Login button is clicked.
LO: LO2 mapped
THEORY:
A login interface is one of the most important components of any mobile application. It
allows users to securely access the system by entering their credentials such as
username and password. In this assignment, a login user interface is designed and
developed using Flutter, along with input validation implemented using regular
expressions.
Flutter is an open-source UI toolkit developed by Google that enables developers to
build cross-platform applications using a single codebase. It follows a widget-based
architecture, where the entire user interface is constructed using different types of
widgets such as TextField, TextFormField, Button, Column, Row, and Container.
In the designed login UI, the interface consists of two main input fields: username and
password, along with a login button. The username field accepts text input, while the
password field uses the
obscureText property to hide the entered characters,
ensuring user privacy and security. The layout is structured using widgets like Column,
Padding, and SizedBox to maintain proper alignment and spacing.
Validation plays a crucial role in ensuring that the user enters correct and meaningful
data. In this application, validation is performed when the user clicks the login button.
The input values are retrieved using TextEditingController, which allows access to the
data entered in the text fields.
Regular expressions (regex) are used to validate the format of the username. The
username is restricted to only letters (A–Z) and numbers (0–9), ensuring that no special
characters are allowed. If the entered username does not match the required pattern,
an error message is displayed. Similarly, the password field is validated to ensure that it
is not empty and meets the minimum length requirement.
When validation fails, appropriate error messages such as “Username and Password
cannot be empty” or “Invalid Username! Only letters and numbers allowed” are