Zhelyazko Atanasov
11/24/2021, 3:10 PMModifier
argument and then add .height()
internally. The negative side is that there won't be a way to change the composable's height.
@Composable
fun MyComposable(
modifier: Modifier = Modifier
) {
Surface(modifier = modifier.height(24.dp)
}
2. Have a default value of the modifier
argument that specifies the height. The downside is that if you want to pass a modifier to the composable, you'd have to add the height
one as well:
@Composable
fun MyComposable(
modifier: Modifier = Modifier.height(24.dp)
) {
Surface(modifier = modifier
}
In my particular case the composable will always be displayed in the default height, but I'm asking what's the generally preferred way to do this for composables that may vary in size, but we still want to have some default/min heightokarm
11/24/2021, 3:42 PMModifier.defaultMinSize()
instead of Modifier.height()
Zhelyazko Atanasov
11/24/2021, 5:27 PMAlbert Chang
11/24/2021, 5:29 PMZhelyazko Atanasov
11/24/2021, 5:59 PM