I'd like to display a tutorial overlay on a screen in my Flutter app. I even found a good candidate which almost does what I'd want: that's the https://pub.dev/packages/overlay_tutorial/ plugin. The user would press a help button on the screen, the overlay would pop up with the cut outs. I don't want anything to receive clicks though (https://github.com/TabooSun/overlay_tutorial/issues/26), however the overlay should disappear if the user clicks anywhere on the screen.
I tried to use AbsorbPointer and it successfully intercepts the clicks and there's no more click through and things happening bellow the overlay. See my fork: https://github.com/CsabaConsulting/overlay_tutorial/commit/9d809d51bcf55b9c8044d07d151c696bdb55abe6 However now there's no way to click away the overlay either.
@override
Widget build(BuildContext context) {
return Stack(
children: [
AbsorbPointer(
absorbing: widget.enabled && widget.absorbPointer,
ignoringSemantics: true,
child: _OverlayTutorialBackbone(
overlayColor: widget.overlayColor,
enabled: widget.enabled,
overlayTutorialHoles: _overlayTutorialHoles,
onEntryRectCalculated: () {
_updateChildren();
},
child: widget.child,
),
),
if (widget.enabled) ...[
..._overlayTutorialHoles.entries
.map((entry) {
What I'd need is an onTap or an onClick handler for the AbsorbPointer. I could have wrap stuff into a GestureDetector, but that would intercept clicks and gestures all the time. What's a good solution here?