Skip to content

Consider hiding windows until the engine is active in the desktop runner templates #55427

Open

Description

@stuartmorgan-g

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:

Activity

  1. added
    engineflutter/engine related. See also e: labels.
    platform-macosBuilding on or for macOS specifically
    platform-windowsBuilding on or for Windows specifically
    platform-linuxBuilding on or for Linux specifically
    on Apr 23, 2020
  2. added
    P3Issues that are less important to the Flutter project
    on Jun 9, 2020
  3. added
    fyi-macosFor the attention of macOS platform team
    team-macosOwned by the macOS platform team
    on Jun 5, 2024
  4. 1 remaining item

  5. added
    fyi-linuxFor the attention of the Linux platform team
    and removed
    fyi-macosFor the attention of macOS platform team
    on Jun 7, 2024
  6. flutter-triage-bot commented on Jun 7, 2024

    @flutter-triage-bot

    The triaged-desktop label is irrelevant if there is no team-desktop label or fyi-desktop label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: desktopRunning on desktopc: proposalA detailed proposal for a change to Flutterengineflutter/engine related. See also e: labels.platform-linuxBuilding on or for Linux specificallyplatform-macosBuilding on or for macOS specificallyplatform-windowsBuilding on or for Windows specificallyteam-macosOwned by the macOS platform teamtriaged-macosTriaged by the macOS platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions