getCardWidth method
Implementation
double getCardWidth(int index) {
final double distance = (currentPagePosition - index).abs();
if (distance >= 0.0 && distance < 1.0) {
return centerWidgetWidth -
(centerWidgetWidth - nearWidgetWidth) * (distance - distance.floor());
} else if (distance >= 1.0 && distance < 2.0) {
return nearWidgetWidth -
(nearWidgetWidth - farWidgetWidth) * (distance - distance.floor());
} else {
return farWidgetWidth;
}
}