Skip to content

Windows: isFullScreen still leaves Flutter surface at wrong size after #60 / 0.6.3 (SyncFullScreenClientArea) #79

In review
libnativeapi/nativeapi-core
#114

Description

@MatteoMagnani7

Summary

Follow-up to #60 (fixed in nativeapi-core#105 / #66, shipped in 0.6.3).

On Windows only, toggling Window.isFullScreen still updates the native HWND bounds, but the Flutter / FLUTTERVIEW surface does not match that size and I cannot interact with the app in any way:

  1. Enter fullscreen: the window covers the monitor (black fills the rest of the screen), but the Flutter UI stays at the previous windowed size, centered, with large black margins around it.
  2. Exit fullscreen: the window frame / DWM chrome returns to the normal restored size (Windows 11 rounded corners look correct), but the Flutter content stays at the fullscreen size and overflows / is clipped by the smaller HWND.

This is reproducible with a clean rebuild after upgrading to 0.6.3 (flutter clean + rebuild), so it is not a stale native binary from 0.6.2.

macOS / Linux are fine with the same app code path.

Related: #60 — the classic title-bar flash on exit looks improved; the surface / client size desync remains.

Screenshots

  1. Enter fullscreen: HWND fullscreen, Flutter content still windowed-sized (black margins).
  2. Exit fullscreen: HWND restored, Flutter content still fullscreen-sized (overflow / clipped).

Environment

  • OS: Windows 11
  • Packages: nativeapi: 0.6.3, nativeapi_flutter: 0.6.3, cnativeapi: 0.6.3 (from pub.lock)
  • Flutter desktop Windows
  • Window setup: titleBarStyle = TitleBarStyle.hidden + custom in-app title bar
  • Not using maximize for this path — true fullscreen via isFullScreen

Minimal API usage

final window = WindowManager.instance.getCurrent();

// init (custom chrome)
window?.titleBarStyle = TitleBarStyle.hidden;

// enter true fullscreen (not maximize)
window?.isFullScreen = true;

// later exit
window?.isFullScreen = false;

Screenshot of the issue:
2. after fullscreen off (this doesn't cover the entire screen (and that's good), I only took the screenshot of the app not the entire desktop, the windows has the right dimensions)
photo_2026-12-02_19-45-28

  1. after fullscreen on (this one is my entire desktop screenshot):
photo_2026-12-02_19-45-25

Activity

  1. lijy91 commented on Dec 3, 2026

    @lijy91
    Member

    Thanks for the detailed follow-up and screenshots @MatteoMagnani7!

    We tested the minimal TitleBarStyle.hidden + isFullScreen = true/false flow locally on Windows 11 with flutter_window_example (Flutter 3.50) and could not reproduce the centered windowed surface / overflow or unresponsiveness, so it looks dependent on a specific Flutter version, rendering backend, or runner/plugin setup.

    Could you share a few details from your environment so we can reproduce this accurately?

    1. Output of flutter --version (and whether Impeller or Skia/ANGLE is active).
    2. Whether windows/runner/win32_window.cpp or flutter_window.cpp has any customizations (e.g. WM_SIZE, WM_NCCALCSIZE, WM_ACTIVATE, or DPI handling).
    3. Whether any other windowing or native-surface plugins are used alongside nativeapi_flutter (for example flutter_webrtc, media_kit, window_manager, flutter_acrylic, etc.).
    4. Whether window.isFullScreen = true/false works properly in a fresh flutter create app on your machine or also reproduces there.

    We also prepared a candidate fix in libnativeapi/nativeapi-core#114 / #80 that directly syncs FLUTTERVIEW and defers a follow-up WM_SIZE / repaint to the next message-loop turn and after WM_DWMNCRENDERINGCHANGED — happy to verify or refine it once we can match your environment.

  2. lijy91 commented on Dec 3, 2026

    @lijy91
    Member

    @MatteoMagnani7 Also, if possible, could you share a minimal reproducible example (e.g. a small GitHub repo or gist with pubspec.yaml, lib/main.dart, and any modified files under windows/runner/)? We also just tested a fresh flutter create Windows app with nativeapi_flutter: 0.6.3 and TitleBarStyle.hidden + isFullScreen on Windows 11 and still could not reproduce it, so a minimal repro would help us pinpoint the exact trigger right away.

  3. MatteoMagnani7 commented on Dec 3, 2026

    @MatteoMagnani7
    Author

    Thanks for the replies,

    I confirmed on a fresh minimal project — same bug, no other plugins involved.

    Minimal repro

    https://github.com/MatteoMagnani7/test_fullscreen_bug_nativeapi

    • Fresh flutter create Windows app
    • Only dependency: nativeapi_flutter: 0.6.3
    • Stock runner (no custom WM_SIZE / WM_NCCALCSIZE / DPI changes)
    • TitleBarStyle.hidden + tiny custom title bar
    • Two paths to compare:
      1. Direct window.isFullScreen = … from onPressed
      2. Repro path (same as our real app): set state → addPostFrameCallback → isFullScreen + insert/remove an opaque root OverlayEntry

    The bug reproduces in this minimal app as well.

    Environment is still Flutter 3.50.1 stable / Dart 3.14.0 on Windows 11, NVIDIA GPU, packages 0.6.3.

    Thanks again.

    Screenshots:

    1. after fullscreen to ON (screenshot of the entire desktop)
    image
    1. after fullscreen to OFF (screenshot of the entire desktop)
    image
  4. lijy91 commented on Dec 3, 2026

    @lijy91
    Member

    Thanks for the minimal repro @MatteoMagnani7!

    We built and ran test_fullscreen_bug_nativeapi with nativeapi_flutter: 0.6.3 on Windows 11 (Flutter 3.50), and both buttons worked cleanly on our machine — the key difference is that our display output runs through Intel Iris Xe / a virtual display adapter rather than a discrete NVIDIA GPU. From your screenshots (frozen mid-ripple on enter, frozen green overlay after OverlayEntry.remove() on exit), this strongly points to NVIDIA + Windows 11 DWM fullscreen optimization / Direct Flip interacting with the Flutter ANGLE swapchain during the synchronous SetWindowPos call.

    Could you test our candidate fix in #80 / libnativeapi/nativeapi-core#114 (just rebased onto latest main) on your NVIDIA machine?

    git clone --recursive -b fix/windows-fullscreen-flutterview-issue-79 https://github.com/libnativeapi/nativeapi.git ../nativeapi-fix79

    Then add dependency_overrides to test_fullscreen_bug_nativeapi/pubspec.yaml:

    dependency_overrides:
      cnativeapi:
        path: ../nativeapi-fix79/bindings/dart/cnativeapi
      nativeapi:
        path: ../nativeapi-fix79/bindings/dart/nativeapi
      nativeapi_flutter:
        path: ../nativeapi-fix79/bindings/dart/nativeapi_flutter

    And run flutter clean && flutter run -d windows (or --release).

    Please let us know whether this fixes both the direct and post-frame+overlay paths on your setup — if it still freezes on NVIDIA, we'll know we need to adjust the fullscreen style / DWM transition itself (e.g. WS_POPUP / SWP_NOACTIVATE / DwmFlush).

  5. MatteoMagnani7 commented on Dec 4, 2026

    @MatteoMagnani7
    Author

    Hi, thanks for the reply and the hard work.

    I tried with your candidate fix and it's definitely better. But it seems that the issue is not completely resolved unfortunately. In fact, as shown in the video below after i click the fullscreen on/off there is lag for a second or two and everything is off as always, but after a second it re renders and everything is ok, but it feels still odd. Thanks again.

    Additional crash / assert on the post-frame path (with #80 overrides)

    Clicking once the post-frame + OverlayEntry fullscreen button throws Flutter scheduler assertions. Stack always goes through:

    addPostFrameCallback → Window.isFullScreen= → native_window_set_full_screen → nested _beginFrame / _drawFrame while still inside handleDrawFrame.

    [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: 'package:flutter/src/scheduler/binding.dart': Failed assertion: line 1342 pos 12: '_schedulerPhase == SchedulerPhase.midFrameMicrotasks': is not true.
    #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:67:4)
    #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:49:5)
    #2      SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1342:12)
    #3      SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1201:5)
    #4      _invoke (dart:ui/hooks.dart:441:13)
    #5      PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:453:5)
    #6      _drawFrame (dart:ui/hooks.dart:413:31)
    #7      native_window_set_full_screen (package:cnativeapi/src/bindings_generated.dart)
    #8      Window.isFullScreen= (package:nativeapi/src/window.dart:638:7)
    #9      _ReproHomePageState._applyReproFullScreen (package:test_fullscreen_bug_nativeapi/main.dart:93:14)
    #10     _ReproHomePageState.build.<anonymous closure> (package:test_fullscreen_bug_nativeapi/main.dart:135:59)
    #11     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1433:15)
    #12     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1360:11)
    #13     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1201:5)
    #14     _invoke (dart:ui/hooks.dart:441:13)
    #15     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:453:5)
    #16     _drawFrame (dart:ui/hooks.dart:413:31)
    

    schedulerPhase == SchedulerPhase.idle is not true _schedulerPhase == SchedulerPhase.midFrameMicrotasks is not true.

    So on NVIDIA + this path, fullscreen still looks broken and the sync native call appears to re-enter the Flutter frame scheduler.

    20261204-2104-29.5913036.mp4
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions