Vince Rickey
04/30/2021, 5:18 PMVince Rickey
04/30/2021, 5:23 PMSurface {
TwoTexts(text1 = "Hello World", text2 = "Hello World 2")
}
@Composable
fun TwoTexts(modifier: Modifier = Modifier, text1: String, text2: String) {
Row(modifier = modifier.height(IntrinsicSize.Min)) {
Text(
modifier = Modifier
.weight(1f)
.padding(start = 4.dp)
.wrapContentWidth(Alignment.Start),
text = text1
)
Divider(color = Color.Black, modifier = Modifier.fillMaxHeight().width(5.dp))
Text(
modifier = Modifier
.weight(1f)
.padding(end = 4.dp)
.wrapContentWidth(Alignment.End),
text = text2
)
}
}
Vince Rickey
04/30/2021, 5:26 PMVince Rickey
04/30/2021, 5:33 PMYASAN
04/30/2021, 6:38 PM.height(IntrinsicSize.Min)
on the parent as you have done. So based on my knowledge it should work. But I think I have missed one step in the process since even though I fixed this issue in one part of my app, I could not do the same on other parts of my app by adding .height(IntrinsicSize.Min)
on the parent and .fillMaxHeigh()
on the parent.
So I hope someone helps us both here 😫Vince Rickey
04/30/2021, 7:32 PMSurface {
TwoTexts(text1 = "Hello World", text2 = "Hello World 2")
}
But in order to achieve that same result in an app, I needed to wrap TwoTexts
in a parent container as you suggested. In my example, it is a Column
. (However, the Column doesn't need any Intrinsics, so you may want to revisit that in your project if I understood you correctly).
Working Code
Surface {
Column {
TwoTexts(text1 = "Hello World", text2 = "Hello World 2")
}
}
I also updated to the latest version of compose to make sure it wasn't a bug