LayerPaint class
Fill and stroke properties for a shape layer.
Named LayerPaint rather than Paint to avoid shadowing dart:ui's
Paint when imported alongside material.dart.
const paint = LayerPaint(
color: Color32.fromRGB(0, 120, 255),
style: LayerPaintStyle.fillAndStroke,
strokeWidth: 2,
);
Constructors
-
LayerPaint({Color32 color = Color32.black, LayerPaintStyle style = LayerPaintStyle.fill, double strokeWidth = 1.0, StrokeCap strokeCap = StrokeCap.butt, StrokeJoin strokeJoin = StrokeJoin.miter, double miterLimit = 4.0, List<
double> dashArray = const [], double dashOffset = 0.0, Gradient? gradient}) -
Creates a paint. Defaults to a solid black fill.
const
-
LayerPaint.fromJson(Map<
String, Object?> json) -
Reconstructs a LayerPaint from toJson's output.
factory
Properties
- color → Color32
-
The solid fill/stroke color, used unless gradient is set.
final
-
dashArray
→ List<
double> -
Alternating on/off lengths (in the Scene's logical pixel space) the
stroke is divided into, e.g.
[4, 2]for a 4-on/2-off dash. An empty list (the default) draws a solid stroke. An odd-length list repeats (matching SVG/CSS:[4]behaves like[4, 4]).final - dashOffset → double
-
Offset into dashArray's repeating pattern at which the dash starts.
Ignored when dashArray is empty, and — like dashArray — only takes
effect on a PathLayer.
final
- gradient → Gradient?
-
When set, paints the shape (both fill and stroke) with this gradient
instead of the solid color.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- miterLimit → double
-
How far a StrokeJoin.miter corner may extend, as a multiple of
strokeWidth, before it's clamped to a bevel. Ignored unless
strokeJoin is StrokeJoin.miter.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strokeCap → StrokeCap
-
Shape of the stroke's open ends. Ignored for style
LayerPaintStyle.fill or a closed subpath.
final
- strokeJoin → StrokeJoin
-
Shape drawn at each corner where two stroked segments meet.
final
- strokeWidth → double
-
Width of the stroke, in the Scene's logical pixel space. Ignored
unless style is LayerPaintStyle.stroke or
fillAndStroke.final - style → LayerPaintStyle
-
Whether the shape is filled, stroked, or both.
final
Methods
-
copyWith(
{Color32? color, LayerPaintStyle? style, double? strokeWidth, StrokeCap? strokeCap, StrokeJoin? strokeJoin, double? miterLimit, List< double> ? dashArray, double? dashOffset, Gradient? gradient}) → LayerPaint - Returns a copy with the given fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> -
Converts to a JSON-safe map, see
Scene.toJson. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited