How can I have custom bullet point (color and size...
# compose
d
How can I have custom bullet point (color and size customisable), followed by multiline text, with bullet point aligned to first line? Something like this 👇 • This is a very long text which does not fit in one line
1
I was able to draw the circle and set the text. All wrapped in a Row component, but not sure how to align the circle/bullet to the first line.
z
Here’s an example of a layout implementation that does what you’re looking for
🙌 1
d
Its a start, but i guess I need a different approach 🤔 This is based on a list of items, i would need to just have a text with prefix composable.
z
Ah, then I think the baseline alignment line should do what you need
Something like this
🙌 1
h
🙌 1
d
Baseline did the trick 🙂 In case some is looking for something similar, here is my code:
Copy code
@Preview(widthDp = 100)
@Composable
fun BulletMultilineText() {
    Row(Modifier.wrapContentHeight()) {
        Box(
            modifier = Modifier
                .size(6.dp)
                .clip(CircleShape)
                .background(Color.Magenta)
                .alignBy {
                    it.measuredHeight
                }
        )

        Text(
            text = "my multiline text here",
            style = TextStyle(
                fontSize = 14.sp,
            ),
            color = Color.White,
            modifier = Modifier
                .wrapContentWidth()
                .wrapContentHeight()
                .padding(start = 4.dp)
                .alignByBaseline()
        )
    }
}
👍 1
Thanks you 🤜 🤛