Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some problems with all the durations #26

Closed
sgehrman opened this issue Sep 2, 2021 · 13 comments · Fixed by #27
Closed

Some problems with all the durations #26

sgehrman opened this issue Sep 2, 2021 · 13 comments · Fixed by #27

Comments

@sgehrman
Copy link
Contributor

sgehrman commented Sep 2, 2021

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.

@sgehrman
Copy link
Contributor Author

sgehrman commented Sep 3, 2021

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');
  });
}

@stargazing-dino
Copy link
Owner

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.

@sgehrman
Copy link
Contributor Author

sgehrman commented Sep 3, 2021

I tried everything, all the durations. I got the code and trying to debug on my end.

Thanks for looking at it.

@stargazing-dino
Copy link
Owner

stargazing-dino commented Sep 3, 2021

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?

@sgehrman
Copy link
Contributor Author

sgehrman commented Sep 3, 2021

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?

@stargazing-dino
Copy link
Owner

stargazing-dino commented Sep 3, 2021

Very silly mistake with docs. My mistake. Fixed with 43887ef and available in 0.0.7+3

Will move back to duration stuff but that might take a bit longer.

@sgehrman
Copy link
Contributor Author

sgehrman commented Sep 3, 2021

Thanks! I really appreciate the fast response. Code looks really nice.

@stargazing-dino
Copy link
Owner

stargazing-dino commented Sep 3, 2021

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.

Screen.Recording.2021-09-02.at.7.35.22.PM.mov

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

@sgehrman
Copy link
Contributor Author

sgehrman commented Sep 3, 2021

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.

@sgehrman
Copy link
Contributor Author

sgehrman commented Sep 3, 2021

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.

@sgehrman
Copy link
Contributor Author

sgehrman commented Sep 3, 2021

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;

?

@sgehrman
Copy link
Contributor Author

sgehrman commented Sep 3, 2021

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);

@sgehrman
Copy link
Contributor Author

sgehrman commented Sep 3, 2021

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.

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 a pull request may close this issue.

2 participants