showPopoverArrowed static method
void
showPopoverArrowed({
- required GlobalKey<
State< key,StatefulWidget> > - required BuildContext context,
- required GlobalKey<
State< anchorKey,StatefulWidget> > - bool isAnimated = false,
- bool isTranslucent = false,
- Function? onHide,
- required Widget child,
Implementation
static void showPopoverArrowed({
required GlobalKey key,
required BuildContext context,
required GlobalKey anchorKey,
bool isAnimated = false,
bool isTranslucent = false,
Function? onHide,
required Widget child,
}) {
if (_activePopoverKeys.containsKey(anchorKey)) {
moveDraggableToTop(context, anchorKey);
return;
}
_activePopoverKeys[anchorKey] = key;
OverlayEntry? overlayEntry;
overlayEntry = OverlayEntry(
builder: (BuildContext context) => CDKDialogPopoverArrowed(
key: key,
anchorKey: anchorKey,
isAnimated: isAnimated,
isTranslucent: isTranslucent,
onHide: () {
onHide?.call();
overlayEntry?.remove();
_activePopoverKeys.remove(anchorKey);
// Close all other popovers
while (_activePopoverKeys.isNotEmpty) {
var refKey = _activePopoverKeys.values.first;
var state = refKey.currentState as CDKDialogPopoverState;
state.hide();
}
},
child: child,
),
);
_activeDraggableEntries[anchorKey] = overlayEntry;
// Insereix l'OverlayEntry en l'overlay
Overlay.of(context).insert(overlayEntry);
}