Gallery constructor

const Gallery({
  1. Key? key,
  2. required int initialIndex,
  3. required int dismissDragDistance,
  4. required Axis scrollDirection,
  5. required Color backgroundColor,
  6. required double opacity,
  7. required bool dragEnabled,
  8. required bool panEnabled,
  9. required bool zoomEnabled,
  10. required void setBackgroundOpacity(
    1. double
    ),
  11. required bool useSafeArea,
  12. bool? reverseDirection,
  13. int? itemCount,
  14. IndexedWidgetBuilder? itemBuilder,
  15. List<Widget>? children,
  16. int? transitionDuration,
  17. PageController? controller,
  18. void onSwipe(
    1. int
    )?,
  19. List<ImageGalleryHeroProperties>? heroProperties,
})

Implementation

const Gallery({
  super.key,
  required this.initialIndex,
  required this.dismissDragDistance,
  required this.scrollDirection,
  required this.backgroundColor,
  required this.opacity,
  required this.dragEnabled,
  required this.panEnabled,
  required this.zoomEnabled,
  required this.setBackgroundOpacity,
  required this.useSafeArea,
  this.reverseDirection,
  this.itemCount,
  this.itemBuilder,
  this.children,
  this.transitionDuration,
  this.controller,
  this.onSwipe,
  this.heroProperties,
})  : assert(
        (children != null &&
                children.length > 0 &&
                itemCount == null &&
                itemBuilder == null) ||
            (itemCount != null &&
                itemCount > 0 &&
                itemBuilder != null &&
                children == null),
      ),
      assert(
        (heroProperties != null &&
                heroProperties.length == (children?.length ?? itemCount)) ||
            heroProperties == null,
      );