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() {
  final List<OverlayEntry> overlays = [];

  if (snackbar!.blockBackgroundInteraction!) {
    overlays.add(
      OverlayEntry(
          builder: (BuildContext context) {
            return GestureDetector(
              child: _createBackgroundOverlay(),
            );
          },
          maintainState: false,
          opaque: opaque),
    );
  }

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

  return overlays;
}