Skip to content

feat: native browser fullscreen on web#1

Closed
Ortes wants to merge 13 commits into
masterfrom
feat/web-native-fullscreen
Closed

feat: native browser fullscreen on web#1
Ortes wants to merge 13 commits into
masterfrom
feat/web-native-fullscreen

Conversation

@Ortes

@Ortes Ortes commented May 31, 2026

Copy link
Copy Markdown
Owner

Summary

On Flutter Web, the fullscreen button now triggers the browser's native (OS-level) Fullscreen API (document.documentElement.requestFullscreen()) in addition to Chewie's route-based fullscreen — instead of merely expanding the Flutter view inside the browser window.

  • Pressing Escape to leave native fullscreen also exits Chewie's fullscreen (via a fullscreenchange listener), keeping both states in sync.
  • Gated behind a new ChewieController.useNativeFullScreenOnWeb flag, default true. No effect on non-web platforms.
  • Implemented with a conditional import (dart.library.html) so non-web builds use no-op stubs and never reference package:web.

Implementation

  • lib/src/web_fullscreen.dart — web implementation using package:web + dart:js_interop
  • lib/src/web_fullscreen_stub.dart — no-op stubs for non-web platforms
  • lib/src/chewie_player.dart:
    • new useNativeFullScreenOnWeb field + constructor param + copyWith
    • initState registers a fullscreenchange listener (Escape → exit) when enabled
    • _pushFullScreenWidget calls requestBrowserFullscreen() before the first await (still inside the user-gesture handler, so the browser permits it)
    • after the route pops, exitBrowserFullscreen() exits native fullscreen
  • pubspec.yaml — adds web: ^1.0.0

🤖 Generated with Claude Code

Cleparr and others added 13 commits March 11, 2026 21:36
…imer-mounted-check

fix: add mounted check in _startHideTimer to prevent setState after dispose
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>
- 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>
…ullscreen

# Conflicts:
#	CHANGELOG.md
#	pubspec.yaml
@Ortes

Ortes commented May 31, 2026

Copy link
Copy Markdown
Owner Author

Closing: this fork self-PR is redundant with upstream PR fluttercommunity#946 which tracks the same feat/web-native-fullscreen work.

@Ortes Ortes closed this May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants