PainterDrawable class
A ChartDrawable that draws with a callback, for vector icons and custom shapes.
painter is called with the canvas translated to the top-left corner of the bounds and the size of the bounds, so
it paints into Offset.zero & size.
- Inheritance
-
- Object
- ChartDrawable
- PainterDrawable
Constructors
- PainterDrawable(void painter(Canvas canvas, Size size), {required int width, required int height})
-
Creates a drawable that paints with
painter;widthandheightare its intrinsic size in pixels.
Properties
- alpha ↔ int
-
The opacity the drawable is drawn with, 0 (transparent) to 255 (opaque), like
Drawable.setAlpha. Default 255.getter/setter pairinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- intrinsicHeight → int
-
The natural height in pixels (
Drawable.getIntrinsicHeight), or -1 if the drawable has none.no setteroverride - intrinsicWidth → int
-
The natural width in pixels (
Drawable.getIntrinsicWidth), or -1 if the drawable has none.no setteroverride - painter → void Function(Canvas canvas, Size size)
-
Paints the drawable into a rectangle of the given size at the canvas origin.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
draw(
Canvas canvas, MutableRect bounds) → void -
Draws the drawable stretched to fill
boundsoncanvas(setBounds+Drawable.draw).override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited