Skip to content

Commit ee18386

Browse files
authored
Merge pull request #158 from sabeelmuttil/master
add a option to hide Tooltip OnScroll
2 parents 2ae2b26 + 1430e08 commit ee18386

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

lib/src/super_tooltip.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ class SuperTooltip extends StatefulWidget {
327327
/// Defaults to `false`.
328328
final bool clickThrough;
329329

330+
//scroll dismiss
331+
final bool hideTooltipOnScroll;
332+
330333
/// Whether to automatically show the tooltip when the mouse pointer hovers over the [child].
331334
///
332335
/// This feature utilizes [MouseRegion] and is primarily intended for Web and Desktop platforms.
@@ -434,6 +437,7 @@ class SuperTooltip extends StatefulWidget {
434437
this.clickThrough = false,
435438
this.showOnHover = false,
436439
this.hideOnHoverExit = false,
440+
this.hideTooltipOnScroll = false,
437441
this.waitDuration = Duration.zero,
438442
this.showDuration,
439443
this.exitDuration = const Duration(milliseconds: 100),
@@ -757,6 +761,16 @@ class _SuperTooltipState extends State<SuperTooltip>
757761
onTap: widget.hideTooltipOnBarrierTap
758762
? _superTooltipController!.hideTooltip
759763
: null,
764+
onVerticalDragUpdate: (_) {
765+
if (widget.hideTooltipOnScroll) {
766+
_superTooltipController!.hideTooltip();
767+
}
768+
},
769+
onHorizontalDragUpdate: (_) {
770+
if (widget.hideTooltipOnScroll) {
771+
_superTooltipController!.hideTooltip();
772+
}
773+
},
760774
child: Container(
761775
key: SuperTooltip.barrierKey,
762776
decoration: ShapeDecoration(
@@ -831,6 +845,16 @@ class _SuperTooltipState extends State<SuperTooltip>
831845
_superTooltipController!.hideTooltip();
832846
}
833847
},
848+
onVerticalDragUpdate: (_) {
849+
if (widget.hideTooltipOnScroll) {
850+
_superTooltipController!.hideTooltip();
851+
}
852+
},
853+
onHorizontalDragUpdate: (_) {
854+
if (widget.hideTooltipOnScroll) {
855+
_superTooltipController!.hideTooltip();
856+
}
857+
},
834858
child: Container(
835859
key: SuperTooltip.bubbleKey,
836860
margin: SuperUtils.getTooltipMargin(

0 commit comments

Comments
 (0)