showDebugger method

void showDebugger(
  1. BuildContext context
)

显示浮窗

Implementation

void showDebugger(BuildContext context) async {
  if (_appContext == null) {
    _appContext = context;
    //find root context
    context.visitAncestorElements((element) {
      if (element.depth == 1) {
        _appContext = element;
        return false;
      }
      return true;
    });
    if (!appContext.isCompleted) {
      appContext.complete(_appContext);
    }
  }

  _debuggerOverlay?.remove();
  _debuggerOverlay = OverlayEntry(
    builder: (context) {
      return FloatingButtonWidget();
    },
  );
  // OverlayState? rootOverlay = await findRootOverlay();
  final a = Get.global(null);
  a.currentState?.overlay?.insert(_debuggerOverlay!);
  // rootOverlay?.insert(_debuggerOverlay!);
}