Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In the last section, we were able to take our form state object called the save method on it.
When we did so Save Method found all of our nested text form fields and called the save the unsaved
function that was tied to each one.
So now that we have successfully implemented all this stuff and we are successfully printing out the
actual values associated with each field, we need to make sure that we get both these values into some
common location inside of this widget.
In other words, it's great that we have access to the value inside of unsaved.
But chances are that if we get to like right here, we want to take both.
Like both is the important part, their email and password and post them to some API or do something
like that.
So essentially, I want to get my email and password on, like this line of code right here.
So to do so, we're going to add some instance variables to our login screen widget, so appear at the
top underneath my former key, I'm going to add on a instanced variable of type string that will call
email.
And I'll default that to be an empty string and I'll do the same thing for another instance, variable
called password.
So now, any time that my unsaved method gets called on either field, I'm going to take the value that's
passed in here and I'm going to assign that value to the appropriate instance variable.
So for the email field.
I'm going to assign to the email instance variable, I just created that value, so value is the value
coming out of the text field itself.
I'm going to assign it to my instance variable of email and I'll do the same thing for my password field
as well.
So inside of save down here, I'll say password is value.
So now down inside of Smitt button.
Here's my unpressed callback, we do the validation we call save right here when we call this line of
code that goes up and executes those on saved callbacks and updates the value of our instance variables.
So now on the very next line of code right here, I can assume that the instance variables, email and
password have been updated successfully.
So right here I could print something like.
Time to post, I'll do some string interpolation here of email and password.
To my API.
Or essentially consume the email and password and weather, whatever fashion your application needs.
So last thing to test, I will refresh my simulator again.
Do in the restarts.
Come on.
There we go.
All right, so I'll enter in a valid email.
I'll enter in my password of at least four characters and click submit, and I see time to post that
email and that password to my API.
So that's pretty much it.
It's now right here, whatever you want to do with those four inputs you have, by this time right here,
you have successfully validated the form and said, yup, everything looks great, we're ready to go.
And so all you have to do from here on out after validating is called save to retrieve those values
and then consume the values as you wish.
So that's pretty much it.
That is our login screen using stateful.
Is now before we move on, a quick reminder, we're not quite done yet with all this Lagann stuff,
we still want to take care of learning how to do all this form stuff that we just went over by using
that block pattern as well.
But before we do that refactor, there's one other really, really quick item that I want to mention.
So let's take a brief pause right here.
We're going to come back to the next section and we're going to do one little refactor to our login
screen state method right here.
That's going to be a really, really useful refactor.
So quick break and 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.