Hello, in this video, I am going to show you how to add a Cupertino action sheet. So this is basically a little pop up or no menu come from the bottom give me a few options. Usually I will have a Cancel button, and it's in the iOS style to do it, it's really simple. Make sure you follow the setup video. And first of all, we are going to add a chart. I'm going to be a rebel and add a raised button.
But I'm going to be triggering an iOS style widget. So it doesn't have to be triggered by an iOS style widget. You can mix and match. It's totally up to you. So the child text and then I'm going to say on press is going to be a method here. Yeah, I wanted to say final att for just short for action sheet and I'm going to do close to 13 no action sheet.
So long their title. And I'll say, this is what? Okay, and then we can have a method, the method is to simply expand on the title provide a bit more information of what the pop up is, therefore, but it's optional to have it in our text. And I'm going to say, do what should I say I'll say what? And now we can actually customize it with the buttons. The new action is just an array of widgets, and in this empty, no Cupertino action sheet action and it This test, obviously, mmm, you know experiment is and I recommend that you do.
We're interested in child and on prep because it's a regular widget you could add a container you could add you know images you could add tactic that what you want to keep it simple as a child in there, I mean a text child and if you're gonna say no say compressed and when it says press print, semi colon to add another button, basically the same as the and you can add as many as you want. I'm just gonna add two for this one instead of pizza. Let's cook it. So the savory and sweet you have selected cookie dough if we know to add a Cancel button after the square brackets after the action Cancel button. And this is also a Cupertino action sheet. And in here we need a child.
Again you could have any sort of widget you want to the tech console keep it simple and say on pressed when it's on pressed we need to hide it and to hide it's actually really simple to do. All we have to do in navigator dot pop context so basically just closing Watson upon the openness getting it just pops it and because this will be the current thing that is open, and therefore save it, let's see what we get. So we got this button, we click it, nothing happened because we created it, but we haven't actually triggered it for after the Cupertino action sheet. Before we close, the curly brace refers to yet, but before we actually add to the unpressed action, we need to trigger it to do it. We call this show Cupertino modal pop up. And what we want to do here is for the context we need to provide context with this idea.
There's nothing that we've created necessarily am for the builder. This is where we actually do it. For the builder build context on to use the arrow operator or AC T or wherever you name the 16 your attention to the semicolon was missing. Save that, go back, click it. I didn't see this pops up now. For I click pizza.
So you have selected Pizza Pizza, pizza pizza. And it was a cookie dough cookie, the cookie dough, but press cancel it cancelled it doesn't pay anything yet, because in here, we didn't print anything yet. If you wanted to, you could add more functionality upon cancel, maybe say something. But you can also click off and hide you like that. But it's also usually commonplace to let's say, select one of these of these items wherever they may be. And then close this and then perform the action.
So to close it again, you just use this piece of code. So I'm just going to add it to the pizza as an extra really simple test you can do for the cookie dough. So if I save that, and I go to click me, click OK. Now, as you can see, that's not closing, click pizza, your printed your selected pizza and then close it using the navigator dot pop code. So that is it for the Cupertino action sheet and I will also showed me the Cupertino action sheet actions. If you have any questions, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.