-
-
Notifications
You must be signed in to change notification settings - Fork 645
Open
Description
Transform that class in an abstract one and become an optional parameter to the Slidable, i'm struggling to make some custom animations in my code using the package without this customization:
class _SlidableClipper extends CustomClipper<Rect> {
_SlidableClipper({
required this.axis,
required this.controller,
}) : super(reclip: controller.animation);
final Axis axis;
final SlidableController controller;
@override
Rect getClip(Size size) {
switch (axis) {
case Axis.horizontal:
final double offset = controller.ratio * size.width;
if (offset < 0) {
return Rect.fromLTRB(size.width + offset, 0, size.width, size.height);
}
return Rect.fromLTRB(0, 0, offset, size.height);
case Axis.vertical:
final double offset = controller.ratio * size.height;
if (offset < 0) {
return Rect.fromLTRB(
0,
size.height + offset,
size.width,
size.height,
);
}
return Rect.fromLTRB(0, 0, size.width, offset);
}
}
@override
Rect getApproximateClipRect(Size size) => getClip(size);
@override
bool shouldReclip(_SlidableClipper oldClipper) {
return oldClipper.axis != axis;
}
}
Metadata
Metadata
Assignees
Labels
No labels