Skip to content

Make tooltip positioning more customizable #172758

@kacpmu

Description

@kacpmu

Use case

The current Tooltip implementation doesn't support positioning on the left or right of the child widget. I ran into this limitation while adding tooltips to destinations in my custom navigation rail.

Similar case:

https://stackoverflow.com/questions/72202530/positioning-tooltip-in-flutter

Margin is not useful because it overlays the child widget, as mentioned in the comments to the most voted answer.

Proposal

Tooltip positioning should be considered in horizontal/vertical axis with additional horizontal/vertical offset.

Image

To achieve this result I've edited getPositionForChild in _TooltipPositionDelegate class.

https://pastebin.com/SSa3KWFF

The "preferRight" parameter behaves similarly to "preferBelow". Its effect may depend on the current TextDirection, but it's unclear whether this could cause confusion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions