Peter
09/05/2023, 8:10 AMPeter
09/05/2023, 8:12 AM@Composable
private fun Item(icon: ImageVector, title: String, date: String) {
Row(
modifier = Modifier.fillMaxWidth(),
) {
Icon(imageVector = icon, contentDescription = null)
Column(modifier = Modifier.padding(start = 8.dp)) {
Text(
text = title,
style = typography.subTitle03,
)
Text(
text = date,
style = typography.body04,
modifier = Modifier.padding(top = 4.dp),
)
}
}
}
@Composable
@PreviewFontSizes
private fun PreviewItem() {
Surface {
Item(
icon = Icons.Outlined.Person,
title = "Some line\nthat breaks",
date = "29th Jun - 11.20"
)
}
}
Csaba Szugyiczki
09/05/2023, 8:14 AMCsaba Szugyiczki
09/05/2023, 8:14 AMCsaba Szugyiczki
09/05/2023, 8:15 AMText(
text = myText,
style = TextStyle(
lineHeight = 2.5.em,
platformStyle = PlatformTextStyle(
includeFontPadding = false
)
/* ... */
)
Peter
09/05/2023, 8:21 AMascii
09/05/2023, 8:37 AMverticalAlignment = Alignment.CenterVertically
to your Rowascii
09/05/2023, 8:38 AMColumn {
Row {
Icon
TopText
}
BottomText
}
Peter
09/05/2023, 8:39 AMPeter
09/05/2023, 8:40 AMascii
09/05/2023, 8:43 AMonTextLayout
callback of Text and use firstBaseline, getLineTop/Bottom etc, and position icon accordinglyascii
09/05/2023, 8:46 AMPeter
09/05/2023, 8:49 AMonTextLayout
?Peter
09/05/2023, 8:50 AMascii
09/05/2023, 8:51 AMUnless you have rigid constraints from designers (another team), you should do what's easier code-wise
ascii
09/05/2023, 8:52 AMPeter
09/05/2023, 10:04 AMZach Klippenstein (he/him) [MOD]
09/05/2023, 6:11 PMPeter
09/05/2023, 6:17 PMZach Klippenstein (he/him) [MOD]
09/05/2023, 6:25 PM