diff --git a/CHANGELOG.md b/CHANGELOG.md index 41b92ca7a..8931caea3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [Unreleased] +* 👆 [#932](https://github.com/fluttercommunity/chewie/pull/932): Add `ChewieController.allowDoubleTapToggleFullScreen` (default `true`) to toggle fullscreen with a double tap on the video. Thanks [Ortes](https://github.com/Ortes). + ## [1.15.0] * 🌐 [#946](https://github.com/fluttercommunity/chewie/pull/946): Web: enter the browser's native (OS-level) fullscreen via the Fullscreen API instead of only expanding the Flutter view inside the browser window. Pressing Escape to leave browser fullscreen also exits Chewie's fullscreen. Controlled by the new `ChewieController.useNativeFullScreenOnWeb` flag (defaults to `true`; no effect on non-web platforms). Thanks [Ortes](https://github.com/Ortes). * 🖱️ [#950](https://github.com/fluttercommunity/chewie/pull/950): Show click cursor on hover over Material controls and progress bar. Thanks [Ortes](https://github.com/Ortes). diff --git a/lib/src/chewie_player.dart b/lib/src/chewie_player.dart index ead0c6bed..64136a708 100644 --- a/lib/src/chewie_player.dart +++ b/lib/src/chewie_player.dart @@ -364,6 +364,7 @@ class ChewieController extends ChangeNotifier { this.hideControlsTimer = defaultHideControlsTimer, this.controlsSafeAreaMinimum = EdgeInsets.zero, this.pauseOnBackgroundTap = false, + this.allowDoubleTapToggleFullScreen = true, }) : assert( playbackSpeeds.every((speed) => speed > 0), 'The playbackSpeeds values must all be greater than 0', @@ -425,6 +426,7 @@ class ChewieController extends ChangeNotifier { )? routePageBuilder, bool? pauseOnBackgroundTap, + bool? allowDoubleTapToggleFullScreen, }) { return ChewieController( draggableProgressBar: draggableProgressBar ?? this.draggableProgressBar, @@ -492,6 +494,8 @@ class ChewieController extends ChangeNotifier { progressIndicatorDelay: progressIndicatorDelay ?? this.progressIndicatorDelay, pauseOnBackgroundTap: pauseOnBackgroundTap ?? this.pauseOnBackgroundTap, + allowDoubleTapToggleFullScreen: + allowDoubleTapToggleFullScreen ?? this.allowDoubleTapToggleFullScreen, ); } @@ -685,6 +689,9 @@ class ChewieController extends ChangeNotifier { /// Defines if the player should pause when the background is tapped final bool pauseOnBackgroundTap; + /// Defines if double tap should toggle fullscreen mode + final bool allowDoubleTapToggleFullScreen; + static ChewieController of(BuildContext context) { final chewieControllerProvider = context .dependOnInheritedWidgetOfExactType()!; diff --git a/lib/src/material/material_controls.dart b/lib/src/material/material_controls.dart index 3c5de69c8..fc3c5d538 100644 --- a/lib/src/material/material_controls.dart +++ b/lib/src/material/material_controls.dart @@ -364,6 +364,9 @@ class _MaterialControlsState extends State }); } }, + onDoubleTap: chewieController.allowDoubleTapToggleFullScreen + ? _onExpandCollapse + : null, child: Container( alignment: Alignment.center, color: Colors