showDropdown<T> function

OverlayCompleter<T?> showDropdown<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. Offset? position,
  4. AlignmentGeometry? anchorAlignment,
  5. PopoverConstraint widthConstraint = PopoverConstraint.flexible,
  6. PopoverConstraint heightConstraint = PopoverConstraint.flexible,
  7. Key? key,
  8. bool rootOverlay = true,
  9. bool modal = true,
  10. Clip clipBehavior = Clip.none,
  11. Object? regionGroupId,
  12. Offset? offset,
  13. AlignmentGeometry? transitionAlignment,
  14. EdgeInsetsGeometry? margin,
  15. bool follow = true,
  16. bool consumeOutsideTaps = false,
  17. ValueChanged<PopoverAnchorState>? onTickFollow,
  18. bool allowInvertHorizontal = true,
  19. bool allowInvertVertical = true,
  20. bool dismissBackdropFocus = true,
  21. Duration? showDuration,
  22. Duration? dismissDuration,
})

Implementation

OverlayCompleter<T?> showDropdown<T>({
  required BuildContext context,
  required WidgetBuilder builder,
  Offset? position,
  AlignmentGeometry? anchorAlignment,
  PopoverConstraint widthConstraint = PopoverConstraint.flexible,
  PopoverConstraint heightConstraint = PopoverConstraint.flexible,
  Key? key,
  bool rootOverlay = true,
  bool modal = true,
  Clip clipBehavior = Clip.none,
  Object? regionGroupId,
  Offset? offset,
  AlignmentGeometry? transitionAlignment,
  EdgeInsetsGeometry? margin,
  bool follow = true,
  bool consumeOutsideTaps = false,
  ValueChanged<PopoverAnchorState>? onTickFollow,
  bool allowInvertHorizontal = true,
  bool allowInvertVertical = true,
  bool dismissBackdropFocus = true,
  Duration? showDuration,
  Duration? dismissDuration,
}) {
  final theme = Theme.of(context);
  final scaling = theme.scaling;
  final GlobalKey key = GlobalKey();
  final overlayManager = OverlayManager.of(context);
  return overlayManager.showMenu<T>(
    context: context,
    alignment: Alignment.topCenter,
    offset: offset ?? (const Offset(0, 4) * scaling),
    follow: follow,
    clipBehavior: clipBehavior,
    margin: margin,
    transitionAlignment: transitionAlignment,
    onTickFollow: onTickFollow,
    allowInvertHorizontal: allowInvertHorizontal,
    allowInvertVertical: allowInvertVertical,
    showDuration: showDuration,
    dismissDuration: dismissDuration,
    widthConstraint: widthConstraint,
    heightConstraint: heightConstraint,
    position: position,
    anchorAlignment: anchorAlignment,
    consumeOutsideTaps: consumeOutsideTaps,
    regionGroupId: key,
    modal: modal,
    dismissBackdropFocus: dismissBackdropFocus,
    overlayBarrier: OverlayBarrier(
      borderRadius: BorderRadius.circular(theme.radiusMd),
    ),
    builder: (context) {
      return Data.inherit(
        data: DropdownMenuData(key),
        child: builder(context),
      );
    },
  );
}