enighma
08/22/2022, 6:15 PM@Composable LazyGridScope.myFun() = ...
Is there a workaround or suggested solution for this? I guess I can pass it as a param and run scope.apply{}
.Alex Vanyo
08/22/2022, 6:18 PMenighma
08/22/2022, 6:20 PMLazyGrid
and I want to encapsulate each row into a composable, but maybe I'm thinking of it the wrong way and each item instead should be extracted.LazyGridScope.myFun()
I just feel I have to jump through a few more hoops than I expectedColumn
Alex Vanyo
08/22/2022, 7:19 PMLazy
is a bit of a special case:
// @Composable
LazyColumn {
// not @Composable
item {
// @Composable
Text(...)
}
}
The nice lambdas hide the types and obscure what’s going on a bit. Right inside LazyColumn
is setting up a DSL for which items to (potentially) emit. So each item
is defining a part of the lazy content, but since it’s lazy, it may not actually get executed.
So when you define an extension on LazyGridScope
, you’re saying “here’s a portion of content to contribute to the DSL of items to show,” as opposed to saying “here’s content to directly place into the scope”
The latter case makes sense with a ColumnScope
, since you are directly adding normal composables.enighma
08/22/2022, 8:18 PMLazyGrid
is there a mechanism to align content of a cell?
I did not find any info in the doc nor looking at the API itself.fillMaxSize()
the composable is still not not filling up its cell, and that is fine if I at least could align it, within it.Stylianos Gakis
08/22/2022, 9:51 PM