
Spotlyt
✨ Spotlight-style widget highlighting with blur + dim overlays.
Spotlyt lets you guide users through UI by highlighting specific widgets while dimming or blurring the background.
Useful for onboarding, feature discovery, in-app tutorials, upgrade prompts, and walkthrough flows.
⭐ Features
✔ Highlight single or multiple widgets
✔ Blur, dim or both at the same time
✔ Focus window with adjustable border radius & padding
✔ Per-target interaction control (tap-through or absorb)
✔ Overlay UI builder above spotlight
✔ Works anywhere — no widget restructuring
✔ Implemented using OverlayEntry
✔ Material context inheritance supported
📦 Installation
dependencies:
spotlyt: ^1.0.3
import 'package:spotlyt/spotlyt.dart';
🚀 Quick Example: Highlight One Widget
final targetKey = GlobalKey();
Spotlyt.instance.show(
context: context,
targetKey: targetKey,
padding: 10,
borderRadius: 18,
blurSigma: 14,
dimColor: Colors.black.withOpacity(0.6),
dismissOnTapOutside: true,
);
Attach the key:
Container(
key: targetKey,
child: ...
)
⭐ Highlight Multiple Widgets
Spotlyt.instance.showMany(
context: context,
targets: [
SpotlytTargetConfig(
key: summaryKey,
padding: 16,
borderRadius: 20,
),
SpotlytTargetConfig(
key: buttonKey,
padding: 8,
borderRadius: 999,
absorbTouchesInsideHole: true,
),
],
blurSigma: 16,
dimColor: Colors.black.withOpacity(0.65),
dismissOnTapOutside: false,
onDismiss: () {
print("Highlight closed");
},
);
🎨 Showing Custom Content Above Spotlight
You can show custom overlay UI (like callouts, tooltips, buttons, instructions):
Spotlyt.instance.showMany(
context: context,
targets: [...],
overlayBuilder: (context, targets) {
return Positioned(
bottom: 32,
left: 0,
right: 0,
child: Center(
child: FilledButton(
onPressed: Spotlyt.instance.hide,
child: const Text("Got it!"),
),
),
);
},
);
This widget is rendered above all blur/dim effects.
⚙️ SpotlytTargetConfig Options
| Property | Type | Description |
|---|---|---|
key |
GlobalKey | Widget to highlight |
padding |
double | Expand highlight area |
borderRadius |
double | Roundness of cutout |
absorbTouchesInsideHole |
bool | Control tap behavior |
Example:
SpotlytTargetConfig(
key: buttonKey,
padding: 8,
borderRadius: 999,
absorbTouchesInsideHole: true,
)
🎯 Touch Behavior Explained
Inside spotlight hole
Depends on absorbTouchesInsideHole
| absorbTouchesInsideHole | Behavior |
|---|---|
| false | taps pass through to widget below |
| true | taps stay on overlay (useful for onboarding UIs) |
Outside spotlight hole
- tap always goes to overlay
- can dismiss highlight
- can trigger custom UI callback
❌ Hiding Spotlight
Spotlyt.instance.hide();
📄 Full Example
Check complete runnable example in:
example/lib/main.dart
🧩 Real Use Cases
🟣 Feature discovery
🟣 What’s new screens
🟣 Onboarding tutorial
🟣 Call-to-action promotion
🟣 Explain complex UI sections
🟣 Guided navigation flows
💬 Contributing
Pull requests, ideas & improvements are welcome.
If you discover a feature that could improve onboarding UX — open an issue!
Spotlyt aims to make highlighting intuitive and beautifully animated out-of-box.
✦ Make your UI stand out, one highlight at a time ✦