Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix(linux): prevent startup window flicker (#2092)

Prediditd48f776bdc1b
diff --git a/lib/main.dart b/lib/main.dart
index e697d8c0..9a38f06d 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -40,11 +40,10 @@ void main() async {
// Log the error for debugging (if logger is available)
debugPrint('Storage initialization failed: $e');
- if (Platform.isWindows) {
+ if (Utils.isDesktop()) {
await windowManager.ensureInitialized();
windowManager.waitUntilReadyToShow(null, () async {
- // Native window show has been blocked in `flutter_windows.cppL36` to avoid flickering.
- // Without this. the window will never show on Windows.
+ // window_manager controls desktop visibility to avoid startup flicker.
await windowManager.show();
await windowManager.focus();
});
@@ -80,8 +79,7 @@ void main() async {
title: 'Kazumi',
);
windowManager.waitUntilReadyToShow(windowOptions, () async {
- // Native window show has been blocked in `flutter_windows.cppL36` to avoid flickering.
- // Without this. the window will never show on Windows.
+ // window_manager controls desktop visibility to avoid startup flicker.
await windowManager.show();
await windowManager.focus();
});
diff --git a/linux/my_application.cc b/linux/my_application.cc
index 2379b642..dcd9dfe3 100644
--- a/linux/my_application.cc
+++ b/linux/my_application.cc
@@ -107,7 +107,7 @@ static void my_application_activate(GApplication* application) {
}
gtk_window_set_default_size(window, 1280, 720);
- gtk_widget_show(GTK_WIDGET(window));
+ gtk_widget_realize(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);