All language subtitles for 012 Building Lists of Widgets_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Our app states, which it is now storing every single image inside this images list right here, so

we're now going to figure out how we can build a list of widgets out of all the records that we're storing

into our images list.

Again, this is going to be an exercise in basic list building.

And this is something that we're going to have to do in every application out there that builds a list

at some point in time.

And it turns out that's probably the vast majority of apps.

So we're going to be building lists several times throughout this course.

And right now will be the first taste that we'll get of it.

Now, our app state, which it right now has a pretty good amount of code inside of it, and we're getting

up to 40 lines, I personally like to keep these widgets as small and compact as possible.

So although we could definitely add all this logic to create a list inside of our app state class right

here, I think it might make a little bit more sense to create a new separate widget class that's going

to take our list of images and render them out as a list on the screen.

So to how is this new class that we're going to put together?

I'm going to make another new directory inside of my SIRC folder inside of Sarsae.

I'll make a new folder called Widgets.

So the widgets directory right here over time might house all the different reusable widgets that I

will create inside of my application, inside of the widgets directory.

I'm going to make a new file and I'll call it.

How about image underscore list dot dart.

I think that's a reasonable name.

Then inside this file, we're going to first start off with that import statement that I'm going to

expect to see in just about every widget file I ever create.

It's all, say, import packets, flutter material darts.

Then right underneath that, we're almost definitely going to need to know some information about the

image model that we've created inside of our application, the image list, which it is supposed to

iterate over the list of all those images.

So this file is definitely going to need to know about exactly what a image model type is.

So we're going to import that file inside of here as well.

So let's say import and then this time to import that file, we're going have to write out a little

bit more complicated import statement.

So I need to go up one directory into the Sarsae folder, then into models and then get the image model

dot dart file to do so.

I'm going to write out dot, dot, slash.

So that goes up one directory into SIRC.

Then I'm going to go into the models folder and then get the image model darte file Lexar.

Ko.

OK, so now we'll create the actual image list, which it is also a class image list extends and then,

oh, a little bit of hesitation there.

I want to think for a second, are we making a stateless widget or a state full widget?

Well, let's go back and look at our diagram one more time to remind ourselves if I can find it.

Here we go.

So my question to you is whether or not you think this new widget that we're going to create is going

to have any instance variables that are going to change.

Is it going to have any instance variables that are going to be changed by the widget itself?

That's definitely a very tricky question.

The image list that we are creating is going to be given a list of image model instances and we're going

to have to definitely somehow like save that list of images inside this widget so that we can refer

back to that list later on when our build method gets called or whatever else we're trying to do.

So I think that we are going to have to know about that list of images inside this widget.

And I think that without a doubt, that list of images will change over time because we're going to

be adding on no new images every time the user presses that button.

However, this is the key part.

However, it is the parent widget of the app state that is changing that data.

So our image lists right here.

It is going to have an instance variable.

I kind of will expect that to change over time.

But it's not the image list job to change it.

So because the image list right here is not changing that variable, because it is not in charge of

maintaining that list of images, we're going to make this a stateless widget.

The image list is never going to try to change that list of images and it's never going to try to render

itself.

And so it's a prime candidate to be a stateless widget.

OK, so then inside of here, we're going to eventually build out our list.

First, let's take a quick break and we'll come back to the next section and take a look at some documentation

on how we can build a list.

So I'll see you in just a minute.

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