Hello, in this video, I am going to show you how to implement a Cupertino alert dialog. So an alert dialog, something that pops up takes the attention, the focus of everything else in the application is good to give the user some warning and error alert. Or if you really need to give them some information. And puberty, no one just wants to start in the iOS format. First of all, I'm going to create a trial. And this is going to be important that that will trigger the alert.
So you can trigger it however you want sample rate button. That's the alert button that I'm choosing to men. So raise but then I'm going to say child for the child text widget, it will say click me. And then I'm going to unpressed and here it could call a separate method. The code inside here is what is important to uniquely show dialog. for a second.
So in sha Allah, the semicolon at the end with the context is equal to the context it is just this right here. So this is anything we created. And then you need to do builder. And it's often called bracket build context. Recall this context. The arrow operator thing you say Cupertino, Cupertino dialogue, right that bracket in here.
We can set it up for a few basic properties. The one we want to do is title and the title text here, and I'm going to say and we're going to have content which will provide some more information. Say phones To talk to them again that morning once on my iPhone for the first time I saw it and it was on the eyes and some actions and these are buttons inside of the dialogue. You just do them Cupertino, dialogue, Cupertino dialogue action. And for this, there's a few different properties. The first one is default action so put to true so you know if basically you can trigger some sort of enter return command, that's what this will be and child text.
And obviously on press, we can have a specific can be text all I want you to experiment with the other properties. So this is kind of compressed and I'm going to say print saved up, will get this button that pops up here, click that we get an alert phone is too hot. And I thought click Buy and you were thinking nothing is happening. Why isn't it happening? And that is because we need to handle it in here. We do.
Navigator. Don't do the context. Don't talk. Now if we save it so if I click it, as you can see now, it disappears. So if you want it to disappear, you need to have this so this is closes like the current thing that the part of navigation tab currently has been, you know tied to the focus. So what I want you to do as an extra task is figure out or you know, click it to figure out how to add more button.
Basically you just duplicate the Cupertino dialogue action Aleksey, this is an array of widgets, duplicate this. And you can change the title. So we say something different on pressed functionality could be something different, but Popham that that's all there is to Cupertino alert dialog. If you have any question, feel free to drop me a message. And as usual, I look forward to seeing you in the next video.