-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
A common request from people trying Flutter on desktop is being able to control initial window size and position from Dart, which makes sense given that application logic for Flutter apps often lives entirely in Dart. Currently, however, the windows are made as part of creating the associated engine, so their initial size is set in the platform (ObjC, C++) code.
The window_size FDE plugin (which will eventually be replaced with framework functionality) allows repositioning it, but because of the ordering and the async nature of engine startup, doing that at startup is very ugly; the window is briefly visible with one frame, then jumps to another frame. (This also means that the common desktop functionality of remembering window frames currently has to be done in platform code, not Dart, which is not ideal either.)
A possible solution here would be to have the runner template create the window hidden, and add an early lifecycle event to a system channel which would trigger the window to show. We could include a frame in that message, so that the window would only ever be visible with a frame controlled by Dart code. We could even consider having that message sent only after the first paint is finished to avoid an initial white frame.
This has to be balanced against the fact that it'll make the window slower to show up, but I think that will still be substantially better in most cases. If it's slow enough for that to be an issue, a splash screen that's separate from the window would be a much cleaner user experience (although of course ideally, it should be fast enough that that's not necessary)
Status: