show static method

void show({
  1. required BuildContext context,
  2. required Widget child,
  3. double? top,
  4. double? left,
  5. double? bottom,
  6. double? right,
})

Func

Implementation

static void show({
  required BuildContext context,
  required Widget child,
  double? top,
  double? left,
  double? bottom,
  double? right,
}) {
  // 如果已存在,先移除
  _entry?.remove();
  _entry = OverlayEntry(
    builder: (_) => Positioned(top: top, left: left, right: right, bottom: bottom, child: child),
  );
  if (context.mounted && _entry != null) {
    Overlay.of(context).insert(_entry!);
  }
}