calculateScaleFactor function

double calculateScaleFactor(
  1. List<DelightToastBar> toastBars,
  2. DelightToastBar current
)

rescale the old cards based on its position

Implementation

double calculateScaleFactor(
    List<DelightToastBar> toastBars, DelightToastBar current) {
  int index = toastBars.indexOf(current);
  int indexValFromLast = toastBars.length - 1 - index;
  double factor = indexValFromLast / 25;
  double res = 0.97 - factor;
  return res < 0 ? 0 : res;
}