-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sub window is freezed when switch to other app or main window #5
Comments
There is a workaround. Refer to this comment. |
Thank you . for now this was the only solutions |
Unfortunately, this was something I didn't expect and I didn't find any solution to fix it. On macOS, the curious thing is that if I resize the window, it updates. If I lose focus and then regain it by switching to another window of another program, then it works correctly again. |
for reference: flutter/flutter#133533 |
I was able to create a workaround without changing the Flutter source code, using an In your app implement this listener this way inside your main widget extending a class _MyAppState extends State<MyApp> {
// your code ....
late final AppLifecycleListener? _appLifecycleListener;
@override
void initState() {
// your code ....
// workaround applies for all sub-windows (all windows with id > 0) on macOS
if (WindowManagerPlus.current.id > 0 && Platform.isMacOS) {
_appLifecycleListener = AppLifecycleListener(
onStateChange: _handleStateChange,
);
}
super.initState();
}
void _handleStateChange(AppLifecycleState state) {
// workaround applies for all sub-windows (all windows with id > 0) on macOS
if (WindowManagerPlus.current.id > 0 && Platform.isMacOS && state == AppLifecycleState.hidden) {
// trigger _setFramesEnabledState(true); method
SchedulerBinding.instance.handleAppLifecycleStateChanged(
AppLifecycleState.inactive);
}
}
@override
void dispose() {
// your code ....
_appLifecycleListener?.dispose();
super.dispose();
}
// your code ....
} It is using the protected method |
same as this issue MixinNetwork/flutter-plugins#319
it also happen when i create new window then quickly switch to other app or main window
The text was updated successfully, but these errors were encountered: