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 overlays = <OverlayEntry>[];

  if (toastMessageBar.blockBackgroundInteraction) {
    overlays.add(
      OverlayEntry(
          builder: (BuildContext context) {
            return Listener(
              onPointerDown: toastMessageBar.isDismissible
                  ? (_) => toastMessageBar.dismiss()
                  : null,
              child: _createBackgroundOverlay(),
            );
          },
          maintainState: false,
          opaque: opaque),
    );
  }

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

  return overlays;
}