Hello, in this video, I am going to show you how to implement a grid view. It's pretty simple. And it is basically what you think it is it is a grid that you can supposedly can put images in a text in there. I'm going to keep it simple number text. And now the next task, I'm going to experiment, put images in there, any widget you want. That's the beauty of it, you can mix and match and styling however you want to.
So we need to replace this. So the body is on grid view dot 10. And then in here to really mean things that we want. There are a lot of properties and as an extra task, as an extra tax, I recommend that you experiment with it my scroll direction. Now the reverse all of that stuff and I'll provide a link to the official documentation. So you can see you know, see more information but the two that we have, when we cross axis can should basically have the columns There are so couple two for now, but we'll change it so it can demonstrate and then we put children and neither Just a list of widgets.
So if I put text and I'm just gonna say, Hello. So I'm gonna duplicate this a bunch of buttons. That should be enough. Obviously, you probably have different pieces of why'd you know data, you could have a list of a and put the list here instead of doing it like this, but that's totally up to you. And now we have our grid, my thinking doesn't look very good. We have one reason it's all anchored to the top left, that's fine.
Instead of having text, if we could send two widgets widget and inside there, we put a child and we put text now. So I'm going to put Hello still and we are going to basically duplicate that should be enough. If we go across as you can see, just that a little change makes it look a lot better. Obviously you can change you can you know put any of the tunes that you want for center, there isn't much but inside of here, you can put a container in, which could change the background color of it the text color, that is totally up to you, the cross axis can lock that is the number of columns, Nether for free, it is free columns. If I were to put four, we got four columns, etc, etc. to be experimentation with how you want to, you know how you want it to look.
And really, that's all there is to it. What you could also do is generate like a random list of you know, children using the list generate method as another extra task. That's where only you'd have to go. So we just randomize basically what's in here, but you will probably have no a list outside of here lock and list variable here perhaps that gets data when the application knows from a database or some sort of JSON request to a you know, simple HTTP JSON request. Come put that there, but this is the core fundamentals of an GridView. If you have any questions, though, feel free to drop me a message and as usual, I look forward to seeing you in the next video.