AnchoredOverlay constructor

AnchoredOverlay({
  1. Key? key,
  2. required MutableLiveData<bool> show,
  3. Duration hideDelay = Duration.zero,
  4. bool barrierDismissible = true,
  5. bool interceptPointer = true,
  6. required List<Widget> entries,
  7. required Widget child,
})

Implementation

AnchoredOverlay({
  super.key,
  required this.show,
  this.hideDelay = Duration.zero,
  bool barrierDismissible = true,
  bool interceptPointer = true,
  required List<Widget> entries,
  required this.child,
}) : overlayBuilder = ((context, anchor, overlay) {
        final content = Material(
            type: MaterialType.transparency,
            child: SizedBox.expand(
              child: Stack(alignment: Alignment.center, children: [
                if (barrierDismissible)
                  Positioned.fill(
                      child: GestureDetector(
                          behavior: HitTestBehavior.translucent,
                          onTapUp: (event) => anchor.contains(event.globalPosition) ? show.value = false : null,
                          onTapDown: (event) => anchor.contains(event.globalPosition) ? null : show.value = false)),
                ...entries,
              ]),
            ));
        return AnchoredOverlayData._(
            anchor: anchor, overlay: overlay, child: interceptPointer ? PointerInterceptor(child: content) : content);
      });