tutorial_overlay

tutorial_overlay is a Flutter package that makes it easy to create interactive, step-by-step tutorials in your app. It overlays highlights on specific widgets and guides users with custom tooltips and indicators, perfect for onboarding or feature discovery.

✨ Features

  • Step-by-Step Guidance: Highlight widgets and walk users through your app.
  • Custom Tooltips: Add any widget (text, buttons, images, etc.) to explain each step.
  • Custom Indicators: Use arrows or icons to point users to the right spot.
  • Multi-Page Support: Keep the tutorial flowing across different screens.

🧠 Use Cases

  • User onboarding walkthroughs
  • Feature discovery and in-app tips
  • Interactive training for internal apps

Exam1ple

git clone https://github.com/xinyi-chong/tutorial_overlay.git
cd tutorial_overlay/example
flutter run

Getting started

Installation

Add tutorial_overlay to your pubspec.yaml:

dependencies:
    tutorial_overlay: ^<latest_version>

Run:

flutter pub get

Check the pub.dev page for the latest version.

Usage

  1. Use a GlobalKey to mark the widget you want to highlight (e.g., a button):
final helpButtonKey = GlobalKey();

IconButton(
    key: helpButtonKey,
    onPressed: () {
      tutorial.startTutorial('home');
    },
    icon: Icon(Icons.help),
)
  1. Define Tutorial Steps and wrap your app with the tutorial provider:


void main() {
  final tutorial = Tutorial<String>({
    'home': [
      TutorialStep(
        widgetKey: helpButtonKey,
        child: const Text('Tap here to get help'),
      ),
    ],
  });

  runApp(tutorial.provide(const MyApp()));
}
  1. Wrap your page with TutorialOverlay, specifying the tutorialId:
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: TutorialOverlay<String>(
        tutorialId: 'home',  // Matches the key in the tutorial map
        child: const MyHomePage(),
      ),
    );
  }
}
  1. Control the Tutorial
  tutorial.startTutorial('home');
  tutorial.nextStep('home');
  tutorial.previousStep('home');
  tutorial.endTutorial('home');

Navigation: To move between pages, use:

tutorial.nextStep('home', route: '/your-page', context: context); // Navigate to a new route
tutorial.previousStep('home', backToPreviousPage: true, context: context); // Go back
  1. Updating Tutorial You can dynamically update the tutorials after initialization by using updateTutorial:
  tutorial.updateTutorial(newTutorial);