transform method
Implementation
@override
Widget transform(BuildContext context, Widget page, int index, int? currentPage, double pageDelta, int itemCount) {
final double width = MediaQuery.of(context).size.width;
if (index == currentPage! + 1 && pageDelta > 0.5) {
return Transform(
alignment: Alignment.center,
child: page,
transform: Matrix4.identity()
..setEntry(3, 2, perspectiveScale)
..rotateY(math.pi * (pageDelta - 1))
..leftTranslate(-width * (1 - pageDelta)),
);
} else if (index == currentPage && pageDelta <= 0.5) {
return Transform(
alignment: Alignment.center,
child: page,
transform: Matrix4.identity()
..setEntry(3, 2, perspectiveScale)
..rotateY(math.pi * pageDelta)
..leftTranslate(width * pageDelta),
);
} else if (pageDelta == 0) {
return page;
} else {
return Container();
}
}