julioromano
03/23/2022, 6:21 PMZach Klippenstein (he/him) [MOD]
03/23/2022, 6:28 PMjulioromano
03/23/2022, 6:38 PMBox(
modifier = Modifier
.aspectRatio(1f)
.fillMaxSize(),
contentAlignment = Alignment.Center
) {
MyComposable(
modifier = Modifier
.fillMaxSize(0.75f)
)
}
Zach Klippenstein (he/him) [MOD]
03/23/2022, 8:17 PMMyComposable(
Modifier
.aspectRatio(1f)
.fillMaxSize()
.wrapContentSize(align = Alignment.Center)
.fillMaxSize(0.75f)
)
julioromano
03/24/2022, 8:38 AMZach Klippenstein (he/him) [MOD]
03/24/2022, 3:31 PMjulioromano
03/24/2022, 3:36 PMIt might also not need that first fillMaxSize, I’d have to try it to know.Just tried and, indeed, it also works without it!
Zach Klippenstein (he/him) [MOD]
03/24/2022, 3:36 PMaspectRatio
already passes tight constraints down.wrapContentSize
should pass the max constraints down untouched.julioromano
03/24/2022, 3:37 PMIt might actually work without wrap content size, but then the alignment would depend on however the parent layout decides to place children that don’t take up the whole space (and the simplest thing to do is to just place them start-left).Precisely, without
wrapContentSize
the inner composable ended up with a different alignment.