All language subtitles for 015 Referencing FormState with Global Keys_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

In the last section, we created this form key instance variable, we assigned it an instance of a global

key that has kind of conformed to expect to reference a form state instance, and then we pass that

key off to our form that we created right here.

So now our form is going to reference the form state instance that is created when our login screen

state appears on the screen of our device.

So now that we have a direct reference to our form state instance, we can go and look up the documentation

for form states like the actual form state class and just see how we can actually interact with this

form state that has been created.

Let's take a look at the documentation.

I think you'll see what I'm getting at.

OK, so I'm going to go back over to my FLEDER documentation.

I'm going to do a search for form states, here's the form state class.

And now that we have a direct reference to the instance of form state that is created, when we make

our form, we can look at all the different properties that are associated with this thing in all the

different methods that are associated with it as well.

So whereas before you and I could really only get access to the different constructors that are associated

with all these different widgets, we now have the ability to reference all these properties and call

all these methods things to the.

Thanks to the global key that we set up right here, so again, the global key gives us the ability

to reference a very specific widget and reference properties and call methods that are associated with

that widget.

So in the case of our form state class, we can look at the different methods that are associated with

this thing.

You'll notice that one method is called reset.

And if we call reset, then it's going to attempt to reset every form field that is a descendant of

that form.

So if we call reset on our form state class, I think that it should probably reset these two inputs

right here.

I think that even though that's not what our submit button is supposed to do, that might be a good

test just to make sure that this stuff is working the way we expect.

So I'm going to go to my.

Callback on the Smith button.

So here's the submit button, here's where we create the raised button widget and here's the on pressed

callback.

So on this thing right here, whenever this thing gets pressed, I'm going to attempt to reference the

form St. Instance and call the reset method on it.

So to do so, I'm going to reference first the form key, which is going to give us a reference to the

form state instance that is created to kind of back up or represent our form on the screen.

So we have we just reference to the key by by writing out form key and then to actually get a handle

on the form state instance right here we write out DOT current state.

So if you now hover over current state, you'll see that it returns to us the form state instance or

something of type form state, so form keeg, current state, this thing right here is our form state

instant's so on this I can call reset and now any time user press this button, it should attempt to

reset every field within our form.

So to test this out, I will do a full refresh with a shifter.

I will wait for the reload.

OK, I'll enter in some random email, some random password, and then when I click on the submit button,

I see that both my inputs got completely zeroed out or essentially reset back to their default initial

state where they have no value associated with them whatsoever.

All right.

So that's pretty much it.

That's how we get a handle on some particular widget that has been created inside of our application

and call a method associated with it or reference a property.

We use this global key thing right here.

We save the key and then we pass that key off to whatever element or whatever widget we want to get

our reference to.

So now that we have the ability to get a reference to our form state, we can now.

Go back to this diagram, so we now have access to our foreign states now, we can use that reference

to tell it to validate all the text form fields that are rendered inside the form.

So let's take a quick break and we'll tackle that in the next section.

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