showcase_tutorial 2.0.1
showcase_tutorial: ^2.0.1 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). - Conditional / branching tours — let a step decide the next step at runtime
with
onResolveNextStep. - 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 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.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).
Table of contents #
- Migrating from 1.x to 2.0
- 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
- Tours across screens
- Target interactions
- Step lifecycle callbacks
- Background (barrier) tap behavior
- 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.0.1Or 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,
height: 80,
width: 140,
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),
);
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), andoverlayOpacitysets 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.
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);
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
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.
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. 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> {
void _onStep(int? index, GlobalKey key) => setState(() => _index = index);
@override
void didChangeDependencies() {
super.didChangeDependencies();
ShowCaseWidget.of(context).addOnStartCallback(_onStep);
}
@override
void dispose() {
ShowCaseWidget.of(context).removeOnStartCallback(_onStep);
super.dispose();
}
}
There's an addOnCompleteCallback / removeOnCompleteCallback pair too. Both
run in addition to the widget-level callbacks, in registration order; 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.
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 keep top/bottom placement.
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.
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,
);
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}) |
Start the tour in key order. force: true bypasses onShouldStartShowcase; startAt opens it on that zero-based step (default 0). |
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. |
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. |
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. |
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. |
| 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. |
| 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). |
|
| 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). |
|
| 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? | Height of the custom tooltip. | ✅ | ||
| width | double? | Width of the custom tooltip. | ✅ | ||
| 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. | ✅ | |
| 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? | Force the tooltip to a side (top / bottom / left / right). |
✅ | ✅ | |
| 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). | ✅ | ✅ |
| barrierInteraction | BarrierInteraction? | ShowCaseWidget.barrierInteraction |
What a background tap does on this step; overrides the tour-wide value. | ✅ | ✅ |
| 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 | 0.75 | Opacity of the overlay scrim. | ✅ | ✅ |
| 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.