Improve docs to address flutter/flutter#31202 (#31454)
## Description Clarify that ClipRect can be added to ensure that CustomPainter will be drawing within bounds. ## Related Issues https://github.com/flutter/flutter/issues/31202
This commit is contained in:
@@ -157,8 +157,13 @@ abstract class CustomPainter extends Listenable {
|
||||
/// coordinate space configured such that the origin is at the top left of the
|
||||
/// box. The area of the box is the size of the [size] argument.
|
||||
///
|
||||
/// Paint operations should remain inside the given area. Graphical operations
|
||||
/// outside the bounds may be silently ignored, clipped, or not clipped.
|
||||
/// Paint operations should remain inside the given area. Graphical
|
||||
/// operations outside the bounds may be silently ignored, clipped, or not
|
||||
/// clipped. It may sometimes be difficult to guarantee that a certain
|
||||
/// operation is inside the bounds (e.g., drawing a rectangle whose size is
|
||||
/// determined by user inputs). In that case, consider calling
|
||||
/// [Canvas.clipRect] at the beginning of [paint] so everything that follows
|
||||
/// will be guaranteed to only draw within the clipped area.
|
||||
///
|
||||
/// Implementations should be wary of correctly pairing any calls to
|
||||
/// [Canvas.save]/[Canvas.saveLayer] and [Canvas.restore], otherwise all
|
||||
|
||||
@@ -419,7 +419,9 @@ class BackdropFilter extends SingleChildRenderObjectWidget {
|
||||
/// painters are expected to paint within a rectangle starting at the origin and
|
||||
/// encompassing a region of the given size. (If the painters paint outside
|
||||
/// those bounds, there might be insufficient memory allocated to rasterize the
|
||||
/// painting commands and the resulting behavior is undefined.)
|
||||
/// painting commands and the resulting behavior is undefined.) To enforce
|
||||
/// painting within those bounds, consider wrapping this [CustomPaint] with a
|
||||
/// [ClipRect] widget.
|
||||
///
|
||||
/// Painters are implemented by subclassing [CustomPainter].
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user