showSkipConfirmation method

Future<void> showSkipConfirmation()

Implementation

Future<void> showSkipConfirmation() async {
  if (_context == null) return;

  _removeTooltip();
  await spotlight.hide();
  _isSkipSheetOpen = true;

  final bool? shouldSkip = await showModalBottomSheet<bool>(
    context: _context!,
    isScrollControlled: true,
    builder: (context) => OnboardingSkipSheet(
      title: _skipSheetTitle,
      continueButtonText: _skipSheetContinueButtonText,
      skipButtonText: _skipSheetSkipButtonText,
    ),
  );

  _isSkipSheetOpen = false;

  if (!_isActive) return;

  if (shouldSkip == true) {
    _onSkip?.call();
    _cleanup();
  } else {
    final frame = Completer<void>();
    WidgetsBinding.instance.addPostFrameCallback((_) => frame.complete());
    await frame.future;

    _currentTargetRect = await _waitForTargetRect(
      currentStep.targetKey,
      maxFrames: 60,
    );
    if (_currentTargetRect == null) {
      _log(
        'showSkipConfirmation(): target not ready after cancel skip, waiting asynchronously',
      );
      _waitForTargetAndShow();
      return;
    }
    _insertTooltipOverlay();
    await _refreshSpotlight();
  }
}