I am developing an App using flutter and came across a custom curve like structure and I have no Idea how to create one. I am sharing a screenshot for the same.
I did some research and found that it might be possible with clip path widget but again I have no clue how will that work. I would also appreciate if someone also explained how to solve this.
2
Answers
Maybe this code is not the best way but it was easiest to make UI like this
A clean way to do this is using a
ShapeBorder
, so you can use it on any container. Similar to theClipPath
widget, you can define a path to use. TheShapeBorder
gets you the path from a boundingRect
of thisContainer
. In the code below, I draw the top arc above this rect, so the top border aligns (and you can put other Widgets right above this container too).Then, wherever you want to use it, you can add it in the
ShapeDecoration
of yourContainer
:Which looks like this:
Complete code for usage (
main.dart
):