All language subtitles for 015 Building Lists with ListView_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian Download
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,870 --> 00:00:06,780 In the last section, we marked our images instance variable on the image list widget as final, which 2 00:00:06,780 --> 00:00:10,420 indicates that you and I do not plan to change that thing at any point in time. 3 00:00:11,160 --> 00:00:16,290 So now that we've got the image list in a somewhat good state right here, it's time to actually add 4 00:00:16,290 --> 00:00:21,780 a build method to this thing that's going to look at our list of images right here and show one widget 5 00:00:21,780 --> 00:00:24,080 on the screen for each individual image. 6 00:00:24,750 --> 00:00:29,510 Let's first very quickly look at some documentation for a widget that we're going to use to render out 7 00:00:29,520 --> 00:00:30,480 that list of images. 8 00:00:31,500 --> 00:00:37,170 So back inside my browser, I'm back at Dock Street, Flutter EOH, and on the top right hand side, 9 00:00:37,170 --> 00:00:41,880 I'm going to search for List View and I'm looking for the list view class. 10 00:00:44,120 --> 00:00:50,210 Eliscu class is very heavily used inside a flutter, so any time you're going to make a list of elements, 11 00:00:50,360 --> 00:00:53,420 chances are you're going to end up using the list view class. 12 00:00:54,140 --> 00:00:57,820 As such, the list of you class has a lot of very strong documentation in it. 13 00:00:58,010 --> 00:01:02,060 So if you want to, you could certainly take a glance at all the documentation in here. 14 00:01:02,480 --> 00:01:06,980 But for you and me, we're going to find that constructor section as we usually do. 15 00:01:08,670 --> 00:01:14,010 OK, so here's constructor's, you'll notice that there is a default constructor right here of List 16 00:01:14,010 --> 00:01:18,190 View and there's also a named constructor of Dot Builder. 17 00:01:18,780 --> 00:01:20,940 There's a quick text description on both these. 18 00:01:21,480 --> 00:01:27,300 If we use the list view constructor directly, then we are going to take a list of records and try to 19 00:01:27,300 --> 00:01:29,370 build a single widget out of each one. 20 00:01:29,640 --> 00:01:33,570 And we're going to create that entire array of widgets instantly. 21 00:01:33,970 --> 00:01:39,270 So the instant our entire application renders to the screen of our device, we're going to build out 22 00:01:39,270 --> 00:01:43,080 the whole list of every single element inside of our list view. 23 00:01:44,680 --> 00:01:48,560 So this is sometimes not the best approach from a performance perspective. 24 00:01:48,850 --> 00:01:49,450 Think about it. 25 00:01:49,660 --> 00:01:55,990 If we have a list of like 5000 images, we don't want to build out five thousand widgets the instant 26 00:01:55,990 --> 00:01:57,100 our application loads up. 27 00:01:57,970 --> 00:02:02,140 So very frequently, we instead use this builder named Constructor. 28 00:02:02,890 --> 00:02:08,590 The list viewport builder constructor creates alerts me if works just a little bit differently and that 29 00:02:08,590 --> 00:02:12,460 it creates a list of widgets that are created on demand. 30 00:02:13,120 --> 00:02:19,300 The term OnDemand here means to say that as a user is scrolling around this list of records on their 31 00:02:19,300 --> 00:02:20,020 mobile device. 32 00:02:20,440 --> 00:02:26,590 Only when the user starts to reach the end of that list will this list of builder start to kick in and 33 00:02:26,590 --> 00:02:28,510 render more widgets to go on the screen. 34 00:02:29,110 --> 00:02:35,020 So we can think of List View Builder as being a little bit more lazy in nature, whereas the list view 35 00:02:35,020 --> 00:02:39,580 constructor is much more eager in nature and tries to build a list as soon as possible. 36 00:02:41,330 --> 00:02:45,740 Of the time, we're going to want to use this builder constructor because it's much stronger from a 37 00:02:45,740 --> 00:02:46,930 performance perspective. 38 00:02:48,340 --> 00:02:51,610 So all that leaves is, hey, how do we actually use this thing? 39 00:02:51,940 --> 00:02:58,720 Well, let's flip back over to our image list widget and we'll define our build method in here and get 40 00:02:58,720 --> 00:03:00,430 a better idea of how to use that builder. 41 00:03:01,090 --> 00:03:03,330 So I'm going to define my build method. 42 00:03:03,970 --> 00:03:09,040 It's going to return something of type widget and it's going to be called with that context argument 43 00:03:09,040 --> 00:03:11,890 that we've not yet discussed quite so much. 44 00:03:11,890 --> 00:03:14,080 And we're going to get around to that at some point in time. 45 00:03:15,210 --> 00:03:20,850 Then inside of here, we're going to return list view dot builder. 46 00:03:22,680 --> 00:03:25,390 We're going to provide two separate arguments to this thing. 47 00:03:25,740 --> 00:03:30,450 The first argument is going to be a named property of item count. 48 00:03:31,140 --> 00:03:37,050 So item count is going to tell the list for you how many different widgets we're going to want to render 49 00:03:37,050 --> 00:03:37,710 on the screen. 50 00:03:38,310 --> 00:03:44,130 In our case, we probably want to render a number of widgets equal to the number of records that we 51 00:03:44,130 --> 00:03:45,840 have inside of our images list. 52 00:03:46,410 --> 00:03:53,130 So to tell the list, view how many records we have, I'm going to say images at length like so this 53 00:03:53,130 --> 00:03:55,920 is how many widgets are going to want our list for you to create. 54 00:03:57,710 --> 00:04:04,100 Then as a second argument or the second name property, I should say, we're going to ride a Eitam builder, 55 00:04:04,790 --> 00:04:07,130 the item builder is a function. 56 00:04:08,120 --> 00:04:11,810 This function right here is going to be called with a context. 57 00:04:12,080 --> 00:04:12,530 Oops. 58 00:04:14,590 --> 00:04:22,180 Context and a second argument, that is an integer called index, so let me tell you about how this 59 00:04:22,180 --> 00:04:27,070 item builder function works as a user starts to scroll around on the device. 60 00:04:27,640 --> 00:04:33,610 The item builder function right here is going to be called the list for you expects that you and I are 61 00:04:33,610 --> 00:04:37,870 going to put some logic inside this function to construct a new widget. 62 00:04:38,930 --> 00:04:44,840 That is going to represent every item inside of our list of images or whatever we're trying to represent 63 00:04:44,840 --> 00:04:45,500 on the screen. 64 00:04:46,420 --> 00:04:52,050 The first argument to the function is context is the same type of context that it's given to our build 65 00:04:52,060 --> 00:04:55,300 function right now, again, not relevant for what we're doing right now. 66 00:04:55,300 --> 00:04:56,770 It will be relevant later on. 67 00:04:57,730 --> 00:05:00,770 The second argument right here is much more important. 68 00:05:01,150 --> 00:05:06,010 This is the index of the element that the list is trying to render on the screen. 69 00:05:06,610 --> 00:05:12,850 So for you and me, when our item builder first gets called to show our list of widgets on the screen, 70 00:05:13,210 --> 00:05:19,600 we're going to get an index of zero, which indicates to us that the list builder is trying to render 71 00:05:19,630 --> 00:05:23,400 the first element on the screen, like Index zero first element. 72 00:05:24,100 --> 00:05:26,880 So we're going to look into our images list right here. 73 00:05:27,190 --> 00:05:34,720 We're going to pull out the very first image, first image model instance or whatever, instead is inside 74 00:05:34,720 --> 00:05:36,190 of their index of zero. 75 00:05:36,550 --> 00:05:42,850 And then we're going to build and return a widget inside of here that represents that first image inside 76 00:05:42,850 --> 00:05:43,780 of our images list. 77 00:05:44,500 --> 00:05:47,550 Now, that's all a kind of complicated verbal description. 78 00:05:47,830 --> 00:05:49,450 So let's take a quick pause right here. 79 00:05:49,450 --> 00:05:53,760 We'll come back to the next section and start adding some code to our item builder function. 80 00:05:54,010 --> 00:05:55,260 So I'll see you in just a minute. 8321

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.