calculatePosition function

double calculatePosition(
  1. List<DelightToastBar> toastBars,
  2. DelightToastBar self
)

calculate position of old cards based on current position

Implementation

double calculatePosition(
    List<DelightToastBar> toastBars, DelightToastBar self) {
  if (toastBars.isNotEmpty && self != toastBars.last) {
    final box = self.info.key.currentContext?.findRenderObject() as RenderBox?;
    if (box != null) {
      return gapBetweenCard * (toastBars.length - toastBars.indexOf(self) - 1);
    }
  }
  return 0;
}