Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tap tooltip to hide #69

Merged
merged 2 commits into from
Sep 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 44 additions & 36 deletions lib/src/super_tooltip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class SuperTooltip extends StatefulWidget {
final double touchThroughAreaCornerRadius;
final EdgeInsetsGeometry overlayDimensions;
final EdgeInsetsGeometry bubbleDimensions;
final bool hideTooltipOnTap;

//filter
final bool showDropBoxFilter;
Expand Down Expand Up @@ -107,6 +108,7 @@ class SuperTooltip extends StatefulWidget {
this.borderRadius = 10.0,
this.overlayDimensions = const EdgeInsets.all(10),
this.bubbleDimensions = const EdgeInsets.all(10),
this.hideTooltipOnTap = false,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad.
thanks

this.sigmaX = 5.0,
this.sigmaY = 5.0,
this.showDropBoxFilter = false,
Expand Down Expand Up @@ -329,46 +331,52 @@ class _SuperTooltipState extends State<SuperTooltip>
children: <Widget>[
Material(
color: Colors.transparent,
child: Container(
key: SuperTooltip.bubbleKey,
margin: SuperUtils.getTooltipMargin(
arrowLength: widget.arrowLength,
arrowTipDistance: widget.arrowTipDistance,
closeButtonSize: closeButtonSize,
preferredDirection: preferredDirection,
showCloseButton: showCloseButton,
),
padding: SuperUtils.getTooltipPadding(
closeButtonSize: closeButtonSize,
showCloseButton: showCloseButton,
),
decoration: ShapeDecoration(
color: backgroundColor,
shadows: hasShadow
? <BoxShadow>[
BoxShadow(
blurRadius: shadowBlurRadius,
spreadRadius: shadowSpreadRadius,
color: shadowColor,
),
]
: null,
shape: BubbleShape(
arrowBaseWidth: widget.arrowBaseWidth,
child: GestureDetector(
onTap: () {
if (widget.hideTooltipOnTap)
_superTooltipController!.hideTooltip();
},
child: Container(
key: SuperTooltip.bubbleKey,
margin: SuperUtils.getTooltipMargin(
arrowLength: widget.arrowLength,
arrowTipDistance: widget.arrowTipDistance,
borderColor: widget.borderColor,
borderRadius: widget.borderRadius,
borderWidth: widget.borderWidth,
bottom: bottom,
left: left,
closeButtonSize: closeButtonSize,
preferredDirection: preferredDirection,
right: right,
target: target,
top: top,
bubbleDimensions: widget.bubbleDimensions,
showCloseButton: showCloseButton,
),
padding: SuperUtils.getTooltipPadding(
closeButtonSize: closeButtonSize,
showCloseButton: showCloseButton,
),
decoration: ShapeDecoration(
color: backgroundColor,
shadows: hasShadow
? <BoxShadow>[
BoxShadow(
blurRadius: shadowBlurRadius,
spreadRadius: shadowSpreadRadius,
color: shadowColor,
),
]
: null,
shape: BubbleShape(
arrowBaseWidth: widget.arrowBaseWidth,
arrowTipDistance: widget.arrowTipDistance,
borderColor: widget.borderColor,
borderRadius: widget.borderRadius,
borderWidth: widget.borderWidth,
bottom: bottom,
left: left,
preferredDirection: preferredDirection,
right: right,
target: target,
top: top,
bubbleDimensions: widget.bubbleDimensions,
),
),
child: widget.content,
),
child: widget.content,
),
),
_buildCloseButton(),
Expand Down