CustomClipper<T> class
Null safety
An interface for providing custom clips.
This class is used by a number of clip widgets (e.g., ClipRect and ClipPath).
The getClip method is called whenever the custom clip needs to be updated.
The shouldReclip method is called when a new instance of the class is provided, to check if the new instance actually represents different information.
The most efficient way to update the clip provided by this class is to
supply a reclip
argument to the constructor of the CustomClipper. The
custom object will listen to this animation and update the clip whenever the
animation ticks, avoiding both the build and layout phases of the pipeline.
See also:
- ClipRect, which can be customized with a CustomClipper<Rect>.
- ClipRRect, which can be customized with a CustomClipper<RRect>.
- ClipOval, which can be customized with a CustomClipper<Rect>.
- ClipPath, which can be customized with a CustomClipper<Path>.
- ShapeBorderClipper, for specifying a clip path using a ShapeBorder.
- Inheritance
-
- Object
- Listenable
- CustomClipper
- Implementers
Constructors
- CustomClipper({Listenable? reclip})
-
Creates a custom clipper.
const
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be notified when it is time to reclip.
override
-
getApproximateClipRect(
Size size) → Rect - Returns an approximation of the clip returned by getClip, as an axis-aligned Rect. This is used by the semantics layer to determine whether widgets should be excluded.
-
getClip(
Size size) → T - Returns a description of the clip given that the render object being clipped is of the given size.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that the
object notifies when it is time to reclip.
override
-
shouldReclip(
covariant CustomClipper< T> oldClipper) → bool - Called whenever a new instance of the custom clipper delegate class is provided to the clip object, or any time that a new clip object is created with a new instance of the custom clipper delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited