
library;


double multiSourceScrollOffset({
  required int activeIndex,
  required double viewportWidth,
  required double leadingPad,
  required double maxScrollExtent,
  double cardWidth = 220.0,
  double cardGap = 12.0,
}) {
  if (activeIndex <= 0) return 0.0;
  final target =
      leadingPad +
      activeIndex * (cardWidth + cardGap) -
      (viewportWidth - cardWidth) / 2;
  return target.clamp(0.0, maxScrollExtent).toDouble();
}
