Is it just me, but who else thinks that Flutters columns and rows are the wrong way around?
Surely rows should run from top to bottom and columns across.
Am I missing something?
The terminology of the word row is horizontal. A column is always vertical. See https://en.m.wikipedia.org/wiki/Row_(database)
Row class:
A widget that displays its children in a horizontal array.
Column class:
A widget that displays its children in a vertical array.
Every direct widget under a row is horizontal while when you put it in a container or another widget every widget under that tree is getting the alignment from the next one above.
If you have ever used SQL, and have looked at its tables,(Or any other table) you can clearly observe that all the columns are arranged vertically while all the rows are arranged horizontally.
The same principle is followed in flutter.
Related
look at the pic
I don't want elements to change their positions especially in horizontal axis when their strings changed
I mean it should be like a table with fixed columns.
can I do this just with row?
It's probably because you set a defined width for spacing.
You could use a combination of Flexible & Expanded widgets to wrap all the children in your Row.
That should align them correctly.
You can find the corresponding code here
I need a grid that contains children of fixed sizes.
GridView expands its children, which is not what I need. The grid should simply size itself according to it's children by setting the crossAxisCount.
My current solution is to use simple columns and rows, but that's so much boilerplate code for just a common widget.
You will have to do it dynamically, and supply the value of the crossAxisCount dynamically
I am trying to put a dot between the labels, but only only between each item in each "row". There will be 8 dots total. each line shouldn't start or end with a dot. Any thoughts on how to do this?
Edit:
I want to give a list of widgets as a parameter. I do not know the height or width of the widgets that will be passed in. Creating this with a row is tricky, because I have to have some kind of logic that determines if there will be enough space for the widget before going to the next row.
I have a ListView with a Column, and inside that Column 2 buttons.
The ListView is stretched to the entire page (it contains more elements)
I want all the buttons inside the Column to stretch to the button with the largest width.
I found a solution on usnig InstrictWidth, but when used inside a Listview I'm getting the error
LayoutBuilder does not support returning intrinsic dimensions.
How can I still achieve what I'm looking for?
Wrap each button with an Expanded widget and then wrap each one of these Expanded widgets with a Row widget
So, I passed the padding of the StaggeredGridView element manually, checking the index in the itemBuilder method, but there is a wrong index order. Starting from the 3rd index, the order is different, and after some scrolling there will be indices with other order.
Indexes:
After some scroll:
I can't use padding and axis spaces of staggered grid view for avoid leading and trailing white spaces of top horizontal categories list view.
How to solve that a problem?
Thanks in advance!
Assuming you are using the flutter_staggered_grid_view package. Staggered grid view doesn't order items from left to right and then vertically. Within a "row" of items, the one further up than the other will be first in order of indexes.
Check out the package documentation. There's a pretty self explanatory image there.