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 (flushbar.blockBackgroundInteraction) {
    overlays.add(
      OverlayEntry(
          builder: (BuildContext context) {
            return Listener(
              onPointerDown:
                  flushbar.isDismissible ? (_) => flushbar.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: flushbar.isDismissible
                  ? _getDismissibleFlushbar(_builder)
                  : _getFlushbar(),
            ),
          );
          return annotatedChild;
        },
        maintainState: false,
        opaque: opaque),
  );

  return overlays;
}