More detail about the row and column are in this tutorial.
Before Start
As usual, I will tell you about our code page. I will put all code in the one page. So first we will create a page that contains the whole code as below.
This will show you as follows, It has nothing but the title.
Simple Use
As you can see above, we have a Column inside the widget. So we can just put two children Text in it. Also, we will put our other tutorials here.
Column( mainAxisAlignment:MainAxisAlignment.start, children:<Widget>[//our code here.Text("Welcome to Flutter Open.", style:TextStyle(fontSize:TEXT_LARGE, color:GREEN), ),Text("The developer is NieBin who is from China.", style:TextStyle(fontSize:TEXT_NORMAL, color:BLUE_DEEP), ) ], ),
It means that the column or row can show multiple widgets in one direction, the Row show in the horizontal direction and the Column show in the vertical direction. So their use is similar but different with its direction. So if we understand the one, The another will be easy to know.
Their parameters are the same. So if you can know the one, you know the another as well. So I plan to talk more detail about the Row, but give a simple example with the Column.
mainAxisAlignment
The mainAxisAlignment controls the children to show in the horizontal direction of theRow, But controls the vertical direction of the Column. Let's look at the picture with its types.
In the picture, we can see, when we change the parameter of the mainAxisAlignment, the location of the children widgets will change in the horizontal direction. We can easily know the start,center,end,but others may be a bit difficult, I will explain to you. When set to the spaceBetween, the space between the children widgets will equal, in the picture, them equal to a, and the first one is at the start, the last one will be at the end. The spaceEvenly will make the space of the children widgets equal. In the picture, they equal to b.The spaceAround will make the space around the children widgets equal, in the picture they equal to c, so the space between them will be c+c=2c. Let's see the code, I put four widgets Text with name open in the Row and the mainAxisAlignment as the parameter of the _rowMainAlign(mainAxisAlignment).
This parameter controls the space of the Row/Column, MainAxisSize.min set the space to min, MainAxisSize.max set the space to max. I define a function to use it.
This parameter is just use in the vertical, it will control the direction of children widgets, so the column will be an example. I write a function to show this parameter.
This parameter is similar with verticalDirection, but it is a bit different between them. The textDirection is used in the horizontal direction, but verticalDirection is used in the vertical direction.They both control the start direction of children widgets' drawing. So let's look at the code.
Then, our tutorial about the Row/Column is done, we look at above, we will know that the main parameter is the mainAxisAlignment, crossAxisAlignment, if you understand them, the other will be easy to use. Hope you have some gain from this article.