feat: remember last window size & position on desktop#98
Merged
Conversation
Desktop builds previously launched at a fixed default size every time and forgot where the user had placed or sized the window. Add window geometry persistence so the app restores its last size, position, and maximized state across launches. - Add the window_manager package (no prior window-management lib existed). - New lib/shared/utils/desktop_window.dart: setupDesktopWindow() restores saved geometry before the first frame (centers on first run) and installs a debounced WindowListener that persists size/position/maximized on move/resize/(un)maximize. While maximized it keeps the last normal bounds so un-maximize restores correctly. No-op on web/mobile. - Persist to a device-global `window-state` Hive box opened in setupHive. - Wire setupDesktopWindow() into main() after Hive is ready and before runApp(), guarded so a window-manager failure can't block startup. - Regenerated native plugin registrants (window_manager registration). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Desktop builds now remember the window's last size, position, and maximized state across launches. Previously every launch opened at a fixed default size and forgot where the window had been placed or resized.
How
window_managerpackage — there was no window-management library in the project before.lib/shared/utils/desktop_window.dartwithsetupDesktopWindow():waitUntilReadyToShow(centers on first run, no flash at the default size).WindowListenerthat persists geometry on move/resize/(un)maximize, debounced 400ms so a drag doesn't write to Hive on every frame.window-stateHive box, opened insetupHive.setupDesktopWindow()intomain()after Hive is ready and beforerunApp(), guarded with try/catch like the rest of startup so a window-manager failure can't block launch.Notes for reviewers
flutter analyzepasses clean on the changed files. I could not run the app live — the project pins Flutterbeta, whose Dart VM requires macOS 14 while my machine is on macOS 13; I validated with the installed stable3.38.1toolchain (pub get+analyze). A live launch/resize test on a desktop target is the one thing left to confirm by hand.🤖 Generated with Claude Code