Skip to content

Commit

Permalink
Tooltip position calculation update based on available window. From PR
Browse files Browse the repository at this point in the history
  • Loading branch information
faiyaz-shaikh committed Jan 30, 2023
1 parent 2402f14 commit 859b32d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/src/tooltip_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,14 @@ class _ToolTipWidgetState extends State<ToolTipWidget>
position.dy + ((widget.position?.getHeight() ?? 0) / 2);
final topPosition = position.dy - ((widget.position?.getHeight() ?? 0) / 2);
final hasSpaceInTop = topPosition >= height;
final EdgeInsets viewInsets = EdgeInsets.fromWindowPadding(
WidgetsBinding.instance.window.viewInsets,
WidgetsBinding.instance.window.devicePixelRatio);
final double actualVisibleScreenHeight =
(widget.screenSize?.height ?? MediaQuery.of(context).size.height) -
viewInsets.bottom;
final hasSpaceInBottom =
((widget.screenSize?.height ?? MediaQuery.of(context).size.height) -
bottomPosition) >=
height;
(actualVisibleScreenHeight - bottomPosition) >= height;
return widget.tooltipPosition ??
(hasSpaceInTop && !hasSpaceInBottom
? TooltipPosition.top
Expand Down

0 comments on commit 859b32d

Please sign in to comment.