window_manager icon indicating copy to clipboard operation
window_manager copied to clipboard

[Windows] White flash on start up

Open Conrad33 opened this issue 8 months ago • 0 comments

When the app is launched, the window flashes white before the color from windowManager.setBackgroundColor is applied.

I found setting then window color in windows/runner/main.cpp fixes this.

On line 36 of main.cpp i added:

  // Set the background color of the window flutter grey.shade900 to prevent flash white on startup.
  HBRUSH hBrush = CreateSolidBrush(RGB(0x21, 0x21, 0x21));
  SetClassLongPtr(window.GetHandle(), GCLP_HBRBACKGROUND, reinterpret_cast<LONG_PTR>(hBrush));

I used chat gpt to generate these two lines so I'm not sure if this is a sensible way of doing it.

Conrad33 avatar Dec 26 '23 22:12 Conrad33