M3ECarouselWrapper constructor

const M3ECarouselWrapper({
  1. Key? key,
  2. bool freeScroll = false,
  3. EdgeInsets? padding,
  4. Color? backgroundColor = Colors.transparent,
  5. double? elevation = 0.0,
  6. ShapeBorder? shape = const RoundedRectangleBorder(),
  7. Clip itemClipBehavior = Clip.none,
  8. WidgetStateProperty<Color?>? overlayColor,
  9. bool itemSnapping = false,
  10. bool consumeMaxWeight = true,
  11. double shrinkExtent = 0.0,
  12. bool scaleItems = true,
  13. M3ECarouselController? controller,
  14. Axis scrollDirection = Axis.horizontal,
  15. bool reverse = false,
  16. void onTap(
    1. int
    )?,
  17. M3EHapticFeedback haptic = M3EHapticFeedback.none,
  18. bool enableSplash = true,
  19. bool infinite = false,
  20. double? itemExtent,
  21. List<int>? flexWeights,
  22. required List<M3ECarouselItem> children,
  23. void onIndexChanged(
    1. int
    )?,
  24. ValueChanged<M3ECarouselChangeDetails>? onChange,
  25. ValueChanged<int>? onFocusedIndex,
  26. bool reducedMotion = false,
  27. List<double>? itemExtents,
  28. double leadingInset = 0,
  29. double trailingGap = 0,
  30. double fixedPulseDelta = 4,
})

Creates a carousel wrapper with optional pulse animation on tap.

Implementation

const M3ECarouselWrapper({
  super.key,
  this.freeScroll = false,
  this.padding,
  this.backgroundColor = Colors.transparent,
  this.elevation = 0.0,
  this.shape = const RoundedRectangleBorder(),
  this.itemClipBehavior = Clip.none,
  this.overlayColor,
  this.itemSnapping = false,
  this.consumeMaxWeight = true,
  this.shrinkExtent = 0.0,
  this.scaleItems = true,
  this.controller,
  this.scrollDirection = Axis.horizontal,
  this.reverse = false,
  this.onTap,
  this.haptic = M3EHapticFeedback.none,
  this.enableSplash = true,
  this.infinite = false,
  this.itemExtent,
  this.flexWeights,
  required this.children,
  this.onIndexChanged,
  this.onChange,
  this.onFocusedIndex,
  this.reducedMotion = false,
  this.itemExtents,
  this.leadingInset = 0,
  this.trailingGap = 0,

  /// Fixed logical pixels added or removed per animating edge at peak pulse.
  ///
  /// A value of `4` expands or squishes each active edge by up to 4px.
  /// When both sides animate, each edge uses the full delta independently.
  this.fixedPulseDelta = 4,
}) : assert(
       (flexWeights != null && itemExtent == null && itemExtents == null) ||
           (flexWeights == null &&
               itemExtent != null &&
               itemExtents == null) ||
           (flexWeights == null && itemExtent == null && itemExtents != null),
       'Provide itemExtent, flexWeights, or itemExtents.',
     );