createOverlay method

void createOverlay(
  1. TutorialStep tutorialStep
)

Implementation

void createOverlay(TutorialStep tutorialStep) {
  (BuildContext, NavigatorState)? contextAndState = getCurrentContextAndState();
  if (contextAndState == null) return;

  BuildContext context = contextAndState.$1;
  NavigatorState state = contextAndState.$2;

  OverlayContent? content = switch (tutorialStep) {
    WidgetHighlightTutorialStep whtStep => createHighlightOverlayContent(context, whtStep),
    PlainTextTutorialStep pttStep => createTextOverlayContent(context, pttStep),
    _ => null
  };

  if (content != null) {
    overlayEntry = OverlayEntry(
      builder: (BuildContext context) => buildOverlayContent(context, content),
    );

    state.overlay?.insert(overlayEntry!);
  }
}