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
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
At the end of the last section, we added in this floating action, but button which it right here,
what if we hover over it?
You'll see that there's a little bit of a warning that says the parameter on press is required.
Let's take a look at the documentation around floating action button and see if we can't get a better
idea of what's going on.
So I'm going to go back over to my letter documentation, and again, on the top right hand side, I'll
look up floating action button.
And then once I pull up the documentation for that class, I'll scroll down to the constructor.
OK, so here's the floating action button constructor inside the list of all these named parameters.
You'll notice that there's one called on press right here and that's exactly what that warning message
was complaining about.
Now, right in front of Unpressed, you'll notice that there's this thing called at required.
At required.
Right here, as you might guess, means that we are required to pass in some value for this unpressed
property.
So if we create a action floating action button, we have to pass in a value for unpressed.
So let's first just add in that name property and then we'll figure out what value we're going to pass
into it.
Back inside my code editor, I'm going to expand the floating action button, I'll add in unpressed.
And then we'll just leave it right there.
We're going to go back over to the documentation very quickly and figure out what we need to assign
to this.
OK, so back over here, that type of unpressed says that it is supposed to be a void callback or I
don't know about you, but that sounds kind of scary.
Let me give it to you in very simple English.
Essentially, we have to pass in a function to this unpressed property.
Any time the user presses on the button, the function that we pass in will be invoked.
So all we have to do over here for unpressed is assign a function or create a function.
So to create a function right here, I'll put my set of parentheses and then my curly braces like so.
So any time a user presses this button, this function right here is going to be executed to test out
that behavior, let's add in a print statement inside of it.
So let's say print high there like so.
And then don't forget, we need to add a comma at the end of the function, otherwise the entire functionally
collapsed automatically.
It's going to put a comma right there.
So let's now save this, we'll try refreshing our emulator again and seeing if we can't get this print
message to display if we tap on that button.
So I'll pull up in my terminal, I'll hit Shift Oregon to reload our application.
Now I see a button on the bottom right hand side, it looks like the button is just a very plain blue
button and it's not currently showing that kind of plus inside of it that we had wanted.
So we're going to do a little bit of work on that front.
But let's see if we can press it and see that print statement appear.
So if I click on the button, sure enough, we see how they're inside of our terminal.
OK, well, that definitely works out.
So let's take a quick pause right here.
We'll come back the next section and we're going to figure out how we can get that little plus icon
to display inside the button as well.
It's a quick break and we'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.