bensonarafat / super_tooltip

SuperTooltip It is super flexible and allows you to display ToolTips in the overlay of the screen.
https://pub.dev/packages/super_tooltip
MIT License
141 stars 92 forks source link

exception when used with showModalBottomSheet and tooltipDirection.down #97

Open righteoustales opened 5 months ago

righteoustales commented 5 months ago

I'm using super_tootip all over my code base to implement a guided first-time-user tour of the app. I have tooltips running on my main screen, left and right drawers, various dialogs, etc.

My basic pattern is a condition to see if the tooltip should be active and, if so, I call a method that creates it with an associated controller. Just before returning it to the. build () function I call it from I also kick off a postframe callback (WidgetsBinding.instance.addPostFrameCallback((_) specifically) that invokes toolTipController!.showTooltip() using the controller associated with the tooltip that is returned to the build() call.

This pattern has worked flawlessly until I tried to use this pattern from within showModalBottomSheet (which looks a LOT like what I do successfully within showDialog where it works fine). Everything works fine in showModalBottomSheet until the postframecallback calls toolTipController.showTooltip(). If I do not make that call things run fine and I can even successfully show the tooltip if I call toolTipController.sthoTooltip() from an onPressed: callback from a button inside the modal bottom sheet. But, when I let the postframecallback call the same the flutter runtime asserts telling me that something has a negative min height (both max and min height are negative and share the same value - maybe a box constraints calculation isn't working right?).

Is this a known issue? Is there a workaround?

(see below for update)

righteoustales commented 5 months ago

Quick update that makes me think this is a bug:

Specifying the popupDirection as any of TooltipDirection.left, TooltipDirection.right, TooltipDirection.up all work fine. The exception only occurs when I use TooltipDirection.down.

righteoustales commented 4 months ago

Update: I saw a couple of other odd anomalies since I first created this bug. One of the other ones I saw was that the tooltip would not show when it should after I switched tabs in a TabBar. After seeing that one, I began to wonder if the underlying issue has to do with animations (since both bottom sheets and tab bars are animated). Sure enough, when I create an animation controller and set the duration to 0 milliseconds all of the anomalies seem to go away.

That said, I have not seen these issues occur while using left/right drawers so far which are also animated.

Hopefully this helps with the debugging of the issue and also as a workaround for others who show up here due to encountering the same issues.

I'll still be watching this for a fix though!

bensonarafat commented 3 months ago

@righteoustales Could you share some code, so i can reproduce this issue. thank you