The QR Code Scanner package for Appeto SDK.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 line
787 B

  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/foundation.dart';
  3. class LifecycleEventHandler extends WidgetsBindingObserver {
  4. LifecycleEventHandler({
  5. this.resumeCallBack,
  6. this.suspendingCallBack,
  7. });
  8. final AsyncCallback resumeCallBack;
  9. final AsyncCallback suspendingCallBack;
  10. @override
  11. Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {
  12. switch (state) {
  13. case AppLifecycleState.resumed:
  14. if (resumeCallBack != null) {
  15. await resumeCallBack();
  16. }
  17. break;
  18. case AppLifecycleState.inactive:
  19. case AppLifecycleState.paused:
  20. case AppLifecycleState.detached:
  21. if (suspendingCallBack != null) {
  22. await suspendingCallBack();
  23. }
  24. break;
  25. }
  26. }
  27. }