diff --git a/lib/core/utils/window_size_listener.dart b/lib/core/utils/window_size_listener.dart deleted file mode 100644 index 67270f760..000000000 --- a/lib/core/utils/window_size_listener.dart +++ /dev/null @@ -1,64 +0,0 @@ -import 'package:fl_lib/fl_lib.dart'; -import 'package:server_box/data/res/store.dart'; -import 'package:window_manager/window_manager.dart'; - -abstract final class WindowSizeListener { - static final _WindowSizeListener instance = _WindowSizeListener(); -} - -final class _WindowSizeListener implements WindowListener { - @override - void onWindowBlur() {} - - @override - void onWindowClose() {} - - @override - void onWindowDocked() {} - - @override - void onWindowEnterFullScreen() {} - - @override - void onWindowEvent(String eventName) {} - - @override - void onWindowFocus() {} - - @override - void onWindowLeaveFullScreen() {} - - @override - void onWindowMaximize() {} - - @override - void onWindowMinimize() {} - - @override - void onWindowMove() {} - - @override - void onWindowMoved() {} - - @override - void onWindowResize() { - final current = Stores.setting.windowSize.fetch(); - if (current.isEmpty) return; - - windowManager.getSize().then((size) { - Stores.setting.windowSize.put(size.toIntStr()); - }); - } - - @override - void onWindowResized() {} - - @override - void onWindowRestore() {} - - @override - void onWindowUndocked() {} - - @override - void onWindowUnmaximize() {} -} diff --git a/lib/main.dart b/lib/main.dart index 683e36e89..8cc5d0639 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,6 @@ import 'package:flutter_displaymode/flutter_displaymode.dart'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:logging/logging.dart'; import 'package:provider/provider.dart'; -import 'package:server_box/core/utils/window_size_listener.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:server_box/app.dart'; import 'package:server_box/core/utils/sync/icloud.dart'; @@ -69,12 +68,12 @@ Future _initApp() async { await _initData(); _setupDebug(); - final windowSize = Stores.setting.windowSize.fetch().toSize(); + final windowSize = Stores.setting.windowSize; final hideTitleBar = Stores.setting.hideTitleBar.fetch(); SystemUIs.initDesktopWindow( hideTitleBar: hideTitleBar, - size: windowSize, - listener: WindowSizeListener.instance, + size: windowSize.fetch().toSize(), + listener: WindowSizeListener(windowSize), ); FontUtils.loadFrom(Stores.setting.fontPath.fetch()); diff --git a/pubspec.lock b/pubspec.lock index e680ff994..a6f936ad8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -385,8 +385,8 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.0.49" - resolved-ref: "85ae5cfeba1c8a959e0bd83b7e1eff5edc572ab9" + ref: "v1.0.50" + resolved-ref: fc4e847cc0513157b6ac77e9e82ab57edbdc9482 url: "https://github.com/lppcg/fl_lib" source: git version: "0.0.1" diff --git a/pubspec.yaml b/pubspec.yaml index 8b1bb7059..bf4eaf4f8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -58,7 +58,7 @@ dependencies: fl_lib: git: url: https://github.com/lppcg/fl_lib - ref: v1.0.49 + ref: v1.0.50 dependency_overrides: # dartssh2: