getGestureWrapper method

Widget getGestureWrapper(
  1. Widget child
)

Implementation

Widget getGestureWrapper(Widget child) {
  Widget wrapper;
  if (widget.options.height != null) {
    wrapper = Container(height: widget.options.height, child: child);
  } else {
    wrapper = AspectRatio(aspectRatio: widget.options.aspectRatio, child: child);
  }

  return RawGestureDetector(
    gestures: {
      _MultipleGestureRecognizer: GestureRecognizerFactoryWithHandlers<_MultipleGestureRecognizer>(() => _MultipleGestureRecognizer(), (_MultipleGestureRecognizer instance) {
        instance.onStart = (_) {
          onStart();
        };
        instance.onDown = (_) {
          onPanDown();
        };
        instance.onEnd = (_) {
          onPanUp();
        };
        instance.onCancel = () {
          onPanUp();
        };
      }),
    },
    child: NotificationListener(
      onNotification: (Notification notification) {
        if (widget.options.onScrolled != null && notification is ScrollUpdateNotification) {
          widget.options.onScrolled!(carouselState!.pageController!.page);
        }
        return false;
      },
      child: wrapper,
    ),
  );
}