Mark02/12/2023, 3:57 AM
on all rows except the last one? Ideally there would be an extra optional arg:
lastRowHorizontalArrangement: Arrangement.Horizontal = horizontalArrangement,
orangy02/12/2023, 7:02 AM
Mark02/12/2023, 8:25 AM
looks pretty terrible when the last row only has a couple of a items and the
is rather wide. It should be possible to look like normal justified text.
orangy02/12/2023, 11:22 AM
Mark02/12/2023, 12:29 PM
except for the last row, which would be
. I can’t think of too many cases where it would look good to have the last row with one item on each edge with a large space in between. If you wanted to keep symmetry, then
would work for the last row. I suppose this could potentially happen on any row (if next item is very wide), and that’s why we have hyphenation in text. But in most cases, when we are using
we are doing so with relatively narrow items because we understand this. Thinking more about this, what you really want is a way for the
content to indicate to
to start a new row (and at the same time indicate which
to apply to that latest row). Analogy here is when there is a line break in text.
orangy02/12/2023, 1:16 PM
Mark02/12/2023, 1:17 PM
orangy02/12/2023, 2:06 PM
would be a proper way to fix it. Instead, I’d extend API of
. Thinking out loud, one way to do it would be to introduce
(name TBD) interface inside
object, that would have an additional function
(or just an overload for
) to indicate 2D layouts:
That would make it possible for arrangement to decide on first/last/whatever row/column.
fun Density.arrange2D( totalSize: Int, sizes: IntArray, layoutDirection: LayoutDirection, outPositions: IntArray, sliceIndex: Int, // current column/row totalSlices: Int // total columns/rows )
and related code would do something like
arrangement2D = (arrangement as? Table) ?: wrapTable(arrangement)
would provide Table API and just ignore extra parameters. Then two-dimensional layouts, like `FlowRow`/`FlowColumn`, grids, etc would feed Table arrangement with the current index of row/column and total number of those.
jossiwolf02/13/2023, 6:44 AM
jossiwolf02/13/2023, 7:06 AM