All language subtitles for 002 The Build Method_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,920 --> 00:00:04,800 In the last section, we accomplished step number two of creating our own custom widget. 2 00:00:05,270 --> 00:00:09,980 We're now going to move on to step number three, which says that we have to define a build method inside 3 00:00:09,980 --> 00:00:13,040 of our class and that build method has to return. 4 00:00:13,040 --> 00:00:17,210 The widgets that are custom widget is going to show on the screen. 5 00:00:17,900 --> 00:00:23,750 I'm going to first get started by moving this comment into the class body itself, because the comment 6 00:00:23,750 --> 00:00:27,410 itself is saying we have to add a method to the class which has created. 7 00:00:28,510 --> 00:00:33,310 So then inside the class, I'm going to add a method called build like so. 8 00:00:34,530 --> 00:00:41,070 The build function right here is always going to return something called a widget type, so I'm going 9 00:00:41,070 --> 00:00:44,280 to annotate the return type as being widget like so. 10 00:00:45,780 --> 00:00:51,450 You'll notice we have a red squiggly right here, if you read the text, it says invalid override and 11 00:00:51,450 --> 00:00:56,430 then it gives you a little bit of information now that what this area is complaining about right now 12 00:00:56,460 --> 00:01:04,200 is that we have to find a build method on our widget that currently takes no arguments and returns a 13 00:01:04,200 --> 00:01:04,650 widget. 14 00:01:05,519 --> 00:01:12,720 But if we are going to extend the stateless widget right here, then you and I are required to define 15 00:01:12,720 --> 00:01:13,740 a build method. 16 00:01:14,670 --> 00:01:21,360 That returns a widget, but also accepts a value type of build context. 17 00:01:22,020 --> 00:01:26,430 So in other words, that error message is saying, OK, you know what, you defined a build method. 18 00:01:26,430 --> 00:01:27,000 That's great. 19 00:01:27,000 --> 00:01:27,930 I'm happy you did that. 20 00:01:28,350 --> 00:01:29,970 You're trying to return a widget. 21 00:01:30,150 --> 00:01:30,690 That's good. 22 00:01:30,690 --> 00:01:31,500 I'm happy with that. 23 00:01:31,980 --> 00:01:32,670 But you know what? 24 00:01:32,670 --> 00:01:39,840 Your build method, it has to return or accept an argument of something called a build context. 25 00:01:40,350 --> 00:01:43,470 So it wants us to receive that argument like so. 26 00:01:44,980 --> 00:01:51,070 So we refer to this single argument to this bill function as context, we're not going to use context 27 00:01:51,070 --> 00:01:52,180 just yet. 28 00:01:52,570 --> 00:01:56,160 OK, so we're going to hold off on a definition of what this context thing is. 29 00:01:56,470 --> 00:02:01,090 So for just right now, all we need to understand is that if we're going to define this failed method, 30 00:02:01,570 --> 00:02:04,030 we have to accept an argument called context. 31 00:02:04,270 --> 00:02:07,920 And we'll come back to this later on and talk about why we are receiving this thing. 32 00:02:08,410 --> 00:02:13,600 It's going to end up being very important and very relevant to some of the later applications we work 33 00:02:13,600 --> 00:02:13,840 on. 34 00:02:13,960 --> 00:02:16,180 But right now, we don't need to worry about context. 35 00:02:17,250 --> 00:02:23,460 It's now inside this build method, we're going to return all the widgets that are custom widget is 36 00:02:23,460 --> 00:02:25,440 going to show when it appears on the screen. 37 00:02:26,130 --> 00:02:29,080 And so for this step, we get to do something really easy. 38 00:02:29,730 --> 00:02:32,630 We're going to go back over to our main function right here. 39 00:02:33,540 --> 00:02:37,440 We're going to select all of these different widgets that we had put together. 40 00:02:38,160 --> 00:02:41,220 So everything from material up down here to the bottom. 41 00:02:42,340 --> 00:02:43,900 I'm going to cut all that out. 42 00:02:45,520 --> 00:02:50,950 I'm going to go back over to my bill function right here, and I'm going to return. 43 00:02:51,850 --> 00:02:54,160 And then paste all the stuff that we just copied. 44 00:02:55,350 --> 00:02:59,190 I'll then save the file and all the formatting kicks in automatically. 45 00:03:00,950 --> 00:03:07,610 OK, so now we just defined our build method, now, any time we try to show our custom app widget on 46 00:03:07,610 --> 00:03:12,820 the screen, Flutter is going to automatically call this build method right here. 47 00:03:13,460 --> 00:03:18,800 It's going to take all the different widgets that we return and it's going to try to show all those 48 00:03:18,800 --> 00:03:20,840 widgets directly on the screen for us. 49 00:03:22,220 --> 00:03:25,340 All right, and that's pretty much it, that's our three step process. 50 00:03:25,520 --> 00:03:32,180 So at the top, we did our import, we created our class that extended a base class of stateless widget 51 00:03:32,690 --> 00:03:39,500 that inside of our class app, we defined our build method that returned all the widgets that our app 52 00:03:39,500 --> 00:03:41,300 widget is going to show on the screen. 53 00:03:42,240 --> 00:03:46,640 So let's pause right here when we come back to the next section, we're going to fix up our main dirt 54 00:03:46,710 --> 00:03:53,160 file and make sure that we import in that new app widget we just created and make sure that we try to 55 00:03:53,160 --> 00:03:56,970 show an instance of that app widget with our run app function. 56 00:03:57,420 --> 00:03:59,730 So a quick break and we'll take care of that in the next section. 5647

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