r/FlutterDev • • Aug 23 '26

Plugin I built a Flutter onboarding package where the spotlight doesn't drift — and the pointer teaches the gesture

I needed a first-run walkthrough for an app and hit two things that annoyed me.

First, the highlight would end up in the wrong place.

A lot of coach-mark implementations resolve the target's position once and paint it. Scroll the list, open the keyboard, rotate the device, resize a desktop window — and suddenly the hole is next to the button instead of on it.

Second, a dimmed hole tells the user where something is, but not how to use it.

"Drag this card to that column" isn't something a static highlight can really express.

So I built keyspot:

- The spotlight and pointer re-resolve the target's geometry every frame from its GlobalKey, so they can track through scrolling, insets, rotation and resizing.

- An animated hand pointer that glides in a straight line or along an arc, rotates from its current angle, and tap-pulses — enough to demonstrate interactions like drag and pinch rather than simply pointing at something.

- Pointer animations resolve from actual AnimationController completion rather than Future.delayed timing, so `await pointer.moveTo(...)` actually means the movement has finished.

- Barrier modes where only the cut-out is tappable while the real widget's `onPressed` still fires — useful when the walkthrough should require the user to actually perform the step.

- The tracker is also public API (`KeyspotAnchorTracker`), so it can be used independently for things like badges or connector lines attached to widgets.

- Zero runtime dependencies. The hand pointer is rendered with CustomPainter rather than an image asset.

- Supports all six Flutter platforms.

Live demo: https://shrey-17bhardwaj.github.io/keyspot/

pub.dev: https://pub.dev/packages/keyspot

Source: https://github.com/shrey-17bhardwaj/keyspot

It's currently at 0.3.1, and the API may still change before 1.0.

I'd genuinely like feedback on where this approach breaks — especially around nested navigators, heavily lazy lists, overlays, or anything else where widget geometry gets complicated.

27 Upvotes

12 comments sorted by

1

u/Tom_Vogel Aug 23 '26

This is such a cool idea! I built something similar for my app Loop to visually teach users its gestures, so I know how much more intuitive an animated pointer can be than a static coach mark. Having this available as a reusable package—especially with the spotlight tracking its target—is really useful. Great work!

1

u/Miserable-Daikon5795 Aug 23 '26

Thanks! Loop sounds like exactly the case I had in mind.

Curious how you built yours — did you hit the drift problem when the target moved? Live tracking took me the most iterations by far.

1

u/Tom_Vogel Aug 23 '26

I mostly sidestepped the general case rather than solving it 😄 Loop renders the actual app widgets inside a fixed-size device preview, with the gesture overlay in the same Stack and coordinate space. The pointer uses fixed anchor positions, and whenever the target itself moves, both are driven by the same AnimationController, so they stay visually in sync.

2

u/Miserable-Daikon5795 Aug 24 '26

That's the right call when you own both sides — driving the target and the pointer from the same controller means they can't drift by construction, which beats measuring every frame.

I couldn't assume that: keyspot points at arbitrary widgets in someone else's tree, and the movement usually isn't mine — a scroll, a keyboard inset, someone's implicit animation. Re-measuring is basically the tax for not controlling the thing you're pointing at.

Device-preview framing is a nice trick though. Might steal it for the docs.

1

u/MjnMixael Aug 23 '26

Nice work. Only but of feedback I have is I thought the "Teach Pinch" wasn't super clear. Can it do two pointers for gestures like that?

1

u/Miserable-Daikon5795 Aug 23 '26

Fair — it's one pointer doing two sequential moves, so it reads more like two drags than a pinch.

Workaround that works today: PointerStyle.builder takes any widget, so you can make the pointer itself a two-finger pinch GIF or Lottie. Not truly two tracked pointers, but it demonstrates the gesture properly.

Real multi-pointer support is on my list — thanks for flagging it.

1

u/TheManuz Aug 23 '26

Is the live demo compiled with WASM?

It felt really smooth compared to other Flutter webapp.

1

u/Miserable-Daikon5795 Aug 24 '26

Nope — plain flutter build web --release, so dart2js with the CanvasKit renderer. No --wasm.

Which I'll take as a good sign, honestly. My guess is it's less about the build and more that the overlays do very little per frame — the tracker re-measures the target rect each tick but only calls setState when the rect actually changed, so a static screen costs almost nothing. All the animation is plain AnimationControllers and one CustomPaint, no images or heavy layers.

1

u/fabier Oct 05 '26

Hey this is a great package. I've used it in two apps now to build very pleasant tutorial experiences.

https://seedrun.app is a deck builder video game and an entry I have into the Serverpod hackathon going on right now. I really enjoyed making the tutorial with your package. You can see it in action here: https://seedrun.app/#/intro

I also added it to https://app.tooli.rent . We actually used it in a number of places to lead people around the app. This was much more distributed.

Anyways, just wanted to hype you up. Nice package! Keep it going ❤️!

2

u/Miserable-Daikon5795 Oct 05 '26

Thank you so much for the kind words! ❤️ It’s awesome to see it powering the tutorials in both Seedrun and Tooli—best of luck with the Serverpod hackathon!
I'm thrilled the package has been so helpful. Word of mouth is huge for small open-source projects, so if you happen to know other devs who might need a similar solution, or feel like giving it a shoutout, it would mean the world.
Keep building great things! 🚀

2

u/fabier Oct 05 '26

I'll definitely mention it when possible 🙂.

1

u/Miserable-Daikon5795 Oct 05 '26

Means a lot ! ❤️