containerPaddingFor method

EdgeInsets containerPaddingFor(
  1. M3ECarouselType type
)

Container padding around the scroll track.

Hero and contained keep 16 on the sides. Uncontained tracks touch the horizontal edges; the item gap is the leading space at rest.

Implementation

EdgeInsets containerPaddingFor(M3ECarouselType type) {
  final double halfGap = itemGap / 2;
  final double vertical = 8;
  switch (type) {
    case M3ECarouselType.fullScreen:
      return EdgeInsets.zero;
    case M3ECarouselType.uncontained:
    case M3ECarouselType.uncontainedMultiAspect:
      return EdgeInsets.symmetric(vertical: vertical);
    case M3ECarouselType.hero:
    case M3ECarouselType.contained:
      return EdgeInsets.fromLTRB(
        16 - halfGap,
        vertical,
        16 - halfGap,
        vertical,
      );
  }
}