All language subtitles for 015 Referencing FormState 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,950 --> 00:00:06,860 In the last section, we created this form key instance variable, we assigned it an instance of a global 2 00:00:06,860 --> 00:00:13,040 key that has kind of conformed to expect to reference a form state instance, and then we pass that 3 00:00:13,040 --> 00:00:15,440 key off to our form that we created right here. 4 00:00:16,160 --> 00:00:22,670 So now our form is going to reference the form state instance that is created when our login screen 5 00:00:22,670 --> 00:00:24,680 state appears on the screen of our device. 6 00:00:25,490 --> 00:00:31,640 So now that we have a direct reference to our form state instance, we can go and look up the documentation 7 00:00:31,970 --> 00:00:37,640 for form states like the actual form state class and just see how we can actually interact with this 8 00:00:37,640 --> 00:00:38,960 form state that has been created. 9 00:00:39,560 --> 00:00:40,940 Let's take a look at the documentation. 10 00:00:40,940 --> 00:00:42,350 I think you'll see what I'm getting at. 11 00:00:43,300 --> 00:00:45,760 OK, so I'm going to go back over to my FLEDER documentation. 12 00:00:47,450 --> 00:00:51,770 I'm going to do a search for form states, here's the form state class. 13 00:00:53,200 --> 00:00:57,910 And now that we have a direct reference to the instance of form state that is created, when we make 14 00:00:57,910 --> 00:01:02,620 our form, we can look at all the different properties that are associated with this thing in all the 15 00:01:02,620 --> 00:01:04,930 different methods that are associated with it as well. 16 00:01:05,500 --> 00:01:10,990 So whereas before you and I could really only get access to the different constructors that are associated 17 00:01:10,990 --> 00:01:16,420 with all these different widgets, we now have the ability to reference all these properties and call 18 00:01:16,420 --> 00:01:18,520 all these methods things to the. 19 00:01:19,620 --> 00:01:24,900 Thanks to the global key that we set up right here, so again, the global key gives us the ability 20 00:01:24,900 --> 00:01:30,930 to reference a very specific widget and reference properties and call methods that are associated with 21 00:01:30,930 --> 00:01:31,530 that widget. 22 00:01:32,630 --> 00:01:36,770 So in the case of our form state class, we can look at the different methods that are associated with 23 00:01:36,770 --> 00:01:37,190 this thing. 24 00:01:37,760 --> 00:01:40,730 You'll notice that one method is called reset. 25 00:01:40,970 --> 00:01:47,150 And if we call reset, then it's going to attempt to reset every form field that is a descendant of 26 00:01:47,150 --> 00:01:47,810 that form. 27 00:01:48,600 --> 00:01:55,460 So if we call reset on our form state class, I think that it should probably reset these two inputs 28 00:01:55,460 --> 00:01:56,030 right here. 29 00:01:56,450 --> 00:02:00,410 I think that even though that's not what our submit button is supposed to do, that might be a good 30 00:02:00,410 --> 00:02:03,590 test just to make sure that this stuff is working the way we expect. 31 00:02:05,320 --> 00:02:07,510 So I'm going to go to my. 32 00:02:09,160 --> 00:02:11,380 Callback on the Smith button. 33 00:02:12,310 --> 00:02:17,470 So here's the submit button, here's where we create the raised button widget and here's the on pressed 34 00:02:17,470 --> 00:02:18,040 callback. 35 00:02:19,000 --> 00:02:23,770 So on this thing right here, whenever this thing gets pressed, I'm going to attempt to reference the 36 00:02:23,770 --> 00:02:27,400 form St. Instance and call the reset method on it. 37 00:02:27,850 --> 00:02:34,180 So to do so, I'm going to reference first the form key, which is going to give us a reference to the 38 00:02:34,180 --> 00:02:41,710 form state instance that is created to kind of back up or represent our form on the screen. 39 00:02:42,430 --> 00:02:47,830 So we have we just reference to the key by by writing out form key and then to actually get a handle 40 00:02:47,830 --> 00:02:53,110 on the form state instance right here we write out DOT current state. 41 00:02:54,570 --> 00:03:01,530 So if you now hover over current state, you'll see that it returns to us the form state instance or 42 00:03:01,530 --> 00:03:08,250 something of type form state, so form keeg, current state, this thing right here is our form state 43 00:03:08,250 --> 00:03:15,090 instant's so on this I can call reset and now any time user press this button, it should attempt to 44 00:03:15,180 --> 00:03:17,490 reset every field within our form. 45 00:03:18,510 --> 00:03:23,130 So to test this out, I will do a full refresh with a shifter. 46 00:03:25,990 --> 00:03:27,400 I will wait for the reload. 47 00:03:31,500 --> 00:03:36,870 OK, I'll enter in some random email, some random password, and then when I click on the submit button, 48 00:03:37,680 --> 00:03:44,040 I see that both my inputs got completely zeroed out or essentially reset back to their default initial 49 00:03:44,040 --> 00:03:47,260 state where they have no value associated with them whatsoever. 50 00:03:48,090 --> 00:03:48,560 All right. 51 00:03:48,570 --> 00:03:49,500 So that's pretty much it. 52 00:03:49,780 --> 00:03:54,930 That's how we get a handle on some particular widget that has been created inside of our application 53 00:03:55,350 --> 00:03:58,550 and call a method associated with it or reference a property. 54 00:03:58,950 --> 00:04:01,200 We use this global key thing right here. 55 00:04:01,530 --> 00:04:06,750 We save the key and then we pass that key off to whatever element or whatever widget we want to get 56 00:04:06,750 --> 00:04:07,500 our reference to. 57 00:04:08,450 --> 00:04:14,060 So now that we have the ability to get a reference to our form state, we can now. 58 00:04:15,140 --> 00:04:22,010 Go back to this diagram, so we now have access to our foreign states now, we can use that reference 59 00:04:22,430 --> 00:04:27,020 to tell it to validate all the text form fields that are rendered inside the form. 60 00:04:27,590 --> 00:04:30,170 So let's take a quick break and we'll tackle that in the next section. 6215

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