I want to draw a trapezoidal shape in flutter, like this:
Now I am drawing an elliptical shape using Rrect for the same,
here is my code for drawing the second picture(getting an elliptical shape)
@override
void paint(Canvas canvas, Offset offset, ImageConfiguration cfg) {
final Offset circleOffset =
offset + Offset(cfg.size!.width / 2, cfg.size!.height + 8);
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromCenter(center: circleOffset, width: 50, height: 5),
Radius.circular(radius),
),
_paint);
}
using Rrect.fromRectAndCorners,
so my final code looks like
will get more details in the documentation here
https://api.flutter.dev/flutter/dart-ui/RRect/RRect.fromRectAndCorners.html
Thanks for help.