showcase_tutorial 2.1.0
showcase_tutorial: ^2.1.0 copied to clipboard
A Flutter package to Showcase/Highlight widgets step by step.
showcase_tutorial #
A Flutter package for building step-by-step product tours and feature discovery. Highlight any widget on screen, dim everything else, and show an auto-positioned tooltip that walks the user from one feature to the next — ideal for onboarding, "what's new" tours, and contextual help.
It works with a single widget you wrap your screen in, plus one Showcase per
target. No state management, no boilerplate: drive the whole tour through a small
controller API.
Preview #
One app, one tour, recorded on an Android phone. In about half a minute it shows:
- the tour starting by itself the first time the app opens;
- an exact-shape highlight (the round profile picture);
- two widgets in one step (the flight and the hotel);
- auto-scroll to a step below the fold, with a pulse ring;
- a step that continues on the next screen when you tap its target, and ends in a custom tooltip;
- progress dots, Skip, a floating End tour button, and a highlight that glides between steps;
- dark mode and Arabic (right-to-left) with translated buttons.
Nothing in it sets a colour: the tour takes them from the app's theme. Its
settings menu also turns on auto-play, a blurred background, and buttons below
the tooltip, and closing the offer banner skips its step. The code is
example/lib/trips_demo.dart,
and you can run it on its own with
flutter run -t lib/trips_demo_main.dart from example/.
Features #
- Step-by-step highlighting of any widget with an auto-positioned tooltip.
- Default tooltip (title + description) or a fully custom tooltip widget.
- Tooltip on any side — top / bottom / left / right — with full RTL support.
- Exact-shape highlight — hug a widget's actual painted shape (circle, pill,
star, icon, logo) automatically with
highlightExactShape. - Pulsing highlight ring — an optional animated ring that pings around the target to draw the eye.
- Animated step transitions — the highlight glides from one target to the next instead of cutting.
- Tooltip & highlight styling — custom arrow color/size, a colored border around the target, custom scrim color and opacity.
- Highlight multiple widgets in one step (e.g. a multi-select control).
- Matches your app — the tooltip, text, buttons and dimmed background take their colours from your theme, in light and dark mode, with nothing to set.
- Global styling with
ShowcaseStyle— set any colour once, not per step. - Built-in action buttons (Next / Previous / Stop) with customizable text, icons, and layout.
- Translate the tour once — give every button its text in one place with
ShowcaseLabels. - Built-in progress indicator (dots or a
1/6counter) and a Skip button in the default tooltip. - Floating action widget — a screen-anchored control (e.g. a fixed Skip / Next button) shown per step or tour-wide.
- Auto-play, auto-scroll to off-screen targets, and background blur.
- Programmatic control:
next(),previous(),goTo(),goToKey(),dismiss(), plus live progress (currentIndex,totalSteps), and adelayto start the tour after a screen settles. - Conditional / branching tours — let a step decide the next step at runtime
with
onResolveNextStep. - Prepare a step before it shows —
onBeforeStepis awaited before each step, to scroll, load data or open its page first. - Back button — choose whether back closes the page, ends the tour, goes to the previous step or does nothing while a step shows.
- Lifecycle callbacks — per-step (
onShow/onDismiss) and tour-level (onStart/onComplete/onFinish, plusonDismissfor early close), and configurable background-tap behavior (tour-wide or per step). - Introspection — register/unregister step, finish and dismiss listeners at runtime, track the
highlighted target's bounds with
onTargetRectUpdate, and check whether a step's target is on screen withisTargetRendered. - Run the tour only once for onboarding, resume it where the user left off, and auto-skip steps whose target isn't on screen.
- Accessibility built in — keyboard navigation (Esc / arrows / Enter) and screen-reader announcements.
- Web / desktop polish — a click cursor on the parts of the tour that react to a click, with per-step overrides.
- Target interaction callbacks: tap, double-tap, long-press.
- Enable/disable the whole tour with a single flag.
What's new in 2.1.0 #
| Feature | What you get |
|---|---|
| Coming from showcaseview / tutorial_coach_mark | Guides that map each of their APIs to this package, with before/after code. |
| Back button | backButtonInteraction decides what the system back button does while a step shows: leave it alone, end the tour, go back a step, or block it. |
| Prepare a step before it shows | onBeforeStep is awaited before each step, to scroll, load or open a page first. |
| Programmatic control | startShowCase(keys, delay: ...) with cancelDelayedStart(), and listeners for a tour that finishes or is dismissed. |
| Per-step and tour-wide options | Showcase.enableAutoScroll, Showcase.onBarrierClick, ShowcaseStyle.overlayOpacity, and a text direction for the title and the description. |
What's new in 2.0.0 #
| Feature | What you get |
|---|---|
| Colours from your theme | The tooltip, text, buttons and dimmed background follow your app's colour scheme, in light and dark mode, with nothing to set. Every colour can still be set, once, in ShowcaseStyle. |
| Translating the tour | ShowCaseWidget.labels sets the text of the built-in Next / Previous / Stop / Skip buttons in one place. |
| Right-to-left buttons | The built-in buttons follow your app's direction, and their labels never break mid-word. |
| Resume where the user left off | startShowCase(keys, startAt: savedIndex) opens the tour on a saved step. |
2.0.0 changes how the tour looks and has a few small API changes. See Migrating from 1.x to 2.0.
Migrating from 1.x to 2.0 #
Most apps upgrade by changing one line. Nothing was removed, and code that compiled on 1.x compiles on 2.0, except for the rare cases under step 4.
1. Update the dependency.
dependencies:
showcase_tutorial: ^2.0.0
2.0 needs Flutter 3.47 or newer, the same as 1.15.2 and later.
2. Check how the tour looks. Colours you didn't set now come from your app's theme instead of being fixed (white tooltip, black text, light blue buttons). Colours you did set are unchanged, and text on them is kept readable. If you want the 1.x look back, set it once:
ShowCaseWidget(
style: const ShowcaseStyle(
tooltipBackgroundColor: Colors.white,
textColor: Colors.black,
actionTextColor: Color(0xff48cae4),
actionDividerColor: Color(0xffcaf0f8),
),
builder: const HomePage(),
);
An app with no material_ui theme (for example, one still on MaterialApp
from package:flutter/material.dart) keeps the 1.x colours without this.
Also new in how the built-in buttons look:
- In a right-to-left app, each button's icon now sits on the right of its
label. To keep the 1.x order, pass
textDirection: TextDirection.ltrto that button'sActionButtonConfig. - Box behind buttons placed outside the tooltip:
ActionsSettings.containerColornow defaults to the tooltip's colour, not white. PassColors.transparentfor no box. - Labels stay on one line. A tooltip with the built-in buttons may be a little wider so its labels fit.
3. Replace what's deprecated. These still work in 2.0 and are removed in 3.0.0. Your IDE flags them:
| 1.x | 2.0 |
|---|---|
skipButtonText: 'Skip tour' |
labels: const ShowcaseLabels(skip: 'Skip tour') |
disableBarrierInteraction: true |
barrierInteraction: BarrierInteraction.none |
ShowcaseLabels also sets the Next, Previous and Stop labels, so you can drop
the same text: repeated on every ActionButtonConfig. See
Translating the tour.
4. Code that reads these properties back. Passing values is unchanged. Only code that reads one of these from a widget, rather than passing it in, may need a small change:
| Property | 1.x type | 2.0 type |
|---|---|---|
Showcase.overlayColor |
Color |
Color? |
Showcase.scrollLoadingWidget |
Widget |
Widget? |
ActionButtonConfig.textColor |
Color |
Color? |
ActionButtonConfig.textDirection |
TextDirection |
TextDirection? |
ShowCaseDefaultActions.verticalDividerColor |
Color |
Color? |
ShowCaseWidget.skipButtonText |
String |
String? (deprecated) |
ShowCaseWidget.onStart / onComplete |
Function(int?, GlobalKey)? |
ShowcaseStepCallback? |
ShowCaseWidget.builder |
Builder |
Widget |
5. Optional clean-ups.
builder: Builder(builder: (context) => const HomePage())can becomebuilder: const HomePage().- Colours you set on every step can move to
ShowcaseStyle, which now covers every colour (overlayColor,actionTextColor,actionDividerColor,loadingIndicatorColorare new). - If you saved progress yourself to resume a tour, use
startShowCase(keys, startAt: savedIndex).
Coming from showcaseview #
This package started as a fork of
showcaseview and keeps its shape:
a Showcase around each target, identified by a GlobalKey, and a tour you
start with startShowCase, then drive with next(), previous() and
dismiss(). Most Showcase parameters have the same names, so most of a
switch is setup and action buttons. This section maps showcaseview 5.x to
this package.
Before you switch: this package needs Flutter 3.47 or newer and is built on
material_ui. See the Requirements note.
1. Setup: wrap a widget instead of registering.
// showcaseview 5.x
@override
void initState() {
super.initState();
ShowcaseView.register(onFinish: () => debugPrint('Tour finished'));
}
@override
void dispose() {
ShowcaseView.get().unregister();
super.dispose();
}
// showcase_tutorial
ShowCaseWidget(
onFinish: () => debugPrint('Tour finished'),
builder: const HomePage(),
);
There is nothing to unregister: the tour goes away with the widget. For a
tour that spans several screens, put ShowCaseWidget in MaterialApp.builder
(see Tours across screens).
2. Starting and controlling the tour: from a context.
// showcaseview 5.x
ShowcaseView.get().startShowCase([_one, _two, _three]);
// showcase_tutorial: any context below ShowCaseWidget
ShowCaseWidget.of(context).startShowCase([_one, _two, _three]);
3. Steps: mostly unchanged. Showcase(key:, title:, description:, child:) and Showcase.withWidget(container:) work the same way. The
renamed parameters are in the table below.
4. Action buttons: one widget for the row.
// showcaseview 5.x
ShowcaseView.register(
globalTooltipActions: const [
TooltipActionButton(type: TooltipDefaultActionType.previous, name: 'Back'),
TooltipActionButton(type: TooltipDefaultActionType.next),
],
);
// showcase_tutorial
ShowCaseWidget(
globalActions: (context) => const ShowCaseDefaultActions(
previous: ActionButtonConfig(text: 'Back'),
stop: ActionButtonConfig(buttonVisible: false),
),
builder: const HomePage(),
);
To translate the built-in labels once instead of per button, use
labels. For a button of your own (showcaseview's
TooltipActionButton.custom), pass any widget as actions.
API mapping #
| showcaseview 5.x | showcase_tutorial |
|---|---|
ShowcaseView.register(...) |
ShowCaseWidget(...) |
ShowcaseView.get() / getNamed(scope) |
ShowCaseWidget.of(context) (the nearest one) |
unregister() |
not needed |
Showcase(scope: ...) |
a separate ShowCaseWidget for that part of the tree |
startShowCase(keys, delay: d) |
same; an onShouldStartShowcase guard is consulted after the delay |
next(force: true) |
next() |
previous(), dismiss(), completed(key) |
same |
isShowcaseRunning, isTargetRendered(key) |
same |
getActiveShowcaseKey |
ids and currentIndex (the active key is ids![currentIndex!] while a tour runs), plus totalSteps |
addOnStartCallback, addOnCompleteCallback |
same |
addOnFinishCallback, addOnDismissCallback |
same (and the remove… pairs) |
skipIfTargetNotPresent: true |
autoSkipUnmountedSteps: true, or onShouldSkipUnmountedStep per step |
disableBarrierInteraction: true |
barrierInteraction: BarrierInteraction.none (also .dismiss) |
semanticEnable: true |
on by default: enableAutoAnnouncements |
overlayColor (tour-wide) |
style: ShowcaseStyle(overlayColor: ...) |
overlayOpacity (tour-wide) |
style: ShowcaseStyle(overlayOpacity: ...); Showcase.overlayOpacity per step |
globalTooltipActions |
globalActions: (context) => ShowCaseDefaultActions(...) |
globalTooltipActionConfig |
globalActionSettings and actionsPosition |
Showcase.tooltipActions / tooltipActionConfig |
Showcase.actions / actionSettings / actionsPosition |
TooltipActionButton(type: next / previous / skip) |
ShowCaseDefaultActions(next:, previous:, stop:) with ActionButtonConfig |
TooltipActionButton.custom(button: ...) |
any widget as actions |
hideActionWidgetForShowcase (per button) |
hideActionsForShowcase (the whole row) |
FloatingActionWidget(...) |
any widget, positioned with Align / Positioned |
titleTextAlign / descriptionTextAlign |
titleAlignment / descriptionAlignment |
titleTextDirection / descriptionTextDirection |
same |
Showcase.enableAutoScroll (per step) |
same; ShowCaseWidget.enableAutoScroll tour-wide |
Showcase.onBarrierClick (per step) |
same; runs after the tour-wide ShowCaseWidget.onBarrierClick |
toolTipMargin: 14 |
toolTipMargin: EdgeInsets.all(14) |
toolTipSlideEndDistance |
not available |
| no hook before a step | onBeforeStep, awaited before each step shows (see Prepare a step before it shows) |
| no back-button option (back closes the page) | the same by default; backButtonInteraction to dismiss, step back or block instead (see Back button) |
Behaviour that differs #
- A step whose widget isn't on screen. showcaseview ends the tour when it
moves on to one. Here the tour waits on that step until its widget
appears, which is what makes tours across screens
work. Set
autoSkipUnmountedSteps: trueto skip such steps instead. - Colours. showcaseview's tooltip is always white with black text. Here
every colour you don't set comes from your app's theme, including dark
mode (see Colours and your app's theme).
For a white tooltip, set
ShowcaseStyle(tooltipBackgroundColor: Colors.white, textColor: Colors.black). - Keys. In showcaseview 5.x the
GlobalKeyonly names a step. Here it is theShowcasewidget's own key, so use each key on oneShowcase. To highlight several widgets in one step, usekeysandMultiView. - Pages and dialogs on top. A step hides while another page or a dialog covers its page, and comes back when its page is on top again.
- Accessibility. Each step is announced to screen readers by default,
and the tour takes keyboard focus (Esc, arrows, Enter). Turn these off
with
enableAutoAnnouncements: falseandenableKeyboardNavigation: false. - Spacing defaults. The gap between target and tooltip is 0 here, against
10 in showcaseview. Set
targetTooltipGap: 10for the same spacing.
Coming from tutorial_coach_mark #
tutorial_coach_mark builds
a tutorial from a list: you tag each widget with a GlobalKey, describe it
in a TargetFocus, and call show(). Here each target is wrapped in a
Showcase instead, and a ShowCaseWidget above the screen runs the tour.
This section maps tutorial_coach_mark 1.3.4 to this package.
Before you switch: this package needs Flutter 3.47 or newer and is built on
material_ui. See the Requirements note.
1. Setup: wrap the targets instead of listing them.
// tutorial_coach_mark 1.3.4
final menuKey = GlobalKey();
final searchKey = GlobalKey();
void showTutorial(BuildContext context) {
TutorialCoachMark(
targets: [
TargetFocus(
identify: 'menu',
keyTarget: menuKey,
contents: [TargetContent(align: ContentAlign.bottom, child: const Text('Open the menu'))],
),
TargetFocus(
identify: 'search',
keyTarget: searchKey,
shape: ShapeLightFocus.RRect,
radius: 8,
contents: [TargetContent(align: ContentAlign.top, child: const Text('Search here'))],
),
],
colorShadow: Colors.black,
opacityShadow: 0.8,
onFinish: () => debugPrint('Tutorial finished'),
).show(context: context);
}
// In the page, the key goes on the widget itself.
IconButton(key: menuKey, icon: const Icon(Icons.menu), onPressed: openMenu);
// showcase_tutorial
ShowCaseWidget(
style: const ShowcaseStyle(overlayColor: Colors.black, overlayOpacity: 0.8),
onFinish: () => debugPrint('Tour finished'),
builder: const HomePage(),
);
// In HomePage, the key goes on a Showcase around the widget.
Showcase(
key: menuKey,
description: 'Open the menu',
tooltipPosition: TooltipPosition.bottom,
targetShapeBorder: const CircleBorder(), // tutorial_coach_mark's default shape
child: IconButton(icon: const Icon(Icons.menu), onPressed: openMenu),
);
Showcase(
key: searchKey,
description: 'Search here',
tooltipPosition: TooltipPosition.top,
targetBorderRadius: BorderRadius.circular(8),
child: const SearchField(),
);
The order of the tour is the order of the keys you pass to startShowCase.
For a tutorial that spans several screens, put ShowCaseWidget in
MaterialApp.builder (see Tours across screens).
2. Starting and advancing: from a context.
// tutorial_coach_mark 1.3.4
final tutorial = TutorialCoachMark(targets: targets, initialFocus: 1)
..show(context: context);
tutorial.next();
tutorial.previous();
tutorial.goTo(2);
tutorial.skip();
// showcase_tutorial: any context below ShowCaseWidget
final tour = ShowCaseWidget.of(context)
..startShowCase([menuKey, searchKey, profileKey], startAt: 1);
tour.next();
tour.previous();
tour.goTo(2);
tour.dismiss(); // reports onDismiss, where tutorial_coach_mark calls onSkip
3. Custom content: TargetContent becomes Showcase.withWidget.
// tutorial_coach_mark 1.3.4
TargetFocus(
keyTarget: profileKey,
contents: [
TargetContent(
align: ContentAlign.bottom,
builder: (context, controller) => Column(
children: [
const Text('Your profile'),
TextButton(onPressed: controller.next, child: const Text('Next')),
],
),
),
],
);
// showcase_tutorial, in the page's build method
Showcase.withWidget(
key: profileKey,
tooltipPosition: TooltipPosition.bottom,
container: Column(
children: [
const Text('Your profile'),
TextButton(
onPressed: () => ShowCaseWidget.of(context).next(),
child: const Text('Next'),
),
],
),
child: const ProfileAvatar(),
);
There is no controller argument: the container is built with the rest of
your page, so the page's context reaches the tour. For the built-in
Previous / Next / Stop buttons, use actions.
4. Before a step, and the back button.
// tutorial_coach_mark 1.3.4
TutorialCoachMark(
targets: targets,
beforeFocus: (target) async {
if (target.identify == 'chart') await loadChart();
},
disableBackButton: true,
);
// showcase_tutorial
ShowCaseWidget(
onBeforeStep: (index, key) async {
if (key == chartKey) await loadChart();
},
backButtonInteraction: BackButtonInteraction.block,
builder: const HomePage(),
);
block acts only while a step is on screen. tutorial_coach_mark's
disableBackButton blocks back for the whole tutorial, beforeFocus
included; here back stays live while onBeforeStep runs, while the tour
waits for a step's page, and while a dialog covers the step. See
Prepare a step before it shows and
Back button.
5. The Skip button: opt in.
// showcase_tutorial: in the tooltip
ShowCaseWidget(
showSkip: true,
labels: const ShowcaseLabels(skip: 'SKIP'),
builder: const HomePage(),
);
// or pinned to a corner of the screen, like alignSkip
ShowCaseWidget(
globalFloatingActionWidget: (context) => Align(
alignment: Alignment.bottomRight,
child: SafeArea(
child: TextButton(onPressed: ShowCaseWidget.of(context).dismiss, child: const Text('SKIP')),
),
),
builder: const HomePage(),
);
API mapping #
| tutorial_coach_mark 1.3.4 | showcase_tutorial |
|---|---|
TutorialCoachMark(targets: ...).show(context: context) |
ShowCaseWidget(...) above the screen, then ShowCaseWidget.of(context).startShowCase(keys) |
show(rootOverlay: true), showWithNavigatorStateKey, showWithOverlayState |
ShowCaseWidget in MaterialApp.builder (see Tours across screens) |
TargetFocus(keyTarget: key) |
Showcase(key: key, child: yourWidget) |
TargetFocus(targetPosition: TargetPosition(size, offset)) |
not available: every step wraps a widget. Closest: a Showcase around an empty SizedBox of that size, placed with Positioned in a Stack over the area |
identify |
the step's GlobalKey; onStart, onComplete and onBeforeStep get its index and key |
contents: [TargetContent(child: ...)] |
Showcase(title:, description:), or Showcase.withWidget(container:) |
several TargetContents in one target |
not available: one tooltip per step. Closest: put them in one container (a Column), and pin another block to the screen with floatingActionWidget |
TargetContent(builder: (context, controller) => ...) |
Showcase.withWidget(container: ...), calling ShowCaseWidget.of(context) from your page |
TargetContent(align: ContentAlign.top / bottom / left / right) |
tooltipPosition: TooltipPosition.top / bottom / left / right |
ContentAlign.custom with customPosition |
floatingActionWidget: Positioned(...) (placed on the screen, not by the target) |
TargetContent(padding: ...) |
targetTooltipGap (from the target) and toolTipMargin (from the screen edges) |
shape: ShapeLightFocus.Circle, or shape left unset (a circle) |
targetShapeBorder: const CircleBorder() (the default here is a rounded rectangle) |
shape: ShapeLightFocus.RRect, radius |
targetBorderRadius: BorderRadius.circular(radius) |
borderSide |
highlightBorderColor and highlightBorderWidth |
TargetFocus(color: ...) |
Showcase.overlayColor |
paddingFocus (tour-wide or per target, default 10) |
Showcase.targetPadding, per step, default zero. A rounded-rectangle hole there grows by half of paddingFocus on each side, so EdgeInsets.all(5) gives a similar look |
enableOverlayTab: false (the default) |
barrierInteraction: BarrierInteraction.none, tour-wide or per step |
enableOverlayTab: true |
the default here: BarrierInteraction.next |
enableTargetTab: false |
disposeOnTap: false, onTargetClick: () {} (a target tap then does nothing) |
onClickTarget |
Showcase.onTargetClick with disposeOnTap: false; it replaces the advance, so call next() in it |
onClickTargetWithTapPosition |
not available: onTargetClick gets no position |
onClickOverlay (only with enableOverlayTab: true) |
onBarrierClick tour-wide, Showcase.onBarrierClick per step; both fire on every background tap |
beforeFocus |
onBeforeStep: (index, key) async { ... } |
disableBackButton: true |
backButtonInteraction: BackButtonInteraction.block, which blocks back only while a step is on screen (see Behaviour that differs); also .dismiss and .previous |
initialFocus |
startShowCase(keys, startAt: index) |
onFinish |
onFinish |
onSkip |
onDismiss |
onSkip returning false (go on instead of closing) |
not available. Closest: a skip button of your own in globalFloatingActionWidget that calls next() or dismiss() |
hideSkip: false (the default: Skip shows) |
showSkip: true (off by default) |
textSkip |
labels: ShowcaseLabels(skip: ...) |
alignSkip, skipWidget, textStyleSkip |
your own button in globalFloatingActionWidget, placed with Align |
TargetFocus(alignSkip: ...) |
Showcase.floatingActionWidget for that step |
showSkipInLastTarget: false |
no direct equivalent: the built-in showSkip button shows on every step. Closest: your own skip button in globalFloatingActionWidget, hidden on the last step with hideFloatingActionWidgetForShowcase: [lastKey] |
useSafeArea |
wrap your floating widget in a SafeArea |
colorShadow |
style: ShowcaseStyle(overlayColor: ...) |
opacityShadow (default 0.8) |
style: ShowcaseStyle(overlayOpacity: ...) (default 0.75) |
imageFilter |
blurValue, tour-wide or per step: a blur, not any ImageFilter |
focusAnimationDuration, unFocusAnimationDuration |
enableStepTransition: true with stepTransitionDuration for the highlight; scaleAnimationDuration for the tooltip |
pulseEnable (default true) |
Showcase.enablePulseAnimation: true, per step (off by default) |
pulseAnimationDuration |
Showcase.pulseDuration |
TargetFocus(pulseVariation: ...) |
not available: pulseColor and pulseDuration set the ring |
backgroundSemanticLabel |
not available. Each step is announced to screen readers; Showcase.semanticLabel sets the text |
next(), previous(), goTo(index) |
same, on ShowCaseWidget.of(context) |
skip(), removeOverlayEntry() |
dismiss() |
finish() |
not available as such: dismiss() ends the tour and reports onDismiss, not onFinish |
isShowing |
isShowcaseRunning |
TutorialCoachMarkController |
ShowCaseWidget.of(context) |
Behaviour that differs #
- Background taps advance. tutorial_coach_mark ignores taps on the
shadow unless a target sets
enableOverlayTab: true. Here a tap on the dimmed background goes to the next step. SetbarrierInteraction: BarrierInteraction.noneto ignore it, as tutorial_coach_mark does. onTargetClickreplaces the advance. tutorial_coach_mark runsonClickTargetand then moves on. Here a tap on the target moves on only when the step has noonTargetClick; with one, your callback runs instead. CallShowCaseWidget.of(context).next()in it to move on too.- A missing target waits. tutorial_coach_mark skips a target it can't
find, and finishes when none is left. Here the tour waits for that step's
widget to appear, which is what makes tours across
screens work.
autoSkipUnmountedSteps: truegives tutorial_coach_mark's behaviour, finishing the tour when every remaining step is skipped. One difference remains: tutorial_coach_mark looks for the target afterbeforeFocus, while this package decides on skipping beforeonBeforeStep. A step youronBeforeStepbrings on screen must not be skipped (see Prepare a step before it shows). - Pages and dialogs on top. tutorial_coach_mark's overlay stays above everything, including pages pushed while it shows. Here a step hides while another page or a dialog covers its page, and comes back when its page is on top again.
- The pulse is opt-in. tutorial_coach_mark pulses every target
(
pulseEnable: true). Here a step pulses only withenablePulseAnimation: true. - Skip is opt-in. tutorial_coach_mark shows SKIP unless
hideSkip: true. Here setshowSkip: true, or pin your own button (step 5 above). previous()on the first step does nothing here. In tutorial_coach_mark it finishes the tutorial and callsonFinish.- A default tooltip. tutorial_coach_mark draws only the content you give
it. Here a step with a
titleanddescriptiongets a tooltip styled from your app's theme (see Colours and your app's theme). UseShowcase.withWidgetfor content of your own. - The default shape. tutorial_coach_mark draws a circle around a target
whose
shapeis unset. Here the default is a rounded rectangle; settargetShapeBorder: const CircleBorder()for a circle. - Spacing. tutorial_coach_mark's
paddingFocusdefaults to 10, which grows a rounded-rectangle hole by 5 on each side (a circle's radius is sized from the target instead). HeretargetPaddingis zero; settargetPadding: EdgeInsets.all(5)for a similar look. - The back button.
disableBackButton: truepushes a blocking route for the whole tutorial,beforeFocusincluded.backButtonInteraction: BackButtonInteraction.blockacts only while a step is on screen: back stays live whileonBeforeStepruns, while the tour waits for a step's page, and while a dialog or another page covers the step. - Requirements. This package needs Flutter 3.47 or newer and
material_ui. tutorial_coach_mark is built onpackage:flutter/material.dartand supports older Flutter releases.
Table of contents #
- Migrating from 1.x to 2.0
- Coming from showcaseview
- Coming from tutorial_coach_mark
- Installation
- Getting started
- Custom tooltip
- Action buttons
- Progress indicator & Skip button
- Translating the tour
- Floating action widget
- Exact-shape highlight
- Pulsing highlight ring
- Animated step transitions
- Tooltip & highlight styling
- Highlight multiple widgets in one step
- Colours and your app's theme
- Global styling with
ShowcaseStyle - Run the tour only once
- Resume where the user left off
- Auto play
- Programmatic control & progress
- Conditional / branching tours
- Prepare a step before it shows
- Tours across screens
- Target interactions
- Step lifecycle callbacks
- Background (barrier) tap behavior
- Back button
- Accessibility & keyboard navigation
- Pointer cursor (web / desktop)
- Blur the background
- Tooltip position
- Skip off-screen steps
- Right-to-left (RTL)
- Enable or disable globally
- Auto-scrolling caveat
- API reference
- Example
- License
Installation #
-
Add the dependency to your
pubspec.yaml:dependencies: showcase_tutorial: ^2.1.0Or from the command line:
flutter pub add showcase_tutorial -
Import it:
import 'package:showcase_tutorial/showcase_tutorial.dart';
Requirements: Flutter 3.47 or newer (Dart 3.13). The package is built on
material_ui, Flutter's standalone Material library. On an older Flutter, pub resolves to 1.15.1.
If your app still uses MaterialApp from package:flutter/material.dart:
the tour works, but the tooltip can't see your app's theme. material_ui keeps
its own Theme, separate from the old one, and the old one exposes nothing the
package can read without importing the deprecated library. So the default
title and description text uses the default Material fonts instead of yours,
and the tour uses fixed colours (a white tooltip with black text) instead of
following your theme. Set the colours you want
through ShowcaseStyle too.
The best fix is to migrate: dart fix --apply --code=migrate_design_widgets.
Until then, pass your text styles once through ShowcaseStyle, from somewhere
under your MaterialApp (for example home or builder):
// Theme here is the one from package:flutter/material.dart.
final textTheme = Theme.of(context).textTheme;
ShowCaseWidget(
style: ShowcaseStyle(
titleTextStyle: textTheme.titleLarge?.copyWith(color: Colors.black),
descTextStyle: textTheme.titleSmall?.copyWith(color: Colors.black),
),
builder: ...,
);
These styles replace the default title and description styles, so textColor
no longer colours that text (it still colours the progress indicator and the
Skip label). Set the colour in the style itself: without a material_ui
theme the tooltip is white, and a dark theme's text is usually white too. Once
your app uses material_ui's MaterialApp, you can delete these two lines:
the tooltip then follows your theme by itself.
Getting started #
A tour is three small steps: wrap the screen, wrap each target, then start.
1. Wrap your screen (or app) in a ShowCaseWidget.
ShowCaseWidget(
builder: const HomePage(),
);
builder takes any widget. Widgets inside it, like HomePage, can call
ShowCaseWidget.of(context) from their own build. If you build the screen
inline and need ShowCaseWidget.of(context) right there, wrap it in a
Builder so that context is below the ShowCaseWidget. Code that already
passes a Builder keeps working.
ShowCaseWidget(
builder: Builder(
builder: (context) => Column(
children: [
Showcase(
key: _one,
description: 'Tap here to open the menu',
child: const Icon(Icons.menu),
),
ElevatedButton(
onPressed: () => ShowCaseWidget.of(context).startShowCase([_one]),
child: const Text('Start tour'),
),
],
),
),
);
2. Wrap each target widget in a Showcase with a unique GlobalKey.
final GlobalKey _one = GlobalKey();
final GlobalKey _two = GlobalKey();
Showcase(
key: _one,
title: 'Menu',
description: 'Tap here to open the menu',
child: const Icon(Icons.menu),
);
Showcase(
key: _two,
title: 'Profile',
description: 'Your account lives here',
targetShapeBorder: const CircleBorder(),
child: const CircleAvatar(child: Icon(Icons.person)),
);
3. Start the tour — the order of keys is the order of the steps:
ShowCaseWidget.of(context).startShowCase([_one, _two]);
To start it automatically once the first frame is rendered:
WidgetsBinding.instance.addPostFrameCallback(
(_) => ShowCaseWidget.of(context).startShowCase([_one, _two]),
);
That's the whole flow. Everything below is optional.
Custom tooltip with Showcase.withWidget #
When the default title/description tooltip isn't enough, build your own with
Showcase.withWidget:
Showcase.withWidget(
key: _three,
targetShapeBorder: const CircleBorder(),
container: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text('This is a custom tooltip', style: TextStyle(color: Colors.white)),
SizedBox(height: 8),
Icon(Icons.touch_app, color: Colors.white),
],
),
child: const Icon(Icons.star),
);
The container is placed by its own laid-out size: it goes above or below the
target by its height, and is kept within toolTipMargin by its width. It is
measured before it is shown, so it never appears in the wrong place first.
Pass height and width to place it by sizes of your own instead.
Action buttons (Next / Previous / Stop) #
Add navigation buttons to the tooltip with ShowCaseDefaultActions:
Showcase(
key: _one,
title: 'Menu',
description: 'Open the menu',
actions: const ShowCaseDefaultActions(), // Previous | Stop | Next
child: const Icon(Icons.menu),
);
Customize each button with ActionButtonConfig:
Showcase(
key: _one,
title: 'Menu',
description: 'Open the menu',
actions: ShowCaseDefaultActions(
next: ActionButtonConfig(
text: 'Next',
icon: const Icon(Icons.arrow_forward, size: 16),
// In an LTR app, puts the arrow after the text. Leave it out to follow the app.
textDirection: TextDirection.rtl,
),
previous: const ActionButtonConfig(text: 'Back'),
stop: const ActionButtonConfig(text: 'Skip'),
),
actionSettings: const ActionsSettings(containerHeight: 40),
child: const Icon(Icons.menu),
);
Each button puts its icon first. By default it follows your app's text
direction, so the icon is on the left in an English app and on the right in an
Arabic or Hebrew one, and the whole row mirrors too (Previous on the right).
Set textDirection on one button to choose its order yourself. The value is
the actual order, not relative to your app: TextDirection.rtl puts the icon
on the right, after the text, in an English app, but in an Arabic app it is the
same as leaving it out. There, TextDirection.ltr puts the arrow after the
text.
The tooltip is made wide enough for the buttons' labels. If a label still does
not fit its button, for example a long translation on a narrow phone, it stays
on one line instead of breaking in the middle of a word: it gets smaller, down
to 70% of its size, and past that it ends with "…". The button itself keeps its
size, so it is just as easy to tap. With buttonTextVisible: false the button shows
only its icon, and screen readers still read its label.
The buttons follow your theme. To colour them
yourself, set ActionButtonConfig.textColor on a button, or
ShowcaseStyle.actionTextColor for the whole tour. With ActionsSettings,
buttons outside the tooltip get a box in the tooltip's colour
(containerColor changes it); without it they sit on the dimmed background.
Set the buttons once for the whole tour #
Repeating actions: on every step gets old fast. Declare them on
ShowCaseWidget instead and every step gets them:
ShowCaseWidget(
globalActions: (context) => const ShowCaseDefaultActions(),
globalActionSettings: const ActionsSettings(containerHeight: 40),
// Steps that should not offer the buttons, e.g. a final "you're done" step.
hideActionsForShowcase: [_last],
builder: const HomePage(),
);
A per-step Showcase.actions still wins wherever you set one, and
Showcase.actionSettings / Showcase.actionButtonsPosition override the
tour-wide styling and placement independently — so a step can change just its
buttons and keep the tour's look.
Inside or outside the tooltip #
By default the buttons are positioned outside the tooltip box, which is how they
have always been drawn. Set actionsPosition to draw them inside it instead, so
they flow below the description and the tooltip grows to contain them:
ShowCaseWidget(
globalActions: (context) => const ShowCaseDefaultActions(),
actionsPosition: TooltipActionPosition.inside,
builder: const HomePage(),
);
Tour-wide, or per step with Showcase.actionsPosition. Inside actions are given
40 logical pixels of height by default; use ActionsSettings.containerHeight
(and containerWidth) when yours need more, since the package cannot measure a
widget you supply the way it measures the title and description.
Prefer inside when the buttons are shown on every step. outside positions
them absolutely, above or below the tooltip depending on which way its arrow
points. They are held inside toolTipMargin so they cannot run off screen, but
on a step whose target sits near a screen edge there is no room left and they
crowd the tooltip. inside has no such problem: the tooltip grows to fit them.
Use outside when you want the buttons detached from the tooltip and you know
the targets have room, or place them yourself with
Showcase.actionButtonsPosition, which is never clamped.
Progress indicator & Skip button #
Add a built-in step indicator and a skip control to the default tooltip — no
custom container needed. Both are set once on the ShowCaseWidget and default
to off:
ShowCaseWidget(
showProgress: true, // show the step indicator
// dots (default) or a "1/6" counter:
progressStyle: ShowcaseProgressStyle.numeric,
showSkip: true, // a "Skip" button that ends the whole tour
// optional, the button says 'Skip' by default:
labels: const ShowcaseLabels(skip: 'Skip tour'),
builder: const HomePage(),
);
The indicator uses the tooltip's text color and reflects currentIndex /
totalSteps. Choose its look with progressStyle:
ShowcaseProgressStyle.dots (one dot per step, active step highlighted — the
default) or ShowcaseProgressStyle.numeric (a compact 1/6 counter, handy for
long tours). This affects the default tooltip only; a custom container
tooltip is left untouched.
Translating the tour #
The built-in buttons say Next, Previous, Stop and Skip. To show them in your
app's language, pass labels to ShowCaseWidget once. Every button in the
tour uses them: the ones in Showcase.actions, the ones from globalActions,
and the Skip button.
ShowCaseWidget(
labels: const ShowcaseLabels(
next: 'التالي',
previous: 'السابق',
stop: 'إنهاء',
skip: 'تخطي',
),
showSkip: true,
globalActions: (context) => const ShowCaseDefaultActions(),
builder: const HomePage(),
);
Any label you leave out stays in English. If you use Flutter's localizations,
build the labels from them, e.g. ShowcaseLabels(next: l10n.next, ...).
When the app switches language, the buttons on screen change straight away.
A button's own ActionButtonConfig.text wins over labels, so one step can
still say something else, e.g. next: ActionButtonConfig(text: 'Finish') on
the last step.
In an Arabic or Hebrew app the buttons and the Skip / progress row also follow the right-to-left direction, with no extra setting (see Right-to-left).
skipButtonText still works, and when you set it, it wins over
labels.skip. It is deprecated and will be removed in 3.0.0; use
labels: ShowcaseLabels(skip: ...) instead.
Floating action widget #
Pin a control to the screen that stays put while the tour runs — a fixed
Skip / Next button, a progress chip, a help button — instead of one that
moves with each tooltip. You position it yourself (wrap it in an Align or
Positioned); it's painted above the tooltip and receives taps.
Set one for the whole tour with globalFloatingActionWidget (a builder, so it
can read the tour state via ShowCaseWidget.of(context)):
ShowCaseWidget(
globalFloatingActionWidget: (context) => Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(bottom: 24),
child: TextButton(
onPressed: ShowCaseWidget.of(context).dismiss, // skip the whole tour
child: const Text('Skip tour'),
),
),
),
builder: const HomePage(),
);
Override it for a single step with Showcase.floatingActionWidget, or hide the
global one on specific steps with hideFloatingActionWidgetForShowcase:
ShowCaseWidget(
globalFloatingActionWidget: (context) => const SkipButton(),
hideFloatingActionWidgetForShowcase: [lastStepKey], // no Skip on the final step
builder: ...,
);
Showcase(
key: stepKey,
description: 'This step has its own action',
floatingActionWidget: const Align(
alignment: Alignment.topRight,
child: CustomBadge(),
),
child: ...,
);
Resolution per step: Showcase.floatingActionWidget wins; otherwise the
globalFloatingActionWidget is used unless the step is listed in
hideFloatingActionWidgetForShowcase.
Exact-shape highlight #
By default the highlight is a geometric box you control with targetShapeBorder
(e.g. CircleBorder() for a round target). For irregular widgets — a star, a
pill, an icon, a logo — set highlightExactShape: true and the highlight hugs
the widget's actual painted shape automatically, with no targetShapeBorder
to match by hand.
Showcase(
key: starKey,
highlightExactShape: true, // highlight follows the star, not a box
title: 'Favourites',
description: 'Tap the star to save this item',
child: const Icon(Icons.star, size: 48, color: Colors.amber),
);
How it works: the target is captured as a snapshot and drawn above the dimmed
overlay (the child is wrapped in a RepaintBoundary for you).
Note: while the step is showing, the target is rendered as a static image, so it won't animate or update until the tour moves on. For typical static UI this is invisible.
targetShapeBorder/targetBorderRadiusare ignored for the highlight when this is on.
Pulsing highlight ring #
For an extra nudge toward the target, set enablePulseAnimation: true to draw an
animated ring that pings outward around the highlight — like a sonar ping — in
addition to the static cut-out. Tune the look with pulseColor and
pulseDuration (one full cycle; smaller is faster).
Showcase(
key: fabKey,
enablePulseAnimation: true,
pulseColor: Colors.amber, // defaults to white
pulseDuration: const Duration(milliseconds: 1200),
title: 'Compose',
description: 'Tap here to start a new message',
child: const Icon(Icons.add),
);
The ring follows the highlight's shape (targetShapeBorder / targetBorderRadius);
with highlightExactShape it pulses around the target's bounding box. Set a
default color for the whole tour once via
ShowCaseWidget(style: ShowcaseStyle(pulseColor: ...)).
Accessibility: when the platform "reduce motion" setting is on, the pulse falls back to a single static ring instead of animating.
Animated step transitions #
By default the highlight cuts instantly from one target to the next. Turn on
enableStepTransition and it glides there instead — the "guided tour" feel:
The preview at the top uses it. The cut-out also morphs between target shapes, so a round icon becomes a rounded card on the way over.
ShowCaseWidget(
enableStepTransition: true,
stepTransitionDuration: const Duration(milliseconds: 300), // default
stepTransitionCurve: Curves.easeInOut, // default
builder: const HomePage(),
);
It applies to every move — next(), previous(), goTo(), a branch, a barrier
tap, autoplay. The highlight border and the pulsing ring follow the moving
cut-out; the tooltip keeps its own scale transition and appears at the new
target. The first step of a tour has nothing to glide from, so it simply appears.
Accessibility: when the platform "reduce motion" setting is on, the highlight jumps straight to the target instead of gliding.
Note: a
highlightExactShapestep paints a snapshot of the target rather than a cut-out, so there is nothing to glide — those steps still cut.
If you need the geometry yourself, ShowCaseWidget.of(context).previousTargetRect
holds the global bounds of the step the tour just left (null while the tour is
starting or after it ends).
Tooltip & highlight styling #
Fine-tune the default tooltip and the highlight without writing a custom
container. Style the arrow (arrowColor, arrowWidth, arrowHeight, or hide
it with showArrow: false) and draw a colored border around the target
(highlightBorderColor, highlightBorderWidth):
Showcase(
key: inboxKey,
title: 'Inbox',
description: 'Your messages live here',
tooltipBackgroundColor: const Color(0xFF023047),
textColor: Colors.white,
// Arrow:
arrowColor: const Color(0xFFF4A261), // defaults to the tooltip background
arrowWidth: 26, // base, default 18
arrowHeight: 13, // depth, default 9
// Highlight border (off unless a color is set):
highlightBorderColor: const Color(0xFFF4A261),
highlightBorderWidth: 3,
child: const Icon(Icons.inbox),
);
The border follows the highlight's shape (targetShapeBorder /
targetBorderRadius); with highlightExactShape it outlines the bounding box.
Set any of these once for the whole tour via ShowcaseStyle, e.g.
ShowCaseWidget(style: ShowcaseStyle(arrowColor: ..., highlightBorderColor: ...)).
The dimmed background's color is
Showcase.overlayColor(orShowcaseStyle.overlayColorfor the whole tour), andoverlayOpacity(Showcase.overlayOpacity, orShowcaseStyle.overlayOpacityfor the whole tour, default0.75) sets how see-through it is.
Highlight multiple widgets in one step #
Sometimes one step should highlight several widgets at once — for example a
multi-select control, or a few non-adjacent items in a ListView. Pass the
extra widgets' keys to Showcase(keys: ...) and wrap each of those widgets in a
MultiView (a RepaintBoundary) so a snapshot of it can be drawn above the
overlay.
final GlobalKey mainKey = GlobalKey();
final GlobalKey extraOne = GlobalKey();
final GlobalKey extraTwo = GlobalKey();
// The primary target carries the tooltip and lists the extra keys.
Showcase(
key: mainKey,
keys: [extraOne, extraTwo],
description: 'Tap the star to mark important emails',
child: const MailTile(),
);
// Each extra widget is wrapped so it can be captured.
MultiView(key: extraOne, child: const SomeListItem());
MultiView(key: extraTwo, child: FloatingActionButton(onPressed: () {}));
Note: the extra widgets must currently be in the widget tree (rendered) when the step starts so their keys resolve. A widget that is missing is simply skipped — the remaining ones are still highlighted.
Colours and your app's theme #
A tour matches your app without any styling. Every colour you don't set comes
from your app's theme (ThemeData.colorScheme), so the tour follows your
brand colours and switches with light and dark mode:
| Part of the tour | Colour it takes from your theme |
|---|---|
| Tooltip background (and its arrow) | surfaceContainerHigh, the surface a dialog has |
| Title, description, progress, Skip | onSurface |
| Action button labels | primary |
| Divider between action buttons | outlineVariant |
| Dimmed background | scrim (black unless your theme changes it) |
| Pulse ring, scroll spinner | white or black, whichever shows on the dimmed background |
A colour you set always wins, and the tour keeps your choice readable:
- Set a tooltip background without a text colour, and the text is white or black, whichever can be read on it.
- Action buttons on a background you chose, or directly on the dimmed background, are white or black the same way.
To set colours yourself, use the step's own properties or, once for the whole
tour, ShowcaseStyle.
Upgrading from 1.16 or earlier? The tooltip used to be white with black text, and the action buttons light blue, whatever your theme. To keep that look, set it once:
ShowCaseWidget( style: const ShowcaseStyle( tooltipBackgroundColor: Colors.white, textColor: Colors.black, actionTextColor: Color(0xff48cae4), actionDividerColor: Color(0xffcaf0f8), ), builder: ..., );
The colours come from material_ui's theme. An app without one (for example,
one still on MaterialApp from package:flutter/material.dart) keeps the
fixed colours above.
Global styling with ShowcaseStyle #
Instead of repeating the same styling on every Showcase, set it once on the
ShowCaseWidget with ShowcaseStyle. Each Showcase still overrides any
value it provides; anything left unset falls back to the style, then to
your app's theme.
ShowCaseWidget(
style: const ShowcaseStyle(
tooltipBackgroundColor: Color(0xFF023047),
textColor: Colors.white,
tooltipBorderRadius: BorderRadius.all(Radius.circular(12)),
),
builder: const HomePage(),
);
Every colour of a tour can be set here:
ShowcaseStyle property |
What it colours |
|---|---|
tooltipBackgroundColor |
The default tooltip. |
textColor |
Title, description, progress indicator and Skip label. |
arrowColor |
The tooltip's arrow (defaults to the tooltip's colour). |
actionTextColor |
Labels of the default action buttons. |
actionDividerColor |
The divider between the default action buttons. |
overlayColor |
The dimmed background. |
pulseColor |
The pulsing highlight ring. |
highlightBorderColor |
The border around the target (none by default). |
loadingIndicatorColor |
The spinner shown while the tour scrolls to a target. |
Resolution order for each value: Showcase → ShowcaseStyle → your app's theme.
ShowcaseStyle.overlayOpacity sets how see-through the dimmed background is
for every step, from 0 to 1. A step's own Showcase.overlayOpacity wins,
and with neither set it is 0.75:
ShowCaseWidget(
style: const ShowcaseStyle(overlayOpacity: 0.6),
builder: const HomePage(),
);
Run the tour only once #
By default the package stores nothing, so the tour replays every time you call
startShowCase. To show it only once (typical onboarding), give the
ShowCaseWidget a showcaseId and an onShouldStartShowcase guard, and persist
completion yourself in onFinish — with any storage (shared_preferences, Hive,
a backend, …):
ShowCaseWidget(
showcaseId: 'home_v1',
onShouldStartShowcase: (id) async =>
!(prefs.getBool(id!) ?? false), // skip if already seen
onFinish: () => prefs.setBool('home_v1', true),
builder: const HomePage(),
);
Call startShowCase([...]) as usual — it silently does nothing when the guard
returns false. The guard may be synchronous or asynchronous. To force a replay
(e.g. a "Show tutorial again" button), pass force: true:
ShowCaseWidget.of(context).startShowCase([_one, _two], force: true);
With a delay, the guard is asked when the
delay ends, just before the tour would start, so it sees whether the tour was
completed in the meantime.
Resume where the user left off #
If the user leaves the app in the middle of a tour, you can open the tour on
the same step next time with startAt. Save the step index when each step
starts, clear it when the tour ends, and pass it back to startShowCase. As
with "only once", the package stores nothing: use any storage you like.
ShowCaseWidget(
// Remember the step the user is on.
onStart: (index, key) => prefs.setInt('home_tour_step', index ?? 0),
// The tour ended (finished or closed early): start from the top next time.
onFinish: () => prefs.remove('home_tour_step'),
onDismiss: (key) => prefs.remove('home_tour_step'),
builder: const HomePage(),
);
// Later, for example when HomePage opens:
ShowCaseWidget.of(context).startShowCase(
[_one, _two, _three],
startAt: prefs.getInt('home_tour_step') ?? 0,
);
A screen deeper in the tree can save the index with
ShowCaseWidget.of(context).addOnStartCallback(...) instead of onStart.
How a resumed tour behaves:
- It opens directly on step
startAt, with no glide from another target, andprevious()can still go back to the earlier steps. currentIndex, the progress indicator andonStartreport the real step: in a five-step tour started at2,currentIndexis2, the numeric progress counter shows3/5andonStartgets2.onShouldStartShowcasestill decides whether the tour starts, andforce: truestill skips it.autoSkipUnmountedStepsandonShouldSkipUnmountedStepwork fromstartAtforward, the same as from the first step. If every step from there on is skipped, the tour finishes.- A
startAtoutside0..keys.length - 1is clamped, in debug and release builds alike: below0opens the first step, past the end opens the last step. A saved index can go out of range when an app update removes steps, so you can pass it in without checking it, and the user stays in the tour instead of it being marked finished.
Auto play #
Advance through all steps automatically:
ShowCaseWidget(
autoPlay: true,
autoPlayDelay: const Duration(seconds: 3),
enableAutoPlayLock: true, // block taps while auto-playing
builder: const HomePage(),
);
Let a single step linger longer (or advance quicker) than the rest with a
per-step Showcase.autoPlayDelay, which overrides the tour-wide one:
Showcase(
key: _details,
description: 'This one has more to read, so it stays up longer.',
autoPlayDelay: const Duration(seconds: 6), // overrides the tour-wide delay
child: const Icon(Icons.info),
);
Programmatic control & progress #
Drive the tour from anywhere you have a BuildContext below the
ShowCaseWidget:
ShowCaseWidget.of(context).next(); // go to the next step
ShowCaseWidget.of(context).previous(); // go to the previous step
ShowCaseWidget.of(context).dismiss(); // stop the whole tour
To let a screen finish its entrance animation before the tour covers it, start
the tour after a delay:
ShowCaseWidget.of(context).startShowCase(
[_one, _two],
delay: const Duration(milliseconds: 500),
);
The call returns at once and the tour starts when the delay ends. A delay of
zero (the default) starts the tour within the call, as before. While the start
waits, on its delay or on an asynchronous onShouldStartShowcase,
isStartPending is true, and the start is called off when:
cancelDelayedStart()is called, which does it silently and returns whether a start was pending,dismiss()is called, which also reports a dismissal as it always does (onDismissgetsnullwhen no tour is running),- another
startShowCaseis called (the newer one wins), enableShowcaseturnsfalse, or theShowCaseWidgetgoes away.
The timer belongs to the ShowCaseWidget, not to the screen that asked for
the start. When ShowCaseWidget sits above the Navigator and a page
schedules a delayed start, popping the page does not cancel it: the tour still
starts and waits for the page's steps (or skips them all and finishes, with
autoSkipUnmountedSteps). Cancel it in the page's dispose, through the
controller kept from didChangeDependencies, since dispose cannot look up
ancestors:
late ShowCaseWidgetState _tour;
@override
void didChangeDependencies() {
super.didChangeDependencies();
_tour = ShowCaseWidget.of(context);
}
@override
void dispose() {
_tour.cancelDelayedStart();
super.dispose();
}
A start whose steps aren't on screen when it fires is not dropped: a tour can wait for a page the user opens later.
Jump to a specific step and read progress — useful for a "Step 2 of 5" indicator or a skip-to control:
final show = ShowCaseWidget.of(context);
show.goTo(2); // jump to a step by index
show.goToKey(profileKey); // ...or by its GlobalKey
final label = '${(show.currentIndex ?? 0) + 1} of ${show.totalSteps}';
final running = show.isShowcaseRunning;
Listen to the tour lifecycle on ShowCaseWidget:
ShowCaseWidget(
onStart: (index, key) => debugPrint('started step $index'),
onComplete: (index, key) => debugPrint('finished step $index'),
onFinish: () => debugPrint('tour complete'),
// Fired only when the tour is closed early (barrier-dismiss, Esc, skip,
// or dismiss()); `key` is the step the user left off on, or null.
onDismiss: (key) => debugPrint('tour dismissed at $key'),
builder: const HomePage(),
);
onFinish fires when the tour completes normally (advances past the last step);
onDismiss fires when it's closed early. Exactly one of them runs per tour. Use
onDismiss to measure onboarding drop-off — it tells you which step the user
bailed on. (This is the tour-level callback; the per-step Showcase.onDismiss
fires for every step the tour leaves.)
Conditional / branching tours #
Let a step decide the next step at runtime so the tour can skip ahead or branch
based on app state. Set onResolveNextStep on ShowCaseWidget: it's called
whenever the tour advances forward and returns the GlobalKey of the step to
jump to (one of the keys passed to startShowCase), or null to advance to the
normal next step.
ShowCaseWidget(
onResolveNextStep: (currentIndex, currentKey) {
// e.g. if the user already has items, skip the "add to cart" step
// and jump straight to checkout.
if (currentKey == cartKey && userHasItems) return checkoutKey;
return null; // otherwise advance normally
},
builder: const HomePage(),
);
The resolver is honored by every forward path — the Next button, a tap on the
target or tooltip, the barrier, the keyboard, auto-play, and next(). The
returned step may be ahead of or behind the current one, and a branch is treated
as an explicit jump (like goTo), so autoSkipUnmountedSteps and
onShouldSkipUnmountedStep are not applied to the target. previous(),
goTo(), and goToKey() ignore the resolver.
Prepare a step before it shows #
onBeforeStep runs before each step is shown, and the tour waits for it.
Use it to scroll to a step, load its data or open its page first:
ShowCaseWidget(
onBeforeStep: (index, key) async {
if (key == _chartStep) await _repository.loadChart();
},
builder: const HomePage(),
);
It gets the step's index in the running tour and its key. Return a Future
and the tour waits until it completes; return nothing and the step shows at
once, on the same frame as without the callback.
When it runs. For the step a tour opens on and for every step it moves to,
whatever moves it: Next, a tap, the keyboard, auto-play, the back button,
next(), previous(), goTo(). The order is:
startShowCasewaits out itsdelayand asksonShouldStartShowcase. A tour the guard turns down never callsonBeforeStep.onCompleteruns for the step the tour leaves.- The tour chooses the next step as it always does:
startAt,onResolveNextStep, thenautoSkipUnmountedSteps/onShouldSkipUnmountedStep, judged by what is on screen at that moment. onBeforeStepruns for that step, and the tour waits for it.onStartruns, and the step shows. ItsonShow, auto-scroll and auto-play timer start here, so the auto-play delay counts from when the step appears.
It isn't called for skipped steps, or when the tour finishes or is dismissed.
Skipping is decided before it runs, so a step that onBeforeStep brings on
screen must not be skipped. Leave autoSkipUnmountedSteps off, and the tour
waits for that step's widget, or return false for it from
onShouldSkipUnmountedStep. A step whose widget still isn't there after the
callback is waited for, as usual.
While it waits, the step the tour left is gone and nothing else is shown:
no dimmed background and no tooltip. The app takes taps and the back button
as usual. A second tap on the step that was left, still in flight, doesn't
advance the tour again. currentIndex is the step being prepared, and
isPreparingStep is true.
If the tour moves meanwhile, the step being prepared is given up. When the
callback completes, nothing shows and onStart doesn't run for it. The step
never started, so onComplete doesn't run for it either.
| Called while it waits | What happens |
|---|---|
next() |
Moves on from the step being prepared. Call it from onBeforeStep to skip that step. |
previous(), goTo(), goToKey() |
Moves from the step being prepared. A previous() with no earlier step does nothing. |
dismiss() |
Ends the tour. onDismiss gets null, as no step was showing. |
startShowCase() |
Replaces the tour. With a delay, the waiting step still shows until the new tour starts. |
enableShowcase: false |
Ends the tour. |
ShowCaseWidget disposed |
Nothing more happens. |
If it throws, the error goes to FlutterError.onError and the step shows
anyway. Catch the error and call next() or dismiss() to skip the step or
end the tour instead.
With enableStepTransition, a step shown after a Future appears without the
glide, since nothing was on screen in between.
Tours across screens #
One tour can cover several pages. Put ShowCaseWidget above the Navigator
with MaterialApp.builder, so the steps on every page share it:
MaterialApp(
builder: (context, child) => ShowCaseWidget(
builder: child!,
),
home: const HomePage(),
);
Then pass keys from any page to startShowCase:
- A step on a page that isn't open yet waits. Nothing is drawn, and the
step appears once the user opens its page and the page has finished
animating in. Leave
autoSkipUnmountedStepsoff for such tours: it would skip that step instead. If the tour also has steps that should be skipped when their widget isn't built, useonShouldSkipUnmountedStepto choose per step (see Skip off-screen steps). - A step whose page gets covered by another screen, a dialog or a bottom
sheet hides until its page is back on top. It stays the tour's current step,
its
onDismissandonShowfire as it hides and returns, and auto-play pauses while it's hidden.
To take the user to the next page from a step, advance the tour and navigate
in onTargetClick, or open the page from
onBeforeStep when the tour reaches its
step. Use disposeOnTap: false; true ends the whole tour
before calling it:
Showcase(
key: _settingsButton,
description: 'Open your settings',
disposeOnTap: false,
onTargetClick: () {
ShowCaseWidget.of(context).next(); // the next step is on SettingsPage
Navigator.of(context).push(MaterialPageRoute(builder: (_) => const SettingsPage()));
},
child: const Icon(Icons.settings),
);
The example app has a working version: Feature demos → Tour across screens
demo (cross_screen_demo_page.dart).
Target interactions #
Respond to gestures on the highlighted widget. onTargetClick requires
disposeOnTap to be set:
Showcase(
key: _one,
description: 'Tap to open details',
disposeOnTap: true,
onTargetClick: () => Navigator.pushNamed(context, '/details'),
onTargetDoubleTap: () => debugPrint('double tapped'),
onTargetLongPress: () => debugPrint('long pressed'),
child: const Icon(Icons.info),
);
Step lifecycle callbacks #
Each Showcase can report when it becomes visible and when it's left — handy for
analytics or per-step side effects:
Showcase(
key: _one,
title: 'Menu',
description: 'Open the menu',
onShow: () => analytics.log('tour_step_shown', {'step': 'menu'}),
onDismiss: () => analytics.log('tour_step_left', {'step': 'menu'}),
child: const Icon(Icons.menu),
);
onShow fires when the step becomes the active showcase; onDismiss fires when
it stops being active — advanced past, navigated away, or the whole tour ended.
Listening from anywhere in the tree #
ShowCaseWidget.onStart / onComplete are fixed when the ShowCaseWidget is
built. When a listener has to come and go at runtime — a screen, a controller, an
analytics service deeper in the tree — register it on the controller instead:
class _StepCounterState extends State<StepCounter> {
late final ShowCaseWidgetState _tour;
int? _index;
void _onStep(int? index, GlobalKey key) => setState(() => _index = index);
@override
void initState() {
super.initState();
_tour = ShowCaseWidget.of(context)..addOnStartCallback(_onStep);
}
@override
void dispose() {
// Use the controller kept in initState: looking it up in dispose throws.
_tour.removeOnStartCallback(_onStep);
super.dispose();
}
@override
Widget build(BuildContext context) => Text('Step ${(_index ?? 0) + 1}');
}
There are addOnCompleteCallback / removeOnCompleteCallback,
addOnFinishCallback / removeOnFinishCallback and addOnDismissCallback /
removeOnDismissCallback pairs too, the runtime counterparts of onComplete,
onFinish and onDismiss (a dismiss listener gets the same GlobalKey? of
the step the user left off on). All of them run after the widget-level
callback, in registration order, and a listener can remove itself while it
runs. Always remove in dispose so a gone widget stops being called.
Following the highlighted target #
onTargetRectUpdate reports the target's bounds (global coordinates) whenever
they change — after a scroll, a rotation, the keyboard opening, or the target
resizing. It fires once with the initial bounds when the step becomes active, and
is delivered after layout, so it's safe to setState from it:
Showcase(
key: _one,
title: 'Balance',
description: 'Your current balance',
onTargetRectUpdate: (rect) => setState(() => _badgeTop = rect.bottom + 8),
child: const BalanceCard(),
);
Handy for anchoring your own UI — e.g. a floatingActionWidget that should
follow just below the highlight.
Background (barrier) tap behavior #
By default, tapping the dimmed background advances to the next step. Change it
with barrierInteraction:
ShowCaseWidget(
barrierInteraction: BarrierInteraction.dismiss, // tap background → end tour
// BarrierInteraction.next → advance (default)
// BarrierInteraction.none → ignore background taps
builder: const HomePage(),
);
disableBarrierInteraction: trueis deprecated and will be removed in 3.0.0. UsebarrierInteraction: BarrierInteraction.noneinstead, which does the same.
To run your own code on a background tap — a hint nudge, a sound, analytics — add
onBarrierClick. It fires on every barrier tap in addition to the configured
barrierInteraction, and runs even when interaction is .none:
ShowCaseWidget(
barrierInteraction: BarrierInteraction.none, // tap doesn't advance/dismiss…
onBarrierClick: () => debugPrint('user tapped outside the highlight'), // …but you still hear about it
builder: const HomePage(),
);
A single step can behave differently from the rest of the tour — for example when the user must interact with the target rather than tap past it:
Showcase(
key: _two,
title: 'Try it',
description: 'Tap the switch to continue',
barrierInteraction: BarrierInteraction.none, // this step only
child: const FeatureSwitch(),
);
The per-step value wins over the tour-wide barrierInteraction.
onBarrierClick still fires either way.
A step can have its own onBarrierClick too, for a tap while that step is
showing. It runs in addition to the tour-wide one: first
ShowCaseWidget.onBarrierClick, then the step's, then whatever
barrierInteraction does. Both fire on every barrier tap, .none included:
Showcase(
key: _two,
title: 'Try it',
description: 'Tap the switch to continue',
barrierInteraction: BarrierInteraction.none,
onBarrierClick: () => _nudgeSwitch(), // only while this step shows
child: const FeatureSwitch(),
);
Back button #
By default the system back button does what it does without a tour: it
closes the page, and a tour on that page goes with it. Choose what back does
while a step is showing with backButtonInteraction:
ShowCaseWidget(
backButtonInteraction: BackButtonInteraction.previous, // back → previous step
// BackButtonInteraction.passThrough → back closes the page (default)
// BackButtonInteraction.dismiss → back ends the tour, the page stays
// BackButtonInteraction.block → back does nothing while a step shows
builder: const HomePage(),
);
| Value | Back while a step shows |
|---|---|
passThrough (default) |
Does what it does without a tour, usually closing the page. |
dismiss |
Ends the tour, like Esc. The page stays open. |
previous |
Goes to the previous step. On the first step it ends the tour, so back always gets the user out. The page stays open. |
block |
Does nothing. The user leaves the tour with its own buttons. |
- It covers the Android back button and back gesture, and the browser's back button. Android's predictive back doesn't preview leaving the page or the app while a step shows, because the page tells the system it handles back.
- Only while a step is on screen. Before and after the tour, while the tour waits for a step whose page isn't open, and while a step is hidden under another page or a dialog, back works as usual. A dialog over a step closes on back.
- Wherever
ShowCaseWidgetis, on the page or inMaterialApp.builderfor a tour across screens. The handling is attached to the page of the step that shows. Withprevious, going back to a step on the page below leaves the current page with no step, so the next back closes it and the earlier step appears. - Not inside a nested
Navigatoron its own. A step on a page of a nested navigator (one per tab, say) never sees back: like aPopScopethere, it only hears presses that reach that navigator, and by default the root navigator takes them and closes the page around it. Forward back to the nested navigator, with aNavigatorPopHandleraround it or a router that does so, and the tour handles it there. - Anything but
passThroughworks likePopScope(canPop: false)on the step's page: the iOS swipe that closes the page is off while the step shows, andNavigator.maybePopcounts as back.Navigator.popstill closes the page. - Esc is separate. On desktop and web it keeps dismissing the tour through keyboard navigation.
Accessibility & keyboard navigation #
The active step is keyboard-navigable and announced to screen readers out of the box (both default to on):
ShowCaseWidget(
enableKeyboardNavigation: true, // default
enableAutoAnnouncements: true, // default
builder: const HomePage(),
);
Keyboard (web/desktop; harmless on mobile):
| Key | Action |
|---|---|
→ / ↓ / Enter |
Next step |
← / ↑ |
Previous step |
Esc |
Dismiss the tour |
Keyboard handling is focus-scoped: it only acts while the showcase overlay holds focus, so it never hijacks keys from the rest of your app.
Screen readers: each step's title and description are announced via
TalkBack / VoiceOver as it becomes active. Override the spoken text per step
(handy for a custom container tooltip with no title/description):
Showcase(
key: _logo,
semanticLabel: 'Your company logo. Double tap to go home.',
child: const FlutterLogo(),
);
Pointer cursor (web / desktop) #
On web and desktop, hovering a part of the tour that reacts to a click shows the
click cursor, so the tour reads as interactive. It applies to the highlighted
target, a tooltip that has onToolTipClick or disposeOnTap, and the built-in
"Skip" button — a tooltip that does nothing on tap deliberately keeps the default
cursor, so the pointer never promises a click that isn't there. The buttons in
ShowCaseDefaultActions are Material buttons and already behave this way.
It's on by default and costs nothing on mobile. Turn it off tour-wide:
ShowCaseWidget(
enablePointerCursor: false, // keep the plain arrow everywhere
builder: const HomePage(),
);
Or set the cursor for a single step — an explicit value wins even when
enablePointerCursor is false:
Showcase(
key: _two,
title: 'Read only',
description: 'This one is just a heads-up.',
targetMouseCursor: SystemMouseCursors.forbidden,
tooltipMouseCursor: SystemMouseCursors.help,
child: const StatusBadge(),
);
Use MouseCursor.defer to leave a step alone and keep whatever cursor the
underlying widget already uses.
Blur the background #
// For all steps:
ShowCaseWidget(blurValue: 2, builder: ...);
// Or per step:
Showcase(blurValue: 2, key: _one, description: '...', child: ...);
Tooltip position #
Force the tooltip to a side of the target with TooltipPosition.top, .bottom,
.left, or .right (defaults to whichever vertical space is available):
Showcase(
key: _one,
description: 'Shown to the right of the target',
tooltipPosition: TooltipPosition.right,
child: const Icon(Icons.menu),
);
left/rightuse the default title/description tooltip; customcontainertooltips and action buttons outside the tooltip keep top/bottom placement.
A tooltip that does not fit on its side moves to the opposite one when it fits
there: top and bottom swap, as do left and right (a side fits when the
tooltip is on screen there and clear of the target). With no position set, a
tooltip that fits neither above nor below the target, such as next to a tall
target, goes to its left or right instead. It only moves where all of it,
buttons included, fits on the screen above the keyboard. A tooltip that fits
stays exactly where it was, and one that fits nowhere is placed as before. A
Showcase.withWidget container moves only when it is measured; with a height
it stays on the side you ask for.
Add extra space between the target and the tooltip with targetTooltipGap
(logical pixels, default 0). It applies to every side:
Showcase(
key: _one,
description: 'Sits a little further from the target',
targetTooltipGap: 16,
child: const Icon(Icons.menu),
);
Keep the tooltip clear of the screen edges with toolTipMargin (default
EdgeInsets.all(20)). The tooltip is clamped to stay at least this far from each
edge, and its size is capped to fit within the margins — useful to leave room
for a status bar, notch, or your own fixed UI:
Showcase(
key: _one,
description: 'Stays clear of the edges',
toolTipMargin: const EdgeInsets.symmetric(horizontal: 24, vertical: 48),
child: const Icon(Icons.menu),
);
Skip off-screen steps #
If some showcased widgets are rendered conditionally, enable
autoSkipUnmountedSteps so steps whose target isn't currently in the widget tree
are skipped automatically instead of showing an empty overlay:
ShowCaseWidget(
autoSkipUnmountedSteps: true,
builder: const HomePage(),
);
autoSkipUnmountedSteps applies to every step. To skip some missing steps and
wait for others, pass onShouldSkipUnmountedStep instead. It's called with the
step's index and key whenever the tour reaches a step whose widget isn't in the
tree: return true to skip it, or false to stay on it until the widget
appears (for example, a step on a page the user hasn't opened yet):
ShowCaseWidget(
onShouldSkipUnmountedStep: (index, key) {
// The details page is opened later in the tour: wait for it.
if (key == detailsKey) return false;
// Anything else that isn't on screen (e.g. a promo banner that is
// sometimes hidden) is skipped.
return true;
},
builder: const HomePage(),
);
When onShouldSkipUnmountedStep is set, it decides for every step and
autoSkipUnmountedSteps is ignored. It's used when the tour starts, moves
forward and moves back with previous(). goTo(), goToKey() and a step
returned by onResolveNextStep are explicit jumps: they always go to the step
you asked for, whether its widget is on screen or not.
Right-to-left (RTL) #
The tooltip inherits the ambient text direction, so RTL text (e.g. Arabic) is measured and laid out correctly when your app is RTL — no extra configuration needed.
The built-in buttons follow it too: Previous is on the right and Next on the left, each button's icon sits to the right of its label, and the progress indicator and Skip button swap sides. To translate the buttons' text, see Translating the tour.
When a step's text runs in the other direction from the app, such as an Arabic title in an English app, give the title or description its own direction:
Showcase(
key: _one,
title: 'القائمة',
titleTextDirection: TextDirection.rtl,
description: 'Open the menu', // follows the app
child: const Icon(Icons.menu),
);
titleTextDirection and descriptionTextDirection order that text's words
and punctuation, and set which side titleAlignment / descriptionAlignment
start from when it wraps. The tooltip is measured with the same direction,
and the screen-reader announcement is made in the direction of the text it
starts with (the title, or the description when there is no title). Left
null (the default), the text follows the app.
Enable or disable globally #
ShowCaseWidget(
enableShowcase: false, // every Showcase just renders its child, no overlay
builder: const HomePage(),
);
enableShowcase can also be flipped at runtime — useful for a "don't show me
tips" setting. Switching it to false while a tour is running ends that tour:
the overlay disappears, the step that was showing gets its onDismiss, and the
tour-level onDismiss reports the step the user was
left on. Switching it back to true does not resume the tour; call
startShowCase again to start a new one.
startShowCase throws while the showcase is disabled, so check the flag (or
just keep it enabled) before starting a tour.
Auto-scrolling caveat #
Set enableAutoScroll: true to scroll an off-screen target into view before its
step starts. This does not work reliably in scroll views that build children
on demand (e.g. ListView, GridView), because the target widget may not be
attached to the tree when the tour reaches that step.
Control where the target lands with scrollAlignment (a fraction of the scroll
axis: 0.0 = leading edge, 0.5 = centered, 1.0 = trailing edge). Set it
tour-wide on ShowCaseWidget (default 0.5) and override it per step with
Showcase.scrollAlignment:
ShowCaseWidget(
enableAutoScroll: true,
scrollAlignment: 0.1, // rest targets near the top of the viewport
builder: const HomePage(),
);
// ...and per step:
Showcase(
key: _key,
scrollAlignment: 0.5, // this step centers instead
description: 'Centered when scrolled into view',
child: child,
);
Turn auto-scroll on or off for a single step with Showcase.enableAutoScroll:
true scrolls to that step's target even when the tour does not auto-scroll,
false leaves the scroll position alone for that step, and null (the
default) follows ShowCaseWidget.enableAutoScroll.
If you have a small number of children, prefer SingleChildScrollView. Otherwise,
assign a ScrollController and scroll to the target manually inside onStart:
final _controller = ScrollController();
ShowCaseWidget(
onStart: (index, key) {
if (index == 0) {
WidgetsBinding.instance.addPostFrameCallback((_) {
// Scroll to where the showcased widget is rendered (nearest
// position works too — e.g. 990 instead of 1000).
_controller.jumpTo(1000);
});
}
},
builder: const HomePage(),
);
API reference #
Controller — ShowCaseWidget.of(context) #
| Member | Description |
|---|---|
startShowCase(List<GlobalKey> keys, {bool force, int startAt, Duration delay}) |
Start the tour in key order. force: true bypasses onShouldStartShowcase; startAt opens it on that zero-based step (default 0); delay starts it that much later (default Duration.zero, at once), consulting the guard then. |
next() |
Advance to the next step. |
previous() |
Go back one step. |
goTo(int index) |
Jump to a step by its zero-based index. |
goToKey(GlobalKey key) |
Jump to a step by its GlobalKey. |
dismiss() |
End the whole tour (and call off a pending start). |
cancelDelayedStart() |
Silently call off a start still waiting on its delay or the guard; returns whether one was pending. |
isStartPending |
Whether a startShowCase call has yet to start its tour. |
currentIndex |
Zero-based index of the active step, or null when no tour is running. |
totalSteps |
Number of steps in the running tour (0 when none). |
isShowcaseRunning |
Whether a tour is currently active. |
isPreparingStep |
Whether the tour waits on onBeforeStep before it shows the step at currentIndex (no step shows meanwhile). |
labels |
The ShowcaseLabels the built-in buttons show. |
isTargetRendered(GlobalKey key) |
Whether that step's target is mounted and laid out on screen. |
previousTargetRect |
Global bounds of the step the tour just left (null outside a transition). |
addOnStartCallback(cb) / removeOnStartCallback(cb) |
Register/unregister a step-start listener at runtime. |
addOnCompleteCallback(cb) / removeOnCompleteCallback(cb) |
Register/unregister a step-complete listener at runtime. |
addOnFinishCallback(cb) / removeOnFinishCallback(cb) |
Register/unregister a tour-finish listener at runtime (runs after onFinish). |
addOnDismissCallback(cb) / removeOnDismissCallback(cb) |
Register/unregister an early-dismiss listener at runtime, void Function(GlobalKey?) (runs after onDismiss). |
ShowCaseWidget properties #
| Name | Type | Default | Description |
|---|---|---|---|
| builder | Widget | required | The subtree that contains the Showcase widgets (a Builder also works). |
| style | ShowcaseStyle | const ShowcaseStyle() |
Default tooltip styling for every Showcase in the tree, including overlayOpacity. |
| blurValue | double | 0 | Gaussian blur applied to the overlay. |
| autoPlay | bool | false | Automatically advance to the next step. |
| autoPlayDelay | Duration | Duration(milliseconds: 2000) |
Visibility time of a step when autoPlay is enabled. |
| enableAutoPlayLock | bool | false | Block user interaction on the overlay while auto-playing. |
| enableAutoScroll | bool | false | Auto-scroll so the next target becomes visible (Showcase.enableAutoScroll overrides it per step). |
| scrollDuration | Duration | Duration(milliseconds: 300) |
Duration of the auto-scroll animation. |
| scrollAlignment | double | 0.5 |
Where an auto-scrolled target rests (0 = leading, 0.5 = center, 1 = trailing). |
| barrierInteraction | BarrierInteraction | BarrierInteraction.next |
What a background tap does: next (advance), dismiss (end tour), none. |
| disableBarrierInteraction | bool | false | Deprecated (removed in 3.0.0): use barrierInteraction: BarrierInteraction.none. |
| onBarrierClick | VoidCallback? | Called on every barrier tap (even when barrierInteraction is none), before the step's Showcase.onBarrierClick. |
|
| backButtonInteraction | BackButtonInteraction | BackButtonInteraction.passThrough |
What the system back button does while a step shows: passThrough (closes the page, as without a tour), dismiss, previous (ends the tour from the first step), block. |
| globalFloatingActionWidget | WidgetBuilder? | Screen-anchored widget shown above the overlay on every step (you position it). | |
| hideFloatingActionWidgetForShowcase | List<GlobalKey> |
const [] |
Steps on which the global floating widget is hidden. |
| disableScaleAnimation | bool | false | Disable the tooltip scale transition for all steps. |
| disableMovingAnimation | bool | false | Disable the bouncing/moving transition for all steps. |
| onStart | ShowcaseStepCallback? | Called on the start of each step with (int? index, GlobalKey key). |
|
| onBeforeStep | FutureOr<void> Function(int, GlobalKey)? |
Runs before each step shows, before its onStart; a returned Future is awaited (see Prepare a step before it shows). |
|
| onComplete | ShowcaseStepCallback? | Called on the completion of each step with (int? index, GlobalKey key). |
|
| onFinish | VoidCallback? | Called when all steps are completed (normal finish). | |
| onDismiss | void Function(GlobalKey?)? |
Called when the tour is closed early; receives the step it was dismissed at. | |
| enableShowcase | bool | true | Enable or disable showcasing globally. |
| autoSkipUnmountedSteps | bool | false | Skip steps whose target widget is not currently mounted. |
| onShouldSkipUnmountedStep | bool Function(int, GlobalKey)? |
Per step: return true to skip an unmounted step, false to wait for it. |
|
| enableKeyboardNavigation | bool | true | Drive the active step with a hardware keyboard (Esc / arrows / Enter). |
| enablePointerCursor | bool | true | Show a click cursor on the clickable parts of the tour (web/desktop). |
| enableStepTransition | bool | false | Glide the highlight from the previous target to the next one. |
| stepTransitionDuration | Duration | Duration(milliseconds: 300) |
Length of the step-transition glide. |
| stepTransitionCurve | Curve | Curves.easeInOut |
Curve of the step-transition glide. |
| enableAutoAnnouncements | bool | true | Announce each step's title/description to screen readers. |
| showProgress | bool | false | Show the built-in step indicator in the default tooltip. |
| progressStyle | ShowcaseProgressStyle | ShowcaseProgressStyle.dots |
Indicator style: dots or a 1/6 numeric counter. |
| showSkip | bool | false | Show a "Skip" button in the default tooltip that ends the tour. |
| labels | ShowcaseLabels | const ShowcaseLabels() |
Text of the built-in Next / Previous / Stop / Skip buttons (see Translating the tour). |
| skipButtonText | String? | Deprecated, removed in 3.0.0: use labels: ShowcaseLabels(skip: ...). When set, wins over labels.skip. |
|
| showcaseId | String? | Identifier passed to onShouldStartShowcase. |
|
| onShouldStartShowcase | FutureOr<bool> Function(String?)? |
Guard run before a tour starts; return false to skip it. |
|
| onResolveNextStep | GlobalKey? Function(int, GlobalKey)? | Decide the next step at runtime: return a step key to branch, or null. |
ShowcaseLabels properties #
| Name | Type | Default | Description |
|---|---|---|---|
| next | String | 'Next' |
Text of the Next button. |
| previous | String | 'Previous' |
Text of the Previous button. |
| stop | String | 'Stop' |
Text of the Stop button, which ends the tour. |
| skip | String | 'Skip' |
Text of the Skip button shown by showSkip. |
copyWith returns a copy with some labels replaced.
ActionButtonConfig properties #
| Name | Type | Default | Description |
|---|---|---|---|
| text | String? | ShowCaseWidget.labels |
Text of the button; wins over the tour's labels. |
| icon | Widget? | Icon or image shown before the text. | |
| textColor | Color? | ShowcaseStyle → app theme |
Color of the text. |
| textButtonBgColor | Color | Colors.transparent |
Background color of the button. |
| callback | VoidCallback? | Called on tap instead of the default action. | |
| buttonVisible | bool | true | Show the button. |
| buttonTextVisible | bool | true | Show the text; when false only the icon shows and screen readers read the text. |
| textDirection | TextDirection? | the app's direction | Order of icon and text inside the button. |
Showcase and Showcase.withWidget properties #
| Name | Type | Default | Description | Showcase |
Showcase.withWidget |
|---|---|---|---|---|---|
| key | GlobalKey | required | Unique global key for the step. | ✅ | ✅ |
| child | Widget | required | The target widget to highlight. | ✅ | ✅ |
| keys | List<GlobalKey>? |
Extra widgets to highlight in the same step (wrap each in a MultiView). |
✅ | ✅ | |
| title | String? | Title of the default tooltip. | ✅ | ||
| description | String? | Description of the default tooltip (optional). | ✅ | ||
| container | Widget? | A fully custom tooltip widget. | ✅ | ||
| height | double? | its laid-out height | Height of the custom tooltip, for placing it. Measured when unset. | ✅ | |
| width | double? | its laid-out width | Width of the custom tooltip, for placing it. Measured when unset. | ✅ | |
| titleTextStyle | TextStyle? | ShowcaseStyle |
Text style of the title. | ✅ | |
| descTextStyle | TextStyle? | ShowcaseStyle |
Text style of the description. | ✅ | |
| titleAlignment | TextAlign | TextAlign.start |
Alignment of the title. | ✅ | |
| descriptionAlignment | TextAlign | TextAlign.start |
Alignment of the description. | ✅ | |
| titleTextDirection | TextDirection? | the app's direction | Text direction of the title, when it differs from the app's. | ✅ | |
| descriptionTextDirection | TextDirection? | the app's direction | Text direction of the description, when it differs from the app's. | ✅ | |
| tooltipBackgroundColor | Color? | ShowcaseStyle → app theme |
Background color of the default tooltip. | ✅ | |
| textColor | Color? | ShowcaseStyle → app theme |
Text color of the default tooltip. | ✅ | |
| tooltipBorderRadius | BorderRadius? | ShowcaseStyle → BorderRadius.circular(8) |
Border radius of the default tooltip. | ✅ | |
| tooltipPadding | EdgeInsets | EdgeInsets.symmetric(vertical: 8, horizontal: 8) |
Padding inside the tooltip. | ✅ | |
| titlePadding | EdgeInsets? | EdgeInsets.zero |
Padding around the title. | ✅ | |
| descriptionPadding | EdgeInsets? | EdgeInsets.zero |
Padding around the description. | ✅ | |
| showArrow | bool | true | Show the tooltip arrow pointing at the target. | ✅ | |
| tooltipPosition | TooltipPosition? | Side of the tooltip (top / bottom / left / right), swapped if it does not fit. |
✅ | ✅ | |
| actions | Widget? | Action buttons widget (e.g. ShowCaseDefaultActions). |
✅ | ✅ | |
| actionSettings | ActionsSettings? | const ActionsSettings() |
Container styling for the action buttons. | ✅ | ✅ |
| actionButtonsPosition | ActionButtonsPosition? | Manual position for the action buttons. | ✅ | ✅ | |
| floatingActionWidget | Widget? | Screen-anchored widget shown while this step is active (overrides the global one). | ✅ | ✅ | |
| autoPlayDelay | Duration? | ShowCaseWidget.autoPlayDelay |
Per-step auto-play visibility time, overriding the tour-wide delay. | ✅ | ✅ |
| targetTooltipGap | double | 0 |
Extra space (logical px) between the target and the tooltip; applies to all sides. | ✅ | ✅ |
| toolTipMargin | EdgeInsets | EdgeInsets.all(20) |
Minimum margin between the tooltip and the screen edges (also caps its size). | ✅ | ✅ |
| scrollAlignment | double? | ShowCaseWidget.scrollAlignment |
Where this step's target rests when auto-scrolled (0 = leading, 0.5 = center, 1 = trailing). | ✅ | ✅ |
| enableAutoScroll | bool? | ShowCaseWidget.enableAutoScroll |
Whether this step scrolls its target into view; overrides the tour-wide value. | ✅ | ✅ |
| barrierInteraction | BarrierInteraction? | ShowCaseWidget.barrierInteraction |
What a background tap does on this step; overrides the tour-wide value. | ✅ | ✅ |
| onBarrierClick | VoidCallback? | Called on a background tap during this step, after ShowCaseWidget.onBarrierClick. |
✅ | ✅ | |
| targetShapeBorder | ShapeBorder | RoundedRectangleBorder(...) |
Shape applied to the highlight (used when targetBorderRadius is null). |
✅ | ✅ |
| highlightExactShape | bool | false | Highlight the target by its actual painted shape (snapshot) instead of targetShapeBorder. |
✅ | ✅ |
| targetBorderRadius | BorderRadius? | Border radius of the highlight. | ✅ | ✅ | |
| enablePulseAnimation | bool | false | Draw an animated ring that pulses outward around the highlight. | ✅ | ✅ |
| pulseColor | Color? | ShowcaseStyle → white or black |
Color of the pulsing ring. | ✅ | ✅ |
| pulseDuration | Duration | Duration(milliseconds: 1500) |
Length of one full pulse cycle (smaller is faster). | ✅ | ✅ |
| highlightBorderColor | Color? | Color of a border drawn around the highlight (off when null). | ✅ | ✅ | |
| highlightBorderWidth | double? | 2 |
Width of the highlight border. | ✅ | ✅ |
| arrowColor | Color? | ShowcaseStyle → tooltip bg |
Color of the default tooltip arrow. | ✅ | |
| arrowWidth | double? | 18 |
Width (base) of the default tooltip arrow. | ✅ | |
| arrowHeight | double? | 9 |
Height (depth) of the default tooltip arrow. | ✅ | |
| targetPadding | EdgeInsets | EdgeInsets.zero |
Padding around the highlight. | ✅ | ✅ |
| overlayColor | Color? | ShowcaseStyle → app theme |
Color of the overlay scrim. | ✅ | ✅ |
| overlayOpacity | double? | ShowcaseStyle → 0.75 |
Opacity of the overlay scrim, from 0 to 1. | ✅ | ✅ |
| blurValue | double? | ShowCaseWidget.blurValue |
Gaussian blur on the overlay. | ✅ | ✅ |
| disableDefaultTargetGestures | bool | false | Disable the default gestures on the target. | ✅ | ✅ |
| disposeOnTap | bool? | Dismiss the whole tour when the target/tooltip is tapped. | ✅ | ✅ | |
| onTargetClick | VoidCallback? | Called when the target is tapped (requires disposeOnTap). |
✅ | ✅ | |
| onTargetDoubleTap | VoidCallback? | Called when the target is double-tapped. | ✅ | ✅ | |
| onTargetLongPress | VoidCallback? | Called when the target is long-pressed. | ✅ | ✅ | |
| onToolTipClick | VoidCallback? | Called when the tooltip is tapped. | ✅ | ||
| onShow | VoidCallback? | Called when this step becomes active. | ✅ | ✅ | |
| onDismiss | VoidCallback? | Called when this step stops being active (advanced past, navigated away, or dismissed). | ✅ | ✅ | |
| onTargetRectUpdate | void Function(Rect)? |
Called with the target's global bounds when they change (and once when the step shows). | ✅ | ✅ | |
| targetMouseCursor | MouseCursor? | Cursor over this step's target; overrides the resolved one (web/desktop). | ✅ | ✅ | |
| tooltipMouseCursor | MouseCursor? | Cursor over this step's tooltip; overrides the resolved one (web/desktop). | ✅ | ✅ | |
| semanticLabel | String? | Text announced to screen readers for this step (defaults to title + description). | ✅ | ✅ | |
| disableMovingAnimation | bool? | ShowCaseWidget.disableMovingAnimation |
Disable the bouncing/moving transition. | ✅ | ✅ |
| disableScaleAnimation | bool? | ShowCaseWidget.disableScaleAnimation |
Disable the initial scale transition. | ✅ | |
| movingAnimationDuration | Duration | Duration(milliseconds: 2000) |
Duration of the moving animation. | ✅ | ✅ |
| scaleAnimationDuration | Duration | Duration(milliseconds: 300) |
Duration of the scale animation. | ✅ | |
| scaleAnimationCurve | Curve | Curves.easeIn |
Curve of the scale animation. | ✅ | |
| scaleAnimationAlignment | Alignment? | Origin of the scale animation. | ✅ | ||
| scrollLoadingWidget | Widget? | a CircularProgressIndicator |
Loading widget shown while auto-scrolling to the target. | ✅ | ✅ |
Example #
See the full example app for the menu, profile, custom action buttons, global styling, and the multi-widget step in action.
License #
Released under the MIT License.
