https://kotlinlang.org logo
#compose
Title
# compose
a

Abhishek Dewan

07/25/2021, 7:50 AM
Does anyone have a good way to create a vertical divider ? I have
Copy code
Box(
        modifier = Modifier
            .width(1.dp)
            .fillMaxHeight()
            .background(ScoutTheme.colors.dividerColor.copy(alpha = 0.12f))
    )
but I am seeing that when it's used inside a Row who's height is dynamic, nothing ever renders. If I replace the fillMaxHeight with a specific height I see it render but then I have the potential to get empty spaces since the height is specific rather than being dynamic
t

Tin Tran

07/25/2021, 8:22 AM
you can do this
Copy code
Row(Modifier.height(IntrinsicSize.Min) { 
Box(
        modifier = Modifier
            .width(1.dp)
            .fillMaxHeight()
            .background(ScoutTheme.colors.dividerColor.copy(alpha = 0.12f))
    )
// other contents
}
a

Albert Chang

07/25/2021, 1:15 PM
This is exactly the example in the doc.
a

Abhishek Dewan

07/25/2021, 7:43 PM
ohh thanks for pointing that out @Albert Chang I must have just overlooked the sample 😅
m

Mohan

07/26/2021, 12:33 PM
U need add height of parent as intrinsic. Min
5 Views