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

VisibilityDetector fires event unexpectedly #510

Open
satoyan opened this issue Dec 21, 2023 · 2 comments
Open

VisibilityDetector fires event unexpectedly #510

satoyan opened this issue Dec 21, 2023 · 2 comments

Comments

@satoyan
Copy link

satoyan commented Dec 21, 2023

Problem description

This is about VisibilityDetector.
This widget fires 'onVisibilitychanged' event when any widget is on over its navigator route.
every time virtual keyboard appears and disappears , VisibilityDetector under any widget's route will detect its visibiltychange and fires .

Steps to reproduce

  1. prepare a widget which has VisibilityDetector include any child widets.
  2. navigate to another widget which has html contents include text input form.
  3. tap text input form inside widget and show virtual keyboard
  4. VisibilityDetector fires onVisibilityChanged event .

Expected behavior

do not fire onVisibiliyChanged event

Actual behavior

fires onVisibilityChanged event

Environment

Flutter 3.16.2

both android , ios

thank you.

@ttxz
Copy link

ttxz commented Jan 12, 2024

Yes, I have this problem too, is there any solution?

@astheras
Copy link

same here. But as a temporary solution, i use smth like this

  void onVisibilityChanged(VisibilityInfo info) {
    // fires on keayboard appearance
    if (info.visibleFraction == 1 && needToReload) {
      needToReload= false;
      loadTimeZoneList();
      loadSelf();
    }

    if (info.visibleFraction == 0) {
      needToReload= true;
    }
  }

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

No branches or pull requests

3 participants