feat(web): native browser fullscreen via the Fullscreen API#946
Open
Ortes wants to merge 4 commits into
Open
Conversation
When running as a Flutter Web app, the fullscreen button now triggers the browser's native Fullscreen API (document.documentElement.requestFullscreen) in addition to Chewie's internal route-based fullscreen. This gives users a true OS-level fullscreen instead of just expanding within the browser window. Pressing Escape to exit native fullscreen also collapses Chewie's fullscreen route, keeping both states in sync. Implemented via conditional import (dart.library.html): web_fullscreen.dart uses package:web + dart:js_interop; web_fullscreen_stub.dart provides no-ops for non-web platforms. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add ChewieController.useNativeFullScreenOnWeb (default true) so the native browser Fullscreen behavior is opt-out rather than an unconditional change. No effect on non-web platforms. Also adds a CHANGELOG entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
diegotori
requested changes
May 31, 2026
- Remove `// ignore: uri_does_not_exist`; chewie_player.dart now imports the plain `web_fullscreen.dart` abstraction, which conditionally exports the stub or the real implementation. - Use `dart.library.js_interop` instead of `dart.library.html` for the conditional export. - Move the dart:js_interop / package:web implementation into web_fullscreen_impl.dart. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
There are conflicts to resolve before this can be merged. Thanks. |
…ullscreen # Conflicts: # CHANGELOG.md # pubspec.yaml
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #946 +/- ##
==========================================
- Coverage 43.82% 43.79% -0.03%
==========================================
Files 21 22 +1
Lines 1602 1619 +17
==========================================
+ Hits 702 709 +7
- Misses 900 910 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This was referenced May 31, 2026
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.
Problem
On Flutter Web, entering fullscreen only pushes a route that expands the Flutter view inside the browser window — it never enters the browser's real, OS-level fullscreen. Users expect the video to fill the whole screen (like every
<video>element and every other web player), but instead it just fills the page. This is a long-standing rough edge for web users.What this does
Adds an opt-out
ChewieController.useNativeFullScreenOnWebflag (defaulttrue) that, on web, also drives the browser's Fullscreen API:document.documentElement.requestFullscreen()(issued before the firstawait, so it's still inside the user-gesture handler the browser requires).document.exitFullscreen().fullscreenchange; Chewie listens and exits its own fullscreen route so the two states stay in sync.No behavior change on Android / iOS / desktop — the flag has no effect off web.
Implementation notes
package:web:lib/src/web_fullscreen.dart— real impl (package:web+dart:js_interop)lib/src/web_fullscreen_stub.dart— no-op stubslib/src/chewie_player.dart— new field + constructor arg +copyWith; listener registration ininitState/dispose; enter/exit calls in_pushFullScreenWidget, all gated by the flag.pubspec.yaml— addsweb: ^1.0.0.Happy to flip the default to
falseif you'd prefer it strictly opt-in, or to add a small example/integration test — let me know your preference.