From the course: Flutter Essential Training: Build for Multiple Platforms
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Building dynamic lists - Flutter Tutorial
From the course: Flutter Essential Training: Build for Multiple Platforms
Building dynamic lists
- [Instructor] Having a list of chat bubbles declared in this manner is also not very scalable. In reality, you do not know the number of chat messages for a particular user. So it could be five, 10, or 50. This is also duplicated code and hard to maintain, right? So we want a list view that can populate this widget X number of times. And for that we have something called ListView.builder. Let's comment this code out and create the ListView here. So the child will now take a ListView.builder and the property that is required is itemBuilder. So here it takes a call back which takes parameters context and index. And now you can return any widget that you like. So I will return the chat bubble itself. So let's un-comment this out and now this ListView.builder is going to return a chat bubble. Let's add a semicolon here. I have forgotten the return here. So let me add that as well. But this itemBuilder also needs a size,…
Contents
-
-
-
-
-
Flutter building blocks to know about11m 7s
-
(Locked)
Building basic widgets for the login screen23m 38s
-
(Locked)
Building basic widgets for the chat screen17m 26s
-
(Locked)
Placements and alignments12m 36s
-
(Locked)
Structure: Flexible and expanded6m 17s
-
(Locked)
Creating your own custom widget6m 13s
-
(Locked)
Building dynamic lists3m 34s
-
(Locked)
How to breakdown designs into code?3m 11s
-
(Locked)
Breaking down designs: More examples3m 14s
-
-
-
-
-
-