getCardHeight method

double getCardHeight(
  1. int index
)

Implementation

double getCardHeight(int index) {
  double diff = (currentPostion! - index).abs();

  if (diff >= 0.0 && diff < 1.0) {
    return cardMaxHeight - cardMaxHeight * (4 / 5) * ((diff - diff.floor()));
  } else if (diff >= 1.0 && diff < 2.0) {
    return cardMaxHeight -
        cardMaxHeight * (4 / 5) -
        10 * ((diff - diff.floor()));
  } else {
    final height = cardMaxHeight -
        cardMaxHeight * (4 / 5) -
        10 -
        5 * ((diff - diff.floor()));

    return height > 0 ? height : 0;
  }
}