Search code examples
androidflutterdartwidgetellipse

How to cut edge of ellipse flutter


I am going to make this widget in my app but I couldn't cut the edge of my widget like this.

This is what I want to create:

This is what I want to create:

But this is what I have created:

But this is what I have created:

I have used a container with a border radius to create this widget. Can you please suggest a better way to make the above widget as I want?


Solution

  • Easy solution: Just wrap your container inside Transform.scale() and scale it a little bit so that it cuts from left and right

    Transform.scale(
         scale: [your scaling factor], // 1 is normal
         child: [YourContainer()],
    )
    

    Complex solution: You can make a custom clipper for your container and clip it accordingly.