Skip to content

Commit

Permalink
Calculation tooltip position
Browse files Browse the repository at this point in the history
  • Loading branch information
faiyaz-shaikh committed Dec 14, 2021
1 parent 1c54995 commit 4fc3280
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/tooltip_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ class _ToolTipWidgetState extends State<ToolTipWidget> {
bool isCloseToTopOrBottom(Offset position) {
var height = 120.0;
height = widget.contentHeight ?? height;
return (widget.screenSize!.height - position.dy) <= height;
var bottomPosition = position.dy + (widget.position!.getHeight() / 2);
var topPosition = position.dy - (widget.position!.getHeight() / 2);
return (widget.screenSize!.height - bottomPosition) <= height &&
topPosition >= height;
}

String findPositionForContent(Offset position) {
Expand Down

0 comments on commit 4fc3280

Please sign in to comment.