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

Kshitij Patil

11/13/2020, 11:27 AM
How to use
Divider
as vertical line?
p

pavi2410

11/13/2020, 12:40 PM
I am not sure, but inside the RowScope, it becomes vertical
k

Kshitij Patil

11/13/2020, 1:18 PM
It didn't so thought we need to do something to get it working for vertical line
p

Pavel Marchenko

11/13/2020, 1:41 PM
Hi, for this purpose i have created dedicated composable
Copy code
@Composable
fun AppDividerVertical(
  modifier: Modifier = Modifier,
  color: Color = MaterialTheme.colors.onSurface.copy(alpha = 0.12f),
  thickness: Dp = 1.dp,
  startIndent: Dp = 0.dp,
) {
  val indentMod = if (startIndent.value != 0f) {
    Modifier.padding(top = startIndent)
  } else {
    Modifier
  }
  Box(
    modifier.then(indentMod)
        .fillMaxHeight()
        .preferredWidth(thickness)
        .background(color = color)
    )
}
👍 4
10 Views