Skip to content

feat: add TooltipDirection.auto with safe resolved direction handling#154

Open
akhil-ge0rge wants to merge 1 commit intobensonarafat:masterfrom
akhil-ge0rge:tooltip-direction
Open

feat: add TooltipDirection.auto with safe resolved direction handling#154
akhil-ge0rge wants to merge 1 commit intobensonarafat:masterfrom
akhil-ge0rge:tooltip-direction

Conversation

@akhil-ge0rge
Copy link
Contributor

@akhil-ge0rge akhil-ge0rge commented Dec 19, 2025

Related Issue

Closes #139
Closes #123

Summary

This pull request adds support for TooltipDirection.auto, allowing SuperTooltip to automatically determine the most suitable display direction based on available screen space.

Changes

  1. New Direction Support
    • Added TooltipDirection.auto to allow dynamic tooltip placement.
    • The direction is resolved based on:
      - available space around the target
      - estimated tooltip size
      - screen margins

Usage Example

SuperTooltip(
  popupDirection: TooltipDirection.auto,
  content: const Text("Smart positioned tooltip"),
  child: const Icon(Icons.info),
);

Demo

Feature Demo

Adds TooltipDirection.auto to allow dynamic tooltip placement based on
available screen space.

The auto direction is resolved once during overlay creation and stored
as a resolved direction, which is then reused consistently for:
- layout constraints
- tooltip positioning
- close button positioning
- margin and padding calculations

This prevents runtime assertions caused by passing `auto` into layout
and rendering logic.
@akhil-ge0rge
Copy link
Contributor Author

Hey @bensonarafat ,
Have a look when you get time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auto postion/direction of the tooltip in a scrollview Direction not auto-managed.

1 participant