show static method
dynamic
show(
- BuildContext context, {
- required Widget child,
- GlobalKey<
State< ? tapWidgetKey,StatefulWidget> > - double? dx,
Implementation
static show(
BuildContext context, {
required Widget child,
GlobalKey? tapWidgetKey,
double? dx,
}) {
Offset? offset;
if (tapWidgetKey != null) {
final renderObject = tapWidgetKey.currentContext?.findRenderObject();
if (renderObject != null && renderObject is RenderBox) {
//获得控件正下方的坐标
offset = renderObject.localToGlobal(Offset(dx ?? 0.0, renderObject.size.height));
}
}
if (offset != null) {
_entry = OverlayEntry(
builder: (BuildContext context) => XFloatContent(
child: child,
offset: offset,
));
}
if (_entry != null) Overlay.of(context)?.insert(_entry!);
}