TourController class

Controller for managing the onboarding tour lifecycle.

Create an instance with your steps and context, then call start to begin the tour. The controller handles step navigation, overlay management, and callbacks.

Constructors

TourController({required BuildContext context, required List<TourStep> steps, VoidCallback? onComplete, VoidCallback? onSkip, dynamic onStepChange(int stepIndex, TourStep step)?, Duration? startDelay, String? persistenceKey, Color overlayColor = const Color.fromRGBO(0, 0, 0, 0.7), bool dismissOnBarrierTap = false})

Properties

context BuildContext
BuildContext for overlay insertion
final
currentStep TourStep?
Current step being displayed
no setter
currentStepIndex int
Current step index (0-based)
no setter
dismissOnBarrierTap bool
Whether to dismiss the tour when tapping outside
final
hashCode int
The hash code for this object.
no setterinherited
isRunning bool
Whether the tour is currently running
no setter
onComplete VoidCallback?
Called when the tour is completed (user finishes last step)
final
onSkip VoidCallback?
Called when the tour is skipped
final
onStepChange → dynamic Function(int stepIndex, TourStep step)?
Called when the step changes
final
overlayColor Color
Overlay color for the spotlight background
final
persistenceKey String?
Key for persisting tour completion state If set, user's completion status is saved and can be checked
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startDelay Duration?
Delay before starting the tour (useful for letting UI settle)
final
steps List<TourStep>
List of tour steps to display
final
totalSteps int
Total number of steps
no setter

Methods

end() → void
End the tour (alias for skip, but indicates completion)
goToStep(int stepIndex) → void
Go to a specific step by index
hasCompletedTour() Future<bool>
Check if the tour has been completed before (requires persistenceKey)
next() → void
Move to the next step
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
previous() → void
Move to the previous step
resetTourState() Future<void>
Reset the tour completion state
skip() → void
Skip the tour entirely
start() Future<void>
Start the tour from the beginning
startFrom(int stepIndex) Future<void>
Start the tour from a specific step
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited