FlutterPlaza / no_screenshot

Flutter plugin to enable, disable or toggle screenshot support in your application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Able to take screenshots after app is resumed fro background

Kronos-2701 opened this issue · comments

I used this package to prevent screenshots in my flutter app .
In ios after the app is sent to background , a message pops in the debug console .
message =>
[iOS][Snapshotting] Snapshotting a view that has not been rendered at least once requires afterScreenUpdates:YES.

and when the app is resumed , I was able to take screenshots.
After restarting everything was normal again.

Faced the same issue. Did not find a better option than adding it in the didChangeAppLifecycleState

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
      case AppLifecycleState.resumed, :
         _noScreenshot.screenshotOff();
        break;
      case AppLifecycleState.inactive:
         _noScreenshot.screenshotOff();
        break;
      case AppLifecycleState.paused:
        _noScreenshot.screenshotOff();
        break;
      case AppLifecycleState.detached:
        print("app in detached");
        break;
    }
  }```