show static method
Presents a dropdown menu anchored below the widget that owns context.
The menu is positioned using the RenderBox of the trigger so it appears directly beneath the caller's bottom-right corner.
Implementation
static void show({
required BuildContext context,
required List<DraftModeUIDropDownMenuItem> items,
}) {
dismiss();
final renderBox = context.findRenderObject()! as RenderBox;
final position = renderBox.localToGlobal(Offset.zero);
final size = renderBox.size;
// Capture theme from caller context before entering overlay.
final theme = DraftModeUITheme.maybeOf(context);
final overlay = Navigator.of(context).overlay!;
final entry = OverlayEntry(
builder: (_) => _DraftModeUIDropDownMenuOverlay(
anchorLeft: position.dx,
anchorRight: position.dx + size.width,
anchorTop: position.dy + size.height,
anchorBottom: position.dy,
items: items,
onDismissed: dismiss,
navigatorContext: context,
theme: theme,
animationDuration:
theme?.animationDurationFast ?? const Duration(milliseconds: 150),
animationCurve: theme?.animationCurve ?? Curves.easeInOut,
),
);
_current = entry;
overlay.insert(entry);
}