X-SLAYER / flutter_overlay_window

Flutter plugin for displaying flutter app over other apps on the screen
https://pub.dev/packages/flutter_overlay_window
MIT License
108 stars 113 forks source link

Overlay Window doesn't disappear when app is in kill state #123

Open nahit-fidanci-alg opened 1 month ago

nahit-fidanci-alg commented 1 month ago

Hi everyone,

I show overlay window when the app is in the background. And hide it when the app is foreground. At this point, it works well. But when the app is in the background, after the overlay window is shown, if I kill the app, the overlay window stays. And also my app is still working on the overlayMain(). Overlay window doesn't go anywhere until I purposely stop the app on IDE.

What I did

I try to use AppLifecycleState to close overlay on detached state. Even if I can catch the state and run closeOverlay function, nothing happens at all. I tried to use Isolates. Send an event called killOverlay to do the killing staff in overlay window widget. But it didn't work either.

I couldn't find a similar issue on the repo. Do you know if this is a known case? Any workaround to kill the overlay will be great.

nahit-fidanci-alg commented 1 month ago

It seems that overlay runs on a different isolate on DartVM. Only way to stop it to exit(0) the app. Is there any other solution to stop overlay window without killing the DartVM?