Closed sgehrman closed 3 years ago
maybe false alarm, I'm seeing weird build problems with flutter, going to keep trying to reproduce it.
I think it might have something to do with this: (I'm on desktop linux)
final isConnected = RendererBinding.instance!.mouseTracker.mouseIsConnected;
if (isConnected != _mouseIsConnected) {
setState(() {
_mouseIsConnected = isConnected;
print('mouse is connected');
});
}
No, I think you're right. I just ran the demo and tried changing
showDuration: const Duration(seconds: 5),
and it looks like it has no effect. I should also clarify by asking you do mean these fields right showDuration
and hideDuration
? Those are the ones I assume you mean. It looks like I'm just not respecting them and waiting the duration it takes for longPress to be hit which isn't right.
I tried everything, all the durations. I got the code and trying to debug on my end.
Thanks for looking at it.
Yeah, so fadeInDuration
and fadeOutDuration
look like they work and I think I have a test setup for them but not showDuration which I'll set up once I find the issue. Those are specific to the amount of time it takes to fully show or hide the tooltip.
Another thing is that I'm not seeing is documentation on JustTheTooltip
parameters which is weird because I inherit from a class that has the full docs for every class field. Can you confirm that and I'll make it a separate issue?
I did notice that issue with the docs. I only found the docks when I forked and looked at the code.
I normally just right click and go to definition and it wasn't going to your interface file, so maybe that's related?
Very silly mistake with docs. My mistake. Fixed with 43887ef8f12dcfe9c8e73928f06c0ac27bf142f2 and available in 0.0.7+3
Will move back to duration stuff but that might take a bit longer.
Thanks! I really appreciate the fast response. Code looks really nice.
So I think you're going to have to narrow down the question. It looks like everything works so far as I understand the problem.
The confusion might possibly be that you're trying on mobile and mobile does not support hover (from the official Tooltip design) so those fields are largely ignored. I'm honestly not sure so it might be that I'm missing something important. Please let me know if that is the case
I still can't figure out what is happening. It seems random. I'll build it with your package and it won't work, then I downloaded the code and put in some print statements and it worked. I keep trying things back and forth and I'm not sure if Dart is not compiling things correctly or what. Your package is a package included in another one of my packages, so maybe there is something too that. Very weird, but I'll keep trying to reproduce it.
Hey, I think I reproduced it!!
This was one test, so maybe a fluke. Open the app and don't move the mouse at all. Then move the mouse and it seems to work.
Next try moving the mouse back and forth over the page as it loads. _mouseIsConnected never gets set to true.
I've also seen cases where one view works, and the other doesn't work. And it's random.
See if you can reproduce that, I'll keep trying. I'm testing in a web page if that matters, on linux.
This code doesn't look wrong, but it looks kind of weird:
void initState() { if (!widget.isModal) { _hasBindingListeners = true; <== setting this to true here _addBindingListeners(); } else {
void _addBindingListeners() { if (!_hasBindingListeners) _hasBindingListeners = true; <== why have the if statement? it's not returning if already set.
should it be something like if (_hasBindingListeners) return;
?
If I move the mouse as it's loading, _handleMouseTrackerChange never gets called
Very weird. But I can reproduce it consistently.
RendererBinding.instance!.mouseTracker
.addListener(_handleMouseTrackerChange);
I googled a bit and it looks like you copied some of the code from Flutter's tooltip.
That code has this in initState _mouseIsConnected = RendererBinding.instance!.mouseTracker.mouseIsConnected;
So, maybe they had the same issue? I added that and it works. I'm making a PR, you can see what I changed.
I don't know exactly what's going on, but setting these durations is near impossible to get right.
Most of the time the tooltip doesn't show up. It must be hiding the tooltip in timers that get fired at the wrong time.
Very confusing to set this up.