EdsonBueno / focus_detector

Android's onResume/onPause and iOS's viewDidAppear/viewDidDisappear for Flutter.
https://pub.dev/packages/focus_detector
MIT License
98 stars 52 forks source link

No Support for updateInterval #8

Open WycoffJohn opened 2 years ago

WycoffJohn commented 2 years ago

onFocusGained is fired with a short delay which is undesirable in my case causing the widget to refresh its contents about .5-1sec after the user returns to the screen.

It seems visibility_detector has implemented a default delay which can be overridden by setting the instance updateInterval. This option does not seem to be available in focus_detector.

I was able to workaround this issue by adding the visibility_detector package directly to my project (which is not ideal) and setting the updateInterval from there.

VisibilityDetectorController.instance.updateInterval = Duration.zero;