https://kotlinlang.org logo
Title
y

Yan Pujante

03/08/2021, 7:38 PM
I am trying to emulate a table (since it looks there is none) and I have the following code:
Column {
        parts.value.forEach { part ->
            Row(modifier = Modifier.fillMaxWidth().background(color = Color.LightGray)) {
                Text(part.name, modifier = Modifier.fillMaxWidth(0.33333F).background(color = Color.Red))
                Text(part.description ?: "N/A", modifier = Modifier.fillMaxWidth(0.33333F).background(color = Color.Green))
                Text(part.price.toString(), modifier = Modifier.fillMaxWidth(0.33333F).background(color = Color.Blue))
            }
        }
    }
It renders this way so I guess I don't understand the fraction parameter...
z

Zach Klippenstein (he/him) [MOD]

03/08/2021, 7:40 PM
it’s not terribly difficult to make a real table composable. Here’s an example.
r

romainguy

03/08/2021, 7:42 PM
You should also be able to achieve it with ConstraintLayout and barriers
y

Yan Pujante

03/08/2021, 7:47 PM
I replaced .fillMaxWidth(0.333F) by .weight(1F) and it now works
s

suresh

03/09/2021, 12:06 AM
@romainguy does ConstraintLayout work on compose desktop?
o

olonho

03/09/2021, 5:37 AM
nope, ConstraintLayout is not ported to desktop, as relies on Android library
:thank-you: 1
😅 1
r

romainguy

03/09/2021, 7:08 AM
@olonho Is that also true of the Compose version?
AFAIK it only uses the solver which is not Android specific (it’s used in the visual editor in the IDE)
o

olonho

03/09/2021, 7:45 AM
It was mostly dependency management matter, IIRC and if we could bring it to Compose for Desktop - would be awesome