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

Implement dynamic tooltip display on button click #102

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
16 changes: 11 additions & 5 deletions lib/src/super_tooltip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class SuperTooltip extends StatefulWidget {
final EdgeInsetsGeometry bubbleDimensions;
final bool hideTooltipOnTap;
final bool hideTooltipOnBarrierTap;
final bool showTooltipOnButtonTap;

//filter
final bool showDropBoxFilter;
Expand Down Expand Up @@ -126,6 +127,7 @@ class SuperTooltip extends StatefulWidget {
this.sigmaY = 5.0,
this.showDropBoxFilter = false,
this.hideTooltipOnBarrierTap = true,
this.showTooltipOnButtonTap = true,
}) : assert(showDropBoxFilter ? showBarrier ?? false : true,
'showDropBoxFilter or showBarrier can\'t be false | null'),
super(key: key);
Expand Down Expand Up @@ -160,6 +162,7 @@ class _SuperTooltipState extends State<SuperTooltip>
late double shadowSpreadRadius;
late Offset shadowOffset;
late bool showBlur;
late bool showTooltipOnButtonTap;

@override
void initState() {
Expand Down Expand Up @@ -208,14 +211,17 @@ class _SuperTooltipState extends State<SuperTooltip>
shadowSpreadRadius = widget.shadowSpreadRadius ?? 5.0;
shadowOffset = widget.shadowOffset ?? Offset.zero;
showBlur = widget.showDropBoxFilter;
showTooltipOnButtonTap = widget.showTooltipOnButtonTap;

return CompositedTransformTarget(
link: _layerLink,
child: GestureDetector(
onTap: _superTooltipController!.showTooltip,
onLongPress: widget.onLongPress,
child: widget.child,
),
child: showTooltipOnButtonTap
? GestureDetector(
onTap: _superTooltipController!.showTooltip,
onLongPress: widget.onLongPress,
child: widget.child,
)
: widget.child,
);
}

Expand Down
Loading