createOverlayEntries method

  1. @override
Iterable<OverlayEntry> createOverlayEntries()
override

Subclasses should override this getter to return the builders for the overlay.

Implementation

@override
Iterable<OverlayEntry> createOverlayEntries() {
  var overlays = <OverlayEntry>[];

  if (snack.overlayBlur > 0.0) {
    overlays.add(
      OverlayEntry(
        builder: (context) {
          return GestureDetector(
            onTap: snack.isDismissible ? Get.back : null,
            child: AnimatedBuilder(
              animation: _filterBlurAnimation,
              builder: (context, child) {
                return BackdropFilter(
                  filter: ImageFilter.blur(
                      sigmaX: _filterBlurAnimation.value,
                      sigmaY: _filterBlurAnimation.value),
                  child: Container(
                    constraints: BoxConstraints.expand(),
                    color: _filterColorAnimation.value,
                  ),
                );
              },
            ),
          );
        },
        maintainState: false,
        opaque: opaque,
      ),
    );
  }

  overlays.add(
    OverlayEntry(
      builder: (context) {
        final Widget annotatedChild = Semantics(
          child: AlignTransition(
            alignment: _animation,
            child: snack.isDismissible
                ? _getDismissibleSnack(_builder)
                : _getSnack(),
          ),
          focused: false,
          container: true,
          explicitChildNodes: true,
        );
        return annotatedChild;
      },
      maintainState: false,
      opaque: opaque,
    ),
  );

  return overlays;
}