captureHints static method

List<OverlayRouteHint> captureHints()

Implementation

static List<OverlayRouteHint> captureHints() {
  _routes.removeWhere((ref) => ref.target == null);
  final hints = <OverlayRouteHint>[];
  for (final ref in _routes) {
    final route = ref.target;
    // An active popup may remain underneath a subsequently pushed page.
    // Its fullscreen bounds must not be matched to that page's semantics.
    if (route == null || !route.isCurrent || route.offstage) continue;
    final context = route.subtreeContext;
    if (context == null || !context.mounted) continue;
    final render = context.findRenderObject();
    if (render is! RenderBox || !render.attached || !render.hasSize) continue;
    final bounds = MatrixUtils.transformRect(
      render.getTransformTo(null),
      Offset.zero & render.size,
    );
    hints.add(OverlayRouteHint(
      route is ModalBottomSheetRoute
          ? 'sheet'
          : route is RawDialogRoute
              ? 'dialog'
              : 'menu',
      bounds,
      route.settings.name ?? '',
    ));
  }
  return hints;
}