Skip to main content

Posts

Showing posts from July, 2021

What is Controller in Flutter

What is Controller As per the name controller so our basic idea is something is controlled by this property but what? So, the answer is If you have an editable text widget then you need to store the value of that text somewhere. The simplest way is by setting a TextEditingController as the controller of a TextField. The value of the textField is updated with the use of this controller.  How to use the controller with the example:- We are taking an example to Retrieve the value of a text field that is entered by the user and that value is shown us in the snackbar Let's start with the following steps: 1. Create a TextEditingController To retrieve the text from the text field entered by the user, we create a TextEditingController and set it to a TextField or TextFormField. TextFormField is also working as TextField which we are discussing more in further blog with detail. Note: you need to call dispose of the method of the TextEditingController when you have finished using it and...

Flutter TextField with Examples

Introduction to TextField TextField in Flutter is the most commonly used text input widget that allows users to collect inputs from the keyboard into an app. We can use the TextField widget in building forms, sending messages, creating search experiences, and many more. By default, Flutter decorated the TextField with an underline. We can also add several attributes with TextField, such as label, icon, inline hint text, and error text using an InputDecoration as the decoration. If we want to remove the decoration properties entirely, it is required to set the decoration to null. 1. decoration It is used to show the decoration around TextField.The most common attributes in decoration are as follows: border : It is used to create a default rounded rectangle border around TextField. labelText : It shows the label text on the selection of TextField. hintText : It shows the hint text inside TextField when there is no text entered.   TextField(             ...

Flutter Row and Column with Examples

What are Row and Column In Flutter, Row and column are the two essential widgets in Flutter that allows developers to align children horizontally and vertically according to our requirements. These widgets are very necessary when we design the application user interface in Flutter. So Let's discuss in details all the properties and how it works with the examples. Row A Row is a widget used to display child widgets horizontally. The Row widget does not scroll. If you have a line of widgets and want them to be able to scroll  then you can use ListView Widget which we will discuss in coming blogs. If we wished to display three text widgets within a row we can create a Row widget like below:  body: Row(         children: [           Text(             "Flutter Demo Row",             style: TextStyle(                 backgroundColor: Colors...