AnyDecoration class abstract
Base class for decorations built from arbitrary contour points.
Subclasses define their geometry by overriding buildPoints. They must also override operator == and hashCode when they add fields, because contour caching is keyed by decoration equality.
- Inheritance
-
- Object
- Decoration
- AnyDecoration
- Implementers
Constructors
-
AnyDecoration({List<
AnyShadow> shadows = const [], AnyBackground? background, AnyShapeBase clipBase = AnyShapeBase.shapeBorder, AnyShapeBase shadowBase = AnyShapeBase.shapeBorder, bool enableCache = true, double offset = 0.0, AnyBorder border = const AnyBorder()}) -
const
-
AnyDecoration.multi({required List<
AnyBorder> borders, int primaryBorderIndex = 0, List<AnyShadow> shadows = const [], AnyBackground? background, AnyShapeBase clipBase = AnyShapeBase.shapeBorder, AnyShapeBase shadowBase = AnyShapeBase.shapeBorder, bool enableCache = true, double offset = 0.0}) -
Paints independent border layers, using
primaryBorderIndexfor paths.bordersmust be nonempty and must not be mutated after construction. List-dependent validation occurs before point or contour construction, because Dart const assertions cannot evaluate a list's length.const
Properties
- background → AnyBackground?
-
Fill painted behind side regions.
final
- border → AnyBorder
-
Convenience access to the primary border.
no setter
-
borders
→ List<
AnyBorder> -
Borders in paint order. Later borders paint over earlier borders.
Lists passed to the const constructor must not be mutated afterwards.
no setter
- clipBase → AnyShapeBase
-
Contour band returned by getClipPath.
final
- enableCache → bool
-
Whether built contours should be cached by decoration, size, and text direction.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isComplex → bool
-
Whether this decoration is complex enough to benefit from caching its painting.
no setterinherited
- offset → double
-
Construction-bounds adjustment added to each border's offset before
ratio fitting, in logical units. This does not change widget layout.
Negative values inset; positive values outset. Must be finite.
final
- padding → EdgeInsetsGeometry
-
Returns the insets to apply when using this decoration on a box
that has contents, so that the contents do not overlap the edges
of the decoration. For example, if the decoration draws a frame
around its edge, the padding would return the distance by which
to inset the children so as to not overlap the frame.
no setterinherited
- primaryBorderIndex → int
-
Border supplying background, clipping, and shadow boundaries.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shadowBase → AnyShapeBase
-
Contour band used as the source path for shadows.
final
-
shadows
→ List<
AnyShadow> -
Shadows painted from shadowBase.
final
Methods
-
adjustBounds(
Rect layoutBounds, TextDirection? textDirection, AnyBorder border, double offset, List< double> sideOffsets) → Rect -
Adjust raw construction bounds before ratio fitting.
Positive offsets expand; negative offsets inset. The scalar
offsetalready combines decoration and border values. Use the supplied currentsideOffsets, including during animation, rather than authored values. The default supports zero slots or one shared slot. Other layouts must override this hook. Return crossed/empty bounds when an inset exhausts the available area; do not normalize them or fit corners here. -
buildContour(
Size size, TextDirection? textDirection) → AnyContour - Builds the primary contour. Use buildContours to inspect every layer.
-
buildContours(
Size size, TextDirection? textDirection) → List< AnyContour> - Builds all contours in paint order, sharing one cache entry.
-
buildPoints(
Rect bounds, TextDirection? textDirection, AnyBorder border, List< double> sideOffsets) → List<AnyPoint> -
Build points from already adjusted, ratio-fitted
bounds. Never displace these bounds again. Carry currentsideOffsetsin the corresponding AnySide metadata, and forwardborderto point. -
createBoxPainter(
[VoidCallback? onChanged]) → BoxPainter -
Returns a BoxPainter that will paint this decoration.
override
-
debugAssertIsValid(
) → bool -
In debug mode, throws an exception if the object is not in a
valid configuration. Otherwise, returns true.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
getClipPath(
Rect rect, TextDirection textDirection) → Path -
Returns a closed Path that describes the outer edge of this decoration.
override
-
hitTest(
Size size, Offset position, {TextDirection? textDirection}) → bool -
Tests whether the given point, on a rectangle of a given size,
would be considered to hit the decoration or not. For example,
if the decoration only draws a circle, this function might
return true if the point was inside the circle and false
otherwise.
inherited
-
lerpFrom(
Decoration? a, double t) → Decoration? -
Linearly interpolates from another Decoration (which may be of a
different class) to
this.inherited -
lerpTo(
Decoration? b, double t) → Decoration? -
Linearly interpolates from
thisto another Decoration (which may be of a different class).inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
point(
Offset point, {required AnyBorder border, AnyCorner? shape, AnyCorner? outer, AnyCorner? inner, AnySide? side, bool skip = false}) → AnyPoint -
Builds an AnyPoint using the supplied
borderfor missing values. -
points(
Rect bounds, TextDirection? textDirection, {int? borderIndex}) → List< AnyPoint> -
Build a layer's points from raw layout
bounds, applying offsets and ratio fitting exactly once. Nonzero rectangle origins are preserved. -
resolveRenderer(
ImageConfiguration configuration, {VoidCallback? onChanged}) → AnyDecorationRenderer - Records this decoration once for repeated painting at different positions.
-
sideOffsetsForBorder(
Rect bounds, TextDirection? textDirection, AnyBorder border) → List< double> - Authored side-offset slots for construction-time tween interpolation.
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override