focus_detector 1.0.3
focus_detector: ^1.0.3

Flutter Android iOS web

Android's onResume/onPause and iOS's viewDidAppear/viewDidDisappear for Flutter.

FocusDetector #

https://pub.dev/packages/focus_detector

Wrapper around Google's VisibilityDetector for combining it with Flutter's WidgetsBindingObserver in order to achieve Android's onResume/onPause and iOS's viewDidAppear/viewDidDisappear on Flutter.

How Does it Work? #

A FocusDetector widget takes in a child and optional onFocusGained/onFocusLost callbacks and fires those as the widget's focus changes. Some cases that trigger the focus change:

  1. When the widget is first created;
  2. When its route is popped back to;
  3. When the app is sent to background/foreground while the widget is visible;

Article #

Bringing onResume/viewDidAppear onPause/viewDidDisappear to Flutter

Sample #

Check out the focus-detector/set-state-focus-detector or focus-detector/bloc-focus-detector branch of the Breaking Bapp repository.

33
likes
110
pub points
88%
popularity

Publisher

edsonbueno.com

Android's onResume/onPause and iOS's viewDidAppear/viewDidDisappear for Flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

flutter, visibility_detector

More

Packages that depend on focus_detector