dimsuz
08/10/2022, 3:08 PMval state = rememberNiceState(itemPositions: Positions.Stage0)
NiceContainer(
itemCount = 3,
state: NiceState = state,
itemContent = { index -> MyItem(index) }
)
LaunchedEffect(Unit) {
state.animateItems(Positions.Stage1)
}
The problem is that to calculate an (x,y) of each item given the "stage" I need to know the itemsCount : both in State consctructor and in animateItems.
I could make itemCount private val in State, but I do not want to require user to pass itemsCount both to NiceContainer composable and to State constructor, this feels weird. Similarly passing itemCount only to State constructor and removing it from NiceContainer argument list feels not like something you do in other composable container layouts... Any suggestions?dimsuz
08/10/2022, 3:11 PMitemsCount as a mutableState in NiceState() class and setting it always from inside NiceContainer body, but this feels strange too. and it also makes NiceState initialization quite complex insde, because there are other internal properties there which depend on itemsCount