showDropdown<T> function
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,
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),
);
},
);
}