Flutter tutorials for beginners: ListView, ListView.builder() and GridView | Better4Code

 

Flutter tutorials about Lists in Flutter

In Web or Mobile Application development, Lists are the most usable feature, or we can say the most usable widget. Lists are created using rows of items, which may include buttons, text, icons, toggles, dropdowns, and many more.

In this blog, we will learn the use of Lists in Flutter.

ListView in Flutter

Flutter already presents a ListView widget for working with Lists, which is the core concept of arranging data or any information in the mobile apps in an organized manner. If we want to display limited Items in the list, then ListView is a perfect choice then other. ListView also contains the ListTile widget, which gives extra properties for the visual structure to a list of data.

 

The example displays a list in ListView in the Flutter application:

ListView.builder() in Flutter

According to the requirement of the application, Sometimes we need to display a long list on a single screen of the application, then, in that case, displaying all of those long items in the lists is not a perfect way. ListView.builder() constructor is used to create a list, which contains a huge number of items. The major difference between ListView and ListView.builder is that ListView builds all items at once and we have to create items manually, whereas the ListView.builder() constructor creates items when they are scrolled onto the screen.

GridView in Flutter

sometimes we need to arrange a list’s items in GridView. So, Flutter provides a GridView widget, that allows creating flutter lists in grid form. Create grid using the GridView.count().

GridView.count() specifies the numbers of columns and rows of the grid.

Also, we can create horizontal lists by using horizontal scrollDirection that means we can scroll lists horizontally rather than vertically.

Leave a Comment

Your email address will not be published. Required fields are marked *