show method
Implementation
void show({
Rect? rect,
GlobalKey? widgetKey,
}) {
assert(rect != null || widgetKey != null,
"'rect' and 'key' can't be both null");
final attachRect = rect ?? getWidgetGlobalRect(widgetKey!);
if (config.type == MenuType.grid) {
menuLayout = GridMenuLayout(
config: config,
items: this.items,
onDismiss: dismiss,
context: context,
onClickMenu: onClickMenu,
);
} else if (config.type == MenuType.list) {
menuLayout = ListMenuLayout(
config: config,
items: items,
onDismiss: dismiss,
context: context,
onClickMenu: onClickMenu,
);
}
_LayoutP layoutp = _calculateOffset(
context,
attachRect,
menuLayout!.width,
menuLayout!.height,
);
_entry = OverlayEntry(builder: (context) {
return build(layoutp, menuLayout!);
});
Overlay.of(context)!.insert(_entry!);
_isShow = true;
onShow?.call();
}