stargazing-dino / just_the_tooltip

A directional tooltip for flutter projects
https://pub.dev/packages/just_the_tooltip
MIT License
56 stars 54 forks source link

is possible auto close after show? #39

Closed hukjordanjanaq closed 3 years ago

stargazing-dino commented 3 years ago

The default tooltip closes after it is opened. It mimics the behaviour of the default Flutter Tooltip. In contrast, if you want to keep the tooltip open after it has shown, you'll need to specify isModal to true on the JustTheTooltip construction

JustTheTooltip(
  isModal: false, // fale is the default. This will hide the tooltip after `showDuration`
)
stargazing-dino commented 3 years ago

Let me know if this answered your question

hukjordanjanaq commented 3 years ago

I'm using just_the_tooltip: ^0.0.9+1, but it's not hidind after it shows.

Captura de Pantalla 2021-10-13 a la(s) 22 18 08

https://user-images.githubusercontent.com/48919342/137245274-8cfdbc0a-541c-4494-afdd-9c43bcb035da.mov

hukjordanjanaq commented 3 years ago

It may be because i'm showing it programmatically?

I tested pressing the child for showing the tooltip and it works fine.

stargazing-dino commented 3 years ago

Sorry, can't go fully into this rn. Maybe this weekend. I will point out where I think the issue is though.

In this function in a regular tooltip press it handles the tooltip dismissal. https://github.com/Nolence/just_the_tooltip/blob/a143964b91642e2a0ac6624b878994a3b138f49f/lib/src/just_the_tooltip.dart#L523

Because a controller _showTooltip never triggers a mouse click event, those _hideTooltip functions are never called which then never set a timer for dismissal. I think the correct option would to pass the controller showTooltip a field that defines the behavior of the tooltip after opened.

hukjordanjanaq commented 3 years ago

I got it! Thank you so much for answering.

Thank you for this great library too. Have a nice day!

stargazing-dino commented 3 years ago

Alright, I finally got to this and added an autoClose field to the controller's showTooltip.

controller.showTooltip(immediately: true, autoClose: true);

Note, you'll be limited how long it stays open by either your hoverShowDuration or your showDuration. I forget which ones which.

This update is hidden behind 0.0.10-dev so you have to opt into it by specifying that exact version in your pubspec.yaml

Let me know if something sucks. I still need at least one or two more tests before I put stable

hukjordanjanaq commented 3 years ago

It works fine, it closes automatically.

Example with showDuration = Duration(milliseconds: 1500)

https://user-images.githubusercontent.com/48919342/138495922-3d4eed5e-0005-4330-98e8-fa186b469098.mov

Thanks yo so much!

stargazing-dino commented 3 years ago

😄 Closing