CustomPaint (Flutter Widget of the Week)

Google for Developers · 215K views · 2018 · 1:25

Open on YouTube

Software (other)UX & UI designexplainer

Why Stack Overflow recommends it

Stack Overflow users link it when answering Flutter questions that need custom shapes, drawn lines or lightweight rendering, as a quick official intro to CustomPaint.

Recommended by 4 people across 4 different months, 2019 to 2022.

What it is

A 1 minute 25 second episode of Google's Flutter Widget of the Week series covering the CustomPaint widget. It explains how Flutter exposes low-level, fast paint calls for building highly custom user interfaces.

What people said

Recommends key · 2019-07 · Stack Overflow · on “Create curved card with shadow”

What I would do it, of course after creating a cart, add a Stack, and a container with the same background color, and and a border radius of cicle so it taks a circular form, make another one and put it above that one. for the chain rectangle use a container without padding. if you want to do it custom then the video you showed is not what you are looking for, it's more this one [this video]

Recommends bluenile · 2020-12 · Stack Overflow · on “how to create a styling in button in flutter?”

Please see this [this video] Widget of the Week video from Flutter Team to understand CustomPaint. FlagPainter is really very easy. The black container is the canvas on which the CustomPaint draws. First the paint is created with color white, paint style fill and stroke width of 1. The Path is created. Path begins at top left which is 0, then the flag shape or triangle shape is created by drawing lines. The the path is closed. I recommend you see this video [LINK] to understand CustomPaint.

Recommends d1nch8g · 2021-09 · Stack Overflow · on “How to create the above custom clipPath widget? (I attached the screenshot)”

Hm... Interesting... If you want the cleanest solution possible, I would use something like CustomPaint , here you can take a look: CustomPaint Youtube video [this video] But if that is not much of a deal, you can simply add PNG image with a shape you need (and a transparency in a place where u have custom shape). You can try standard Image.asset() and reshape it with something. Also you can add a container at the bottom that, is 'cutting' the part of the app bar that you don't need. You can get it BoxDecoration , BoxBorder.only ... topleft , rounded rectangle ... and something like that.

Recommends WSBT · 2022-03 · Stack Overflow · on “How to render 18267 tiny Container widgets in Flutter without hurting performance?”

These tiny squares do not need to be Container widgets. Consider using a CustomPaint to draw rectangles instead (similar to html canvas if you are familiar with that). The Flutter team made a short video tutorial [this video] on this. After using CustomPaint , if you still run into performance issues (especially when scrolling, like have mentioned in the question), consider wraping the CustomPaint widget with a RepaintBoundary widget.

Cites Lasslos05 · 2022-10 · Stack Overflow · on “Making lines on the widgets”

You can use a Stack [LINK] in combination with the CustomPaint [this video] class. First, you put your whole Grid into a Stack. In this Stack, you also put your CustomPaint class that draws lines where you want them to be.