goToStep method
Go to the given stepNumber step disposing the current step only if needed.
The betweenStepCallback is called with the second paramenter as reverse (the second parameter of this methos)
Implementation
Future goToStep(int stepNumber, {bool reverse = false, InsertOverlayCallback? insertOverlay}) async {
if (log) _log('Going to step: $stepNumber');
if (_entry != null) {
final Duration _fadeDuration = (_entry as ZwapTutorialOverlayEntry).fadeOutDuration;
_entry!.remove();
await Future.delayed(_fadeDuration);
}
_currentStep = stepNumber;
if (betweenStepCallback != null) await betweenStepCallback!(_currentStep!, reverse);
final ZwapTutorialStep _nextStep = steps[_currentStep!];
_entry = ZwapTutorialOverlayEntry(
uniqueKey: GlobalKey(),
builder: (_) => ZwapComplexTutorialWidget(
log: log,
index: _currentStep!,
stepsCount: steps.length,
focusWidgetKey: _focusWidgetKeys[_currentStep!],
blurRegion: _blurRegionKeys[_currentStep!],
child: _nextStep.content,
backgroundColor: _nextStep.backgroundColor,
height: _nextStep.height,
onBack: _currentStep == 0 ? null : back,
onClose: () {
if (_nextStep.onClose != null) _nextStep.onClose!();
end();
},
onForward: _currentStep! + 1 == steps.length ? end : forward,
overlayOffset: _nextStep.overlayOffset,
showBack: _nextStep.showBack && _currentStep != 0,
showSkip: _nextStep.showSkip,
showEnd: _currentStep! + 1 == steps.length,
width: _nextStep.width,
focusWidgetWrapper: _nextStep.focusWidgetWrapper,
decorationDirection: _nextStep.decorationDirection,
decorationTranslation: _nextStep.decorationTranslation,
),
);
_insertOverlay(_entry!, insertOverlay);
}