3 minutes
Share the link to this page
An icon button is a picture printed on a Material widget that reacts to touches by filling with color (ink).


Hello in this video we are going to look at the icon button class simply put allows you to create a button that's in the form of an icon three more to it than that we add a child obviously you could add a child directly like this, this wouldn't do it you could be adding the child in an array of tools read in a row or column for example, the principle is exactly the same but if you have questions you know as usual, just pop me a message and see this icon button. Okay. So And here, we are going to specify the actual icon itself. So this is going to be icon. And then here is do icon, dot then the icon we want to show LSA fi so do boo boo boo shirt That's fine. And now we're going to say two tips.

So we can specify to tip you can say open the mouth, or the contact or the contact and now we can add a on pressed on pressed. So they These are only other properties expressed for like the highlight color, the color, disable color, all that stuff and I want to experiment with these bonds gonna show you know the key ones. In here, we can do set state, and we are here with a print. You could print the falsify that and let's see what we on application. So ignore that. Ignore that though from before so you get this map button.

So we can click it and we get opened them up. And that's it. That's really all there is to it. Obviously, if I change this from That to maybe add is now an Add button was still icon, I click it still saying open the map because that's what this functionality is doing. If for example, you had maybe no volume down for example, here you could do some volume functionality. So let's say if we add a variable int underscore while you equal one here so by default set the maximum of 100.

Here, we could do something like so this is safe to say volume. Because on the school while you say minus equal, you know it takes you down a notch. So we can print out on the school What if I said that, see what we get. So we get 98 evocati, a bunch of times when 28 Aleksey, we had a mistake now, because we're going down to minus German speaking volume, you wouldn't allow that. So what I want you to do as an extra task is correct. If I'm inside of here that prevents it from going below zero.

Also add a number icon button. Does that involve you up and instead of adding in takeaway 10, you add 10. And again, you will have a similar experiment which prevents you from going above the maximum which most likely is going to be 100. But that is it for you know, icon button. Pretty simple. If you have any questions, feel free to drop me a message.

And as usual, I look forward to seeing you in the next video.

Sign Up


Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.