Check Mobile App
Read now
Start a Project

How to create a List in Flutter

Save

In the last blog, we have learned how to create a widget and I think you guys must have understood it pretty well. In case you have missed the previous blog, then I suggest you read that first and then continue with this blog. The link to the Widget blog is here.

What are Widgets in Flutter?

Let’s get started with the List in Flutter

Just as we use Recyclerview in Native Android to display the lists, In the flutter as we know everything is Widget. We can use the ListView widget to display the lists. It is a scrolling widget which displays its children one after another.

There are four options to create a ListView

  1. List<Widget>
  2. ListView.builder
  3. ListView.separated
  4. ListView.custom

Let us discuss the ListView.separated type to create a list view.

As we can see in the above code segment. We have created ListView.separated widget and also assigned a few of its attributes.

separatorBuilder creates a divider line between each item of the list.

scrollDirection will decide the direction of the list.

shrinkWrap will make the ListView only occupies the space it needs.

itemCount gives the count of the item.

itemBuilder draws each item in the list and takes item layout input which is _listLayout in this example.

Let us see whats inside the _listLayout widget

this is just a widget which uses a few other widgets to create a layout which is used as the item layout.

That’s all for this blog. Thank you very much. This is Vedesh Kumar signing off.

. . .

Leave a Comment

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


Be the first to comment.

css.php

When I think in getting solutions for my Ecommerce Platform, I think of Webkul. They have been such a blessing in our business. We have spent thousands of dollars in support and modules from them. We love their support team. They work very closely with us, and they always go the extra mile when we need help.

Michael Urresta

Michael Urresta

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home