Jan
09/13/2023, 7:12 PMKirill Grouchnikov
09/13/2023, 7:19 PMverticalAlignment = Alignment.CenterVertically
on your rowJan
09/13/2023, 7:20 PMFrancesc
09/13/2023, 7:25 PMJan
09/13/2023, 7:28 PMFrancesc
09/13/2023, 7:32 PMJan
09/13/2023, 7:32 PMFrancesc
09/13/2023, 7:32 PMFrancesc
09/13/2023, 7:33 PMTravis Griggs
09/13/2023, 8:08 PMZach Klippenstein (he/him) [MOD]
09/13/2023, 8:24 PMdewildte
09/13/2023, 9:03 PMRow { leadingContent(); Column(modifier = Modifier.weight(1)) { content() }; trailingContent() }
dewildte
09/13/2023, 9:07 PMZach Klippenstein (he/him) [MOD]
09/13/2023, 9:44 PMTravis Griggs
09/13/2023, 9:47 PM@Composable
fun LowHungItem(label: String, timestamp: Instant, modifer: Modifier = Modifier) {
Row(modifier = modifer, verticalAlignment = Alignment.CenterVertically) {
Checkbox(checked = true, onCheckedChange = {}, modifier = Modifier)
Column(modifier = Modifier.weight(1f)) {
Text(text = "X", modifier = Modifier.alpha(0f), fontSize = 10.sp)
Text(text = label, fontSize = 20.sp)
Text(text = "${timestamp}", fontSize = 10.sp)
}
Icon(Icons.Outlined.Delete, null)
}
}
@Preview(showBackground = true)
@Composable
private fun LowHungItemPreview() {
PlansDemoTheme {
LowHungItem("Test", Clock.System.now(), modifer = Modifier.fillMaxWidth())
}
}
This works (I think). It looks like what was asked for. But it's obviously a long way away from Right(tm)Zach Klippenstein (he/him) [MOD]
09/13/2023, 9:48 PMxoangon
09/13/2023, 9:48 PMBoxWithConstraints
shouldn't be taken as the first choice for performance reasons. I would defikitely start by thinking if that design makes real sense. If that is the case, you could consider a ConstraintLayout
with guidelines.
Do you find any performance gotvhas for this approach @Zach Klippenstein (he/him) [MOD]?Zach Klippenstein (he/him) [MOD]
09/13/2023, 9:50 PMxoangon
09/13/2023, 9:51 PMdewildte
09/14/2023, 4:58 PMOr you could use a box with constraints.Let me restate this to be more clear.
Or you could make an absolute mess of a layout with bad performance to achieve something small.That’s all….thank you.