https://kotlinlang.org logo
b

bodo

12/21/2020, 3:26 PM
Hi. Can someone tell me how i can achieve the following shape in a surface. i tried cubic and bezier shapes but no one fits perfect. It is a red background and the bottomLeft and bottomRight cornors should be inverted. Thx
a

Afzal Najam

12/21/2020, 8:28 PM
there isn't a radius modifier?
b

bodo

12/23/2020, 10:35 AM
no unfortunatelly not, but i got it working. i created the following GenericShape:
Copy code
val surfaceShape = GenericShape { size ->
      moveTo(size.width, size.height)
      lineTo(size.width, 0f)
      lineTo(0f, 0f)
      lineTo(0f, size.height)

      quadraticBezierTo(
        x1 = 8.dp.value,
        y1 = size.height * 0.9f,
        x2 = 16.dp.value,
        y2 = size.height * 0.9f,
      )
      lineTo(size.width - 16.dp.value, size.height * 0.9f)
      quadraticBezierTo(
        x1 = size.width - 8.dp.value,
        y1 = size.height * 0.9f,
        x2 = size.width,
        y2 = size.height,
      )
    }
and added this to the
Surface(shape = surfaceShape, color = Color.RED)
👍 1