maxIndex static method

int maxIndex({
  1. required M3ECarouselType type,
  2. required M3ECarouselHeroAlignment heroAlignment,
  3. required bool isExtended,
  4. required int childrenLength,
})

Largest step index for type. Negative when the track cannot step.

Implementation

static int maxIndex({
  required M3ECarouselType type,
  required M3ECarouselHeroAlignment heroAlignment,
  required bool isExtended,
  required int childrenLength,
}) {
  return switch (type) {
    M3ECarouselType.hero =>
      childrenLength -
          switch (heroAlignment) {
            M3ECarouselHeroAlignment.center => 3,
            M3ECarouselHeroAlignment.left ||
            M3ECarouselHeroAlignment.right => 2,
          },
    M3ECarouselType.contained => childrenLength - (isExtended ? 4 : 3),
    M3ECarouselType.uncontained ||
    M3ECarouselType.uncontainedMultiAspect ||
    M3ECarouselType.fullScreen => childrenLength - 1,
  };
}