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

Feature/tip navigation: New optional navigation options for the Showcase() widget #273

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Fixed bugs with minimum padding for left and right. On very long cont…
…ent, _getLeft() position could return a negative number, cutting content off the screen. Set minimum defaults for left and right.
  • Loading branch information
mdrideout committed Sep 26, 2022
commit 0996626804504d176c3652beb0fc240d40176d38
9 changes: 5 additions & 4 deletions lib/src/tooltip_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
final double endIconPaddingAll = 2.0;
final double endIconSize = 16.0;
late final double endIconTotalWidth = endIconSize + endIconPaddingAll;
final double minLeftRightPosition = 12;

late final AnimationController _parentController;
late final Animation<double> _curvedAnimation;
Expand Down Expand Up @@ -163,11 +164,12 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
leftPadding = (widget.screenSize!.width - 20) - _getTooltipWidth();
}
if (leftPadding < 20) {
leftPadding = 14;
leftPadding = minLeftRightPosition;
}
return leftPadding;
} else if (!(_isRight())) {
return widget.position!.getCenter() - (_getTooltipWidth() * 0.5);
var leftPos = widget.position!.getCenter() - (_getTooltipWidth() * 0.5);
return (leftPos < minLeftRightPosition) ? minLeftRightPosition : leftPos;
} else {
return null;
}
Expand All @@ -178,7 +180,7 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
var rightPadding =
widget.position!.getCenter() + (_getTooltipWidth() / 2);
if (rightPadding + _getTooltipWidth() > widget.screenSize!.width) {
rightPadding = 14;
rightPadding = minLeftRightPosition;
}
return rightPadding;
} else if (!(_isLeft())) {
Expand Down Expand Up @@ -394,7 +396,6 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
debugPrint("End");
ShowCaseWidget.of(
widget.globalKey.currentContext!)
.dismiss();
Expand Down