CustomPaint class final

Flutter's CustomPaint on a node: painter drawn behind the node's content (its decoration and children) and foregroundPainter over it, both in the node's box (inside its transform and opacity, outside its clip). The node's layout is CustomPaint.size; its content is child.

viewBox is the ops' coordinate space, [minX, minY, width, height] (JSON also [width, height]), mapped onto the box by fit (fill stretches, as the path node's view box does); null: the box's own pixels. In expressions size.width and size.height are the view box's size when there is one, else the box's.

Annotations
  • @immutable

Constructors

CustomPaint({List<DrawOp> painter = const [], List<DrawOp> foregroundPainter = const [], List<double>? viewBox, BoxFit fit = BoxFit.fill, bool isComplex = false, bool willChange = false})
const

Properties

allOps → Iterable<DrawOp>
Every op of both lists, groups' and repeats' ops included, depth first.
no setter
fit → BoxFit
final
foregroundPainter → List<DrawOp>
final
hashCode → int
The hash code for this object.
no setteroverride
hasHitRegions → bool
Whether a shape in it is a hit region.
no setter
isComplex → bool
Raster cache hints (CustomPaint.isComplex, willChange).
final
painter → List<DrawOp>
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
viewBox → List<double>?
[minX, minY, width, height], width and height above 0.
final
willChange → bool
Raster cache hints (CustomPaint.isComplex, willChange).
final

Methods

copyWith({List<DrawOp>? painter, List<DrawOp>? foregroundPainter, List<double>? viewBox, BoxFit? fit, bool? isComplex, bool? willChange}) → CustomPaint
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Json
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

fromJson(Object? json) → CustomPaint?
readViewBox(Object? json) → List<double>?
A view box: [width, height] or [minX, minY, width, height] with a positive size, as [minX, minY, width, height]; else null.
writeViewBox(List<double> v) → List<num>
readViewBox's JSON: [width, height] when it starts at the origin.

Constants

keys → const Set<String>