Skip to content

feat: auto-hide the mouse cursor while idle in fullscreen - #954

Open
Ortes wants to merge 4 commits into
fluttercommunity:masterfrom
Ortes:feat/hide-cursor-in-fullscreen
Open

feat: auto-hide the mouse cursor while idle in fullscreen#954
Ortes wants to merge 4 commits into
fluttercommunity:masterfrom
Ortes:feat/hide-cursor-in-fullscreen

Conversation

@Ortes

@Ortes Ortes commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What

In fullscreen the mouse cursor currently stays visible forever. This makes it auto-hide together with the controls once the player goes idle, and reappear as soon as the mouse moves — the behaviour of most video players (YouTube, VLC, …).

How

  • Each controls widget already wraps the whole video surface in a root MouseRegion whose onHover reveals the controls. We simply set that region's cursor to SystemMouseCursors.none while hideCursorInFullScreen && isFullScreen && hideStuff, and MouseCursor.defer otherwise (so inner per-widget cursors still win when the controls are visible).
  • Applied to all three control sets (MaterialDesktopControls, MaterialControls, CupertinoControls), matching the cross-file precedent of pauseOnBackgroundTap.
  • No new timer or platform channel: SystemMouseCursors.none maps to CSS cursor: none on web and works on desktop too; it is a no-op on pointerless devices.
  • Gated by a new ChewieController.hideCursorInFullScreen option (default true), wired through copyWith.

Tests

test/hide_cursor_test.dart covers the option default/copyWith and that the cursor is never hidden while not in fullscreen even when the controls are idle (the gate).

dart format, flutter analyze lib test, and the full flutter test suite are clean.

Ortes added 4 commits July 8, 2026 20:09
Toggle the root MouseRegion's cursor to SystemMouseCursors.none once the
controls auto-hide in fullscreen, and restore it on mouse movement (the
existing onHover handler already reveals the controls). Works on web and
desktop, no-op on pointerless devices. Gated by the new
ChewieController.hideCursorInFullScreen option (default true).
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.51%. Comparing base (69a8fc7) to head (046b10a).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
lib/src/chewie_player.dart 0.00% 1 Missing ⚠️
lib/src/cupertino/cupertino_controls.dart 80.00% 1 Missing ⚠️
lib/src/material/material_controls.dart 80.00% 1 Missing ⚠️
lib/src/material/material_desktop_controls.dart 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #954      +/-   ##
==========================================
+ Coverage   43.82%   48.51%   +4.69%     
==========================================
  Files          21       21              
  Lines        1602     1618      +16     
==========================================
+ Hits          702      785      +83     
+ Misses        900      833      -67     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant