Loading topic
Intermediate · Mid: 15 chapters · 25 min read. States assumed prerequisites
Start readingCustomPaint is a widget that lets you draw directly with a canvas. A canvas is a two-dimensional drawing surface. You provide the drawing rules through a CustomPainter.Size contains a width and height, and that Flutter lays out widgets before it paints them.Size, and have basic familiarity with AnimationController. You will use that knowledge to separate two responsibilities:Size. It also assumes that you know the CustomPaint and CustomPainter roles from the previous chapter.Size, and the basic CustomPaint and CustomPainter APIs. This chapter focuses on how a Paint object controls the appearance of geometry after a Canvas drawing method creates it.CustomPainter, Canvas, Paint, and the Flutter Size coordinate system. This chapter focuses on combining points and curves into shapes that are more complex than circles and rectangles.Size, and the basics of AnimationController. This chapter focuses on how Flutter decides whether an existing CustomPainter needs to paint again.AnimationController. An AnimationController produces changing values over time. A CustomPainter can listen to those changes and repaint without rebuilding the surrounding widget tree.Size, and the basic Canvas drawing methods. You should also understand that a canvas uses logical pixels, with its origin at the painter's top-left corner. The x-coordinate increases to the right, and the y-coordinate increases doCustomPainter, Canvas, Paint, and Flutter's Size type. A gradient is a smooth color transition. In Flutter, a gradient creates a shader, and a shader tells Paint how to calculate the color at each pixel.Size, and basic CustomPainter. A TextPainter is a Flutter object that measures and draws text onto a Canvas. It is useful when text must appear inside custom graphics, such as chart labels, badges, diagrams, or a painted buttoStatefulWidget. This chapter focuses on the boundary between painting and input. Drawing a shape does not automatically make that shape interactive. You must define which local coordinates count as a hit and then handle thCustomPaint, CustomPainter, Flutter layout constraints, and AnimationController. It focuses on reducing unnecessary painting when a screen contains custom graphics.CustomPainter. This chapter focuses on accessibility. It does not cover painting shapes or handling gestures in detail.Canvas, and Paint. You should also know how a CustomPainter draws inside its paint method.