All language subtitles for 012 Referencing Widgets with Global Keys_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,960 --> 00:00:05,130 In the last section, we started talking about how we're going to somehow get our forum to validate 2 00:00:05,130 --> 00:00:07,610 itself any time the user presses the submit button. 3 00:00:08,100 --> 00:00:13,050 So we're down here on step number three, where we need to first somehow get access to our form widget. 4 00:00:13,260 --> 00:00:17,760 And then after we get access to it, we need to tell it to validate all the text form fields that are 5 00:00:17,760 --> 00:00:18,800 associated with it. 6 00:00:19,530 --> 00:00:22,140 So we're going to first focus on part number one of this. 7 00:00:22,140 --> 00:00:25,020 We need to somehow access the form widget. 8 00:00:25,570 --> 00:00:29,970 This is something that we have not yet done in any of the flutter code that we've written so far. 9 00:00:30,850 --> 00:00:35,800 It's a quick reminder, every time that we've been looking at all these different pieces of documentation 10 00:00:35,800 --> 00:00:41,190 around all these different widgets, we've always been focused solely on the constructor methods. 11 00:00:41,620 --> 00:00:43,570 So we know how to create these widgets. 12 00:00:43,870 --> 00:00:50,500 But once they've been created, we don't actually know how to call any methods or call or reference 13 00:00:50,500 --> 00:00:52,710 any properties that are associated with them. 14 00:00:53,260 --> 00:00:56,220 In other words, we might be able to create a text form field. 15 00:00:56,770 --> 00:01:01,750 But if you then go down to the property section here or the method section, you'll see that there's 16 00:01:01,750 --> 00:01:07,840 a bunch of methods associated with these widgets and we have not yet seen how we can somehow reference 17 00:01:07,840 --> 00:01:11,700 a widget that we have created and then call a method that is associated with it. 18 00:01:12,250 --> 00:01:13,480 So that's what we need to do. 19 00:01:13,630 --> 00:01:21,310 We need to somehow get a reference or a handle to a widget that we create inside one of our build methods. 20 00:01:22,090 --> 00:01:24,520 Now, you might be thinking that this is something really easy. 21 00:01:24,880 --> 00:01:25,960 You might be thinking that. 22 00:01:26,140 --> 00:01:28,060 OK, Stephen, like, yeah, no big deal. 23 00:01:28,240 --> 00:01:30,010 Let's just go find our build method. 24 00:01:30,010 --> 00:01:32,690 And you might guess this is not correct. 25 00:01:32,710 --> 00:01:33,790 This is not how we're going to do it. 26 00:01:33,790 --> 00:01:38,740 But you might be thinking, yeah, we'll just like say, I don't know, make a new variable called form 27 00:01:38,740 --> 00:01:39,430 reference. 28 00:01:40,030 --> 00:01:41,110 We'll make a new form. 29 00:01:42,250 --> 00:01:48,580 Assign it to form reference and then we can just go ahead and like insert that somewhere into our widget 30 00:01:48,580 --> 00:01:52,480 structure here, like maybe right here I want to put my form reference like so. 31 00:01:52,780 --> 00:01:59,380 And then later on we can call form reference, dot, validate children or, you know, whatever method 32 00:01:59,380 --> 00:02:01,250 we want to call on the form itself. 33 00:02:01,810 --> 00:02:03,990 So unfortunately, this is not how we do it. 34 00:02:04,360 --> 00:02:08,400 We do not create a widget and then try to save a reference to it. 35 00:02:08,740 --> 00:02:12,640 The system for getting a reference to a widget is a little bit more complicated. 36 00:02:13,120 --> 00:02:13,420 All right. 37 00:02:13,420 --> 00:02:14,470 So I'm going to undo all that. 38 00:02:15,080 --> 00:02:18,370 We're going to take a look at a diagram that's going to give you a better idea of how we're going to 39 00:02:18,370 --> 00:02:24,190 get a reference to a widget and then call methods or reference properties associated associated with 40 00:02:24,190 --> 00:02:25,330 it later on. 41 00:02:26,460 --> 00:02:28,530 OK, so quick diagram. 42 00:02:30,200 --> 00:02:30,680 Here we go. 43 00:02:31,490 --> 00:02:33,440 All right, so this is our widget hierarchy. 44 00:02:33,800 --> 00:02:35,450 We've got our login screen right here. 45 00:02:36,140 --> 00:02:37,790 I'm going to zoom in on that section. 46 00:02:38,950 --> 00:02:46,420 OK, so on our login screen, we're going to add a new instance variable, that instance variable is 47 00:02:46,420 --> 00:02:49,810 going to be a type of global key. 48 00:02:50,590 --> 00:02:57,880 A global key variable or a variable with type global key gives us a reference to a unique element to 49 00:02:57,880 --> 00:03:01,140 our unique widget that has been created inside of our widget structure. 50 00:03:01,750 --> 00:03:03,810 So you and I are going to create this global key. 51 00:03:04,480 --> 00:03:12,100 Then when we create our form widget, we're going to pass that global key to the form that you and I 52 00:03:12,100 --> 00:03:12,640 create. 53 00:03:13,640 --> 00:03:19,760 Then at some point in the future, after our login screen has been rendered on the screen of our device, 54 00:03:20,150 --> 00:03:26,150 we can then get a reference to the form that was created by making use of this global key. 55 00:03:27,040 --> 00:03:32,530 So the global key variable is how we get a reference to a particular element that has been rendered 56 00:03:32,530 --> 00:03:33,730 to the screen of our device. 57 00:03:34,880 --> 00:03:38,180 Now, that's the that's the easy way of explaining this, OK? 58 00:03:38,780 --> 00:03:40,240 Basically, we want to use a global key. 59 00:03:40,250 --> 00:03:41,000 That's the takeaway. 60 00:03:41,510 --> 00:03:47,600 However, in this particular case, with us using a form widget right here, we were making a foreign 61 00:03:47,600 --> 00:03:50,690 widget and we want to reference that form and tell it to validate all the fields. 62 00:03:51,020 --> 00:03:57,850 Unfortunately, because we're using a form, our situation is going to be just a little bit more complicated. 63 00:03:58,520 --> 00:04:00,020 So let's take a quick pause right here. 64 00:04:00,080 --> 00:04:04,430 We're going to come back to the next section and we're going to expand on this idea of global key a 65 00:04:04,430 --> 00:04:04,880 little bit. 66 00:04:05,210 --> 00:04:12,410 And I'm going to tell you exactly why using a form here with a global key is just a tiny bit more complicated. 67 00:04:12,740 --> 00:04:16,910 But for right now, all you need to understand is that to reference a widget that has been rendered 68 00:04:16,910 --> 00:04:19,750 to the screen of the device we use, we create a kabuki. 69 00:04:19,760 --> 00:04:21,050 That's all I need to know for right now. 70 00:04:21,230 --> 00:04:23,630 It's a quick pause and we'll come back in the next section. 6832

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