transform method
Return a transformed widget, based on child and TransformInfo
Implementation
@override
Widget transform(Widget item, TransformInfo info) {
var position = info.position;
var child = item;
if (scale != null) {
var scaleFactor = (1 - position.abs()) * (1 - scale!);
var rawScale = scale! + scaleFactor;
child = Transform.scale(
scale: rawScale,
child: item,
);
}
if (fade != null) {
var fadeFactor = (1 - position.abs()) * (1 - fade!);
var opacity = fade! + fadeFactor;
child = Opacity(
opacity: opacity,
child: child,
);
}
if (margin != null) {
child = Container(
margin: EdgeInsets.only(left: margin!, right: margin!),
child: child,
);
}
return child;
}