show<T> method

Future<T?> show<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. required AlignmentGeometry alignment,
  4. AlignmentGeometry? anchorAlignment,
  5. PopoverConstraint widthConstraint = PopoverConstraint.flexible,
  6. PopoverConstraint heightConstraint = PopoverConstraint.flexible,
  7. bool modal = true,
  8. bool closeOthers = true,
  9. Offset? offset,
  10. GlobalKey<OverlayHandlerStateMixin<StatefulWidget>>? key,
  11. Object? regionGroupId,
  12. AlignmentGeometry? transitionAlignment,
  13. bool consumeOutsideTaps = true,
  14. EdgeInsetsGeometry? margin,
  15. ValueChanged<PopoverAnchorState>? onTickFollow,
  16. bool follow = true,
  17. bool allowInvertHorizontal = true,
  18. bool allowInvertVertical = true,
  19. bool dismissBackdropFocus = true,
  20. Duration? showDuration,
  21. Duration? hideDuration,
  22. OverlayBarrier? overlayBarrier,
  23. OverlayHandler? handler,
})

Implementation

Future<T?> show<T>({
  required BuildContext context,
  required WidgetBuilder builder,
  required AlignmentGeometry alignment,
  AlignmentGeometry? anchorAlignment,
  PopoverConstraint widthConstraint = PopoverConstraint.flexible,
  PopoverConstraint heightConstraint = PopoverConstraint.flexible,
  bool modal = true,
  bool closeOthers = true,
  Offset? offset,
  GlobalKey<OverlayHandlerStateMixin>? key,
  Object? regionGroupId,
  AlignmentGeometry? transitionAlignment,
  bool consumeOutsideTaps = true,
  EdgeInsetsGeometry? margin,
  ValueChanged<PopoverAnchorState>? onTickFollow,
  bool follow = true,
  bool allowInvertHorizontal = true,
  bool allowInvertVertical = true,
  bool dismissBackdropFocus = true,
  Duration? showDuration,
  Duration? hideDuration,
  OverlayBarrier? overlayBarrier,
  OverlayHandler? handler,
}) async {
  if (closeOthers) {
    close();
  }
  builder = Pylon.mirror(context, builder);
  key ??= GlobalKey<OverlayHandlerStateMixin>(
      debugLabel: 'PopoverAnchor$hashCode');

  OverlayCompleter<T?> res = showPopover<T>(
    context: context,
    alignment: alignment,
    anchorAlignment: anchorAlignment,
    builder: builder,
    modal: modal,
    widthConstraint: widthConstraint,
    heightConstraint: heightConstraint,
    key: key,
    regionGroupId: regionGroupId,
    offset: offset,
    transitionAlignment: transitionAlignment,
    consumeOutsideTaps: consumeOutsideTaps,
    margin: margin,
    onTickFollow: onTickFollow,
    follow: follow,
    allowInvertHorizontal: allowInvertHorizontal,
    allowInvertVertical: allowInvertVertical,
    dismissBackdropFocus: dismissBackdropFocus,
    showDuration: showDuration,
    dismissDuration: hideDuration,
    overlayBarrier: overlayBarrier,
    handler: handler,
  );
  var popover = Popover._(
    key,
    res,
  );
  _openPopovers.add(popover);
  notifyListeners();
  await res.future;
  _openPopovers.remove(popover);
  if (!_disposed) {
    notifyListeners();
  }
  return res.future;
}