https://kotlinlang.org logo
Title
a

AmrJyniat

01/17/2023, 2:35 PM
How I can create the attached shape with GenericShape?
I tried this code but it doesn't seem to work!
val contentTypeShape = GenericShape { size, _ ->
            lineTo(size.width.getValueOfPercentage(90), 0f)

            addArc(
                oval = Rect(
                    0f,
                    -25f,
                    size.width,
                    size.height.plus(25f)
                ),
                -90f, 180f
            )

            lineTo(0f, size.height)

            lineTo(0f, 0f)

        }
z

Zaki Shaikh

01/17/2023, 2:49 PM
You can overlay two Composable in box one text with rounded corner background another is icon with circle background
a

AmrJyniat

01/17/2023, 3:08 PM
Nice idea, I'll try it
c

Chris Sinco [G]

01/17/2023, 10:07 PM
If you have access to Figma, you can draw it there and use this plugin to export it as a shape class: https://www.figma.com/community/plugin/1054248779295272882/Shape-Composer
However, you may need to make some adjustments in the code if you want it to scale properly to the text and icon size (assuming those may grow/shrink over time)