Custom Paint in Flutter


Custom Paint in Flutter is used to paint or customize the shape, and size of the widgets with the help of Custom Painter Class.

In this blog, we will be creating some shapes with the help of Custom Paint.

Let’s begin with the basic understanding of CustomPainter Class.

Custom Painter class overrides two methods-

  1. paint()
  2. shouldRepaint()

Within the paint() method, we need to provide all the details regarding painting the canvas.

Moreover, shouldRepaint() method, we can decide whether we want the Canvas to be redrawn or not when a new Custom Painter instance is provided.

Properties of Custom Paint

In CustomPaint class, there are three most important properties which are used-

  1. child – It takes the widget over which the CustomPaint needs to be applied.
  2. painter – It paints before the widget has been built. It takes a class within it which extends CustomPainter.
  3. foregroundPainter- It paints after the widget has been built. It takes a class within it which extends CustomPainter.

Moreover, there are many other properties like size, isComplex etc. 

Code for Custom Paint

Firstly, we will need to create a class that extends CustomPainter class.

Secondly, we have created two objects, the first one is the Path and the second one is the Circle.

Here, for creating a path we are using Path() and its quadraticBezierTo property.

Finally, we have created a CustomPainter class to paint over the canvas.

Complete Code

Finally, here is the complete code for the Custom Paint –


Here’s the final output-


In this blog, we have discussed how can we use Custom Paint in Flutter.

I hope it will help you out in understanding.

Thanks for reading!!


. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.


It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.

Vincenzo Carrano

Vincenzo Carrano

Administrator, Segshop

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home