getChildBasedOnDissmiss method

Widget getChildBasedOnDissmiss(
  1. Widget child
)

Implementation

Widget getChildBasedOnDissmiss(Widget child) {
  return Animate(
    onComplete: (controller) {
      if (widget.autoDismiss) {
        widget.onRemove();
      }
    },
    effects: [
      SlideEffect(
          begin: Offset(
              0,
              widget.snackbarPosition == DelightSnackbarPosition.bottom
                  ? 2
                  : -2),
          end: Offset.zero,
          duration: Duration(
              milliseconds: 2 * widget.animationDuration.inMilliseconds),
          curve: widget.animationCurve ?? Curves.elasticOut),
      FadeEffect(duration: widget.animationDuration, begin: 0, end: 1),
      if (widget.autoDismiss)
        SlideEffect(
          delay: widget.snackbarDuration,
          duration: const Duration(milliseconds: 500),
          curve: widget.animationCurve ?? Curves.easeInOut,
          begin: Offset.zero,
          end: const Offset(-1, 0),
        )
    ],
    child: Dismissible(
        key: UniqueKey(),
        onDismissed: (direction) {
          widget.onRemove();
        },
        child: widget.child),
  );
}