From 9f3de1a316faba9b04b1f04cca7d414ec913644a Mon Sep 17 00:00:00 2001 From: Ortes Date: Thu, 9 Jul 2026 14:00:32 -0400 Subject: [PATCH 1/4] feat: toggle fullscreen with the F key on desktop Add an F keyboard shortcut to the desktop controls that toggles fullscreen (respecting allowFullScreen), complementing the existing Esc-to-exit shortcut. --- lib/src/material/material_desktop_controls.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/material/material_desktop_controls.dart b/lib/src/material/material_desktop_controls.dart index acdd4a8b0..3f046af20 100644 --- a/lib/src/material/material_desktop_controls.dart +++ b/lib/src/material/material_desktop_controls.dart @@ -74,6 +74,11 @@ class _MaterialDesktopControlsState extends State if (chewieController.isFullScreen) { _onExpandCollapse(); } + } else if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.keyF) { + if (chewieController.allowFullScreen) { + _onExpandCollapse(); + } } } From de3e3b7b2ca20d9a26ae67181ebe5ae9227781f9 Mon Sep 17 00:00:00 2001 From: Ortes Date: Thu, 9 Jul 2026 14:00:33 -0400 Subject: [PATCH 2/4] docs: changelog entry for F-key fullscreen toggle --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a5997aa..936bd84fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [Unreleased] +* ⬆️ Add an `F` keyboard shortcut to toggle fullscreen on the desktop controls (respects `allowFullScreen`), complementing the existing `Esc`-to-exit shortcut. Thanks [Ortes](https://github.com/Ortes). + ## [1.14.1] * 🛠️ [#945](https://github.com/fluttercommunity/chewie/pull/945): Flutter 3.38 downgrade. Thanks [diegotori](https://github.com/diegotori). * Library now supports Flutter and Dart versions `3.38.0` and `3.10` or higher respectively, restoring previous compatibility. From 5fa45fb90a05e94db0c80c591abf7f69a5cdcffe Mon Sep 17 00:00:00 2001 From: Ortes Date: Thu, 9 Jul 2026 14:00:33 -0400 Subject: [PATCH 3/4] test: cover F-key fullscreen toggle and allowFullScreen gate --- test/keyboard_fullscreen_toggle_test.dart | 60 +++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 test/keyboard_fullscreen_toggle_test.dart diff --git a/test/keyboard_fullscreen_toggle_test.dart b/test/keyboard_fullscreen_toggle_test.dart new file mode 100644 index 000000000..6931bd449 --- /dev/null +++ b/test/keyboard_fullscreen_toggle_test.dart @@ -0,0 +1,60 @@ +import 'package:chewie/chewie.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:video_player/video_player.dart'; + +const _src = + 'https://assets.mixkit.co/videos/preview/mixkit-spinning-around-the-earth-29351-large.mp4'; + +ChewieController _controller({bool allowFullScreen = true}) { + return ChewieController( + videoPlayerController: VideoPlayerController.networkUrl(Uri.parse(_src)), + autoPlay: false, + looping: false, + allowFullScreen: allowFullScreen, + customControls: const MaterialDesktopControls(), + ); +} + +Future _pumpPlayer( + WidgetTester tester, + ChewieController controller, +) async { + await tester.pumpWidget( + MaterialApp( + home: Scaffold(body: Chewie(controller: controller)), + ), + ); + await tester.pump(); +} + +Future _pressF(WidgetTester tester) async { + await tester.sendKeyEvent(LogicalKeyboardKey.keyF); + await tester.pump(); + await tester.pump(const Duration(seconds: 1)); +} + +void main() { + testWidgets('F key toggles fullscreen on and off', (tester) async { + final controller = _controller(); + await _pumpPlayer(tester, controller); + expect(controller.isFullScreen, isFalse); + + await _pressF(tester); + expect(controller.isFullScreen, isTrue); + + await _pressF(tester); + expect(controller.isFullScreen, isFalse); + }); + + testWidgets('F key does nothing when allowFullScreen is false', ( + tester, + ) async { + final controller = _controller(allowFullScreen: false); + await _pumpPlayer(tester, controller); + + await _pressF(tester); + expect(controller.isFullScreen, isFalse); + }); +} From f6cceab0b8325b3ff097cf6bfb60de172daa3c25 Mon Sep 17 00:00:00 2001 From: Ortes Date: Thu, 9 Jul 2026 14:18:12 -0400 Subject: [PATCH 4/4] docs: reference PR #955 in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 936bd84fd..49a7f148a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ## [Unreleased] -* ⬆️ Add an `F` keyboard shortcut to toggle fullscreen on the desktop controls (respects `allowFullScreen`), complementing the existing `Esc`-to-exit shortcut. Thanks [Ortes](https://github.com/Ortes). +* ⬆️ [#955](https://github.com/fluttercommunity/chewie/pull/955): Add an `F` keyboard shortcut to toggle fullscreen on the desktop controls (respects `allowFullScreen`), complementing the existing `Esc`-to-exit shortcut. Thanks [Ortes](https://github.com/Ortes). ## [1.14.1] * 🛠️ [#945](https://github.com/fluttercommunity/chewie/pull/945): Flutter 3.38 downgrade. Thanks [diegotori](https://github.com/diegotori).